Skip to content

Commit

Permalink
filter based on delay resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
jsdillon committed Mar 4, 2025
1 parent 663a717 commit 0dc84f8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions notebooks/single_baseline_2D_filtered_SNRs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@
"FM_HIGH_FREQ = float(os.environ.get(\"FM_HIGH_FREQ\", 108.0)) # in MHz\n",
"\n",
"FILTER_DELAY = float(os.environ.get(\"FILTER_DELAY\", 750)) # in ns\n",
"POST_FILTER_1D_DELAY = float(os.environ.get(\"POST_FILTER_1D_DELAY\", 1.0)) # in ns\n",
"POST_FILTER_DELAY_RES_FACTOR = float(os.environ.get(\"POST_FILTER_DELAY_RES_FACTOR\", 1.0)) # in ns\n",
"MIN_FRATE_HALF_WIDTH = float(os.environ.get(\"MIN_FRATE_HALF_WIDTH\", 2.0)) # in mHz\n",
"EIGENVAL_CUTOFF = float(os.environ.get(\"EIGENVAL_CUTOFF\", 1e-12))\n",
"\n",
"for setting in ['RED_AVG_FILE', 'CORNER_TURN_MAP_YAML', 'SNR_SUFFIX']:\n",
" print(f'{setting} = \"{eval(setting)}\"')\n",
"for setting in ['FM_LOW_FREQ', 'FM_HIGH_FREQ', 'FILTER_DELAY', 'POST_FILTER_1D_DELAY', 'MIN_FRATE_HALF_WIDTH', 'EIGENVAL_CUTOFF']:\n",
"for setting in ['FM_LOW_FREQ', 'FM_HIGH_FREQ', 'FILTER_DELAY', 'POST_FILTER_DELAY_RES_FACTOR', 'MIN_FRATE_HALF_WIDTH', 'EIGENVAL_CUTOFF']:\n",
" print(f'{setting} = {eval(setting)}')"
]
},
Expand Down Expand Up @@ -312,11 +312,12 @@
" filtered_SNR[bl][tslice, band] /= SNR_correction\n",
"\n",
" # filter out very low delay modes in 1D \n",
" filt_dly_1d = ((band.stop - band.start) * np.median(np.diff(data.freqs)))**-1 * POST_FILTER_DELAY_RES_FACTOR\n",
" d_mdl_1D, _, _ = fourier_filter(data.freqs[band], \n",
" filtered_SNR[bl][tslice, band], \n",
" wgts=wgts[tslice, band], \n",
" filter_centers=[0], \n",
" filter_half_widths=[POST_FILTER_1D_DELAY / 1e9],\n",
" filter_half_widths=[filt_dly_1d],\n",
" mode='dpss_solve', \n",
" eigenval_cutoff=[EIGENVAL_CUTOFF],\n",
" suppression_factors=[EIGENVAL_CUTOFF], \n",
Expand All @@ -326,8 +327,7 @@
" \n",
" # calculate and apply another correction factor based on the leverage to flatten out the SNR\n",
" correction_factors = np.full_like(wgts_1D[tslice, band], np.nan) \n",
" X = dpss_operator(data.freqs[band], [0], filter_half_widths=[POST_FILTER_1D_DELAY / 1e9], \n",
" eigenval_cutoff=[EIGENVAL_CUTOFF])[0]\n",
" X = dpss_operator(data.freqs[band], [0], filter_half_widths=[filt_dly_1d], eigenval_cutoff=[EIGENVAL_CUTOFF])[0]\n",
" for tind in range(wgts_1D[tslice, band].shape[0]):\n",
" W = wgts_1D[tind, band]\n",
" if not np.all(W == 0):\n",
Expand Down

0 comments on commit 0dc84f8

Please sign in to comment.