Skip to content

Commit

Permalink
fix handling of weights for delay filtering of en and ne visibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
jsdillon committed Jul 16, 2024
1 parent 93149d3 commit eae90a1
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions notebooks/file_postprocessing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@
"dly_filt_red_avg_abs_cal_sum_data = copy.deepcopy(red_avg_abs_cal_sum_data)\n",
"dly_filt_red_avg_abs_cal_diff_data = copy.deepcopy(red_avg_abs_cal_diff_data)\n",
"\n",
"auto_bls = [bl for bl in dly_filt_red_avg_smooth_cal_sum_data if bl[0] == bl[1]]\n",
"auto_bls = [bl for bl in dly_filt_red_avg_smooth_cal_sum_data if utils.split_bl(bl)[0] == utils.split_bl(bl)[1]]\n",
"gap_flag_warned = set()\n",
"\n",
"new_cache_keys = []\n",
Expand All @@ -553,8 +553,9 @@
" \n",
" for bl in sorted(red_avg_flags.keys(), key=lambda bl: np.sum(red_avg_flags[bl]), reverse=True):\n",
" # inverse variance weight using smooth_calibrated autocorrealtions (which are proprotional to std of noise)\n",
" auto_bl = [abl for abl in auto_bls if abl[2] == bl[2]][0]\n",
" wgts = np.where(red_avg_flags[bl], 0, red_avg_smooth_cal_sum_data[auto_bl]**-2)\n",
" auto_bl1 = [abl for abl in auto_bls if abl[2] == utils.join_pol(utils.split_pol(bl[2])[0], utils.split_pol(bl[2])[0])][0]\n",
" auto_bl2 = [abl for abl in auto_bls if abl[2] == utils.join_pol(utils.split_pol(bl[2])[1], utils.split_pol(bl[2])[1])][0]\n",
" wgts = np.where(red_avg_flags[bl], 0, np.abs(red_avg_smooth_cal_sum_data[auto_bl1] * red_avg_smooth_cal_sum_data[auto_bl2])**-1)\n",
" wgts /= np.nanmean(np.where(red_avg_flags[bl], np.nan, wgts)) # avoid dynamic range issues\n",
" wgts[~np.isfinite(wgts)] = 0 \n",
"\n",
Expand Down

0 comments on commit eae90a1

Please sign in to comment.