Skip to content

Commit

Permalink
Set bl_error_tol=2.0 everywhere in the pipeline
Browse files Browse the repository at this point in the history
This avoids a small number of redundant groups from getting split, mostly involving outriggers.
  • Loading branch information
jsdillon committed Aug 20, 2024
1 parent b011045 commit c57917e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
6 changes: 5 additions & 1 deletion hera_notebook_templates/notebooks/lststack.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,11 @@
},
"outputs": [],
"source": [
"reds_with_pols = RedundantGroups.from_antpos(antpos={i: pos for i, pos in enumerate(stackconf.config.datameta.antpos_enu)}, pols=stackconf.pols)"
"reds_with_pols = RedundantGroups.from_antpos(\n",
" antpos={i: pos for i, pos in enumerate(stackconf.config.datameta.antpos_enu)}, \n",
" pols=stackconf.pols,\n",
" bl_error_tol=2.0,\n",
")"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion notebooks/delay_filtered_average_zscore.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
" \n",
" # redundantly average\n",
" t = time.time()\n",
" reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], include_autos=True)\n",
" reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], include_autos=True, bl_error_tol=2.0)\n",
" red_avg_data, red_avg_flags, red_avg_nsamples = red_average(reds, data, nsamples, smooth_gains, flags=flags, cal_flags=cal_flags)\n",
" print(f'Finished redundantly averaging data in {(time.time() - t) / 60:.2f} minutes.')\n",
"\n",
Expand Down
12 changes: 6 additions & 6 deletions notebooks/file_calibration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@
"source": [
"# figure out and filter reds and classify antennas based on whether or not they are on the main grid\n",
"fr_settings = {'max_dims': OC_MAX_DIMS, 'min_dim_size': OC_MIN_DIM_SIZE, 'min_bl_cut': OC_MIN_BL_LEN, 'max_bl_cut': OC_MAX_BL_LEN}\n",
"reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol')\n",
"reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol', bl_error_tol=2.0)\n",
"reds = per_pol_filter_reds(reds, ex_ants=overall_class.bad_ants, antpos=hd.data_antpos, **fr_settings)\n",
"if OC_SKIP_OUTRIGGERS:\n",
" reds = redcal.filter_reds(reds, ex_ants=[ant for ant in ants if ant[0] >= 320])\n",
Expand Down Expand Up @@ -979,7 +979,7 @@
"metadata": {},
"outputs": [],
"source": [
"expanded_reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol')\n",
"expanded_reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol', bl_error_tol=2.0)\n",
"expanded_reds = per_pol_filter_reds(expanded_reds, ex_ants=(ant_metrics_class + solar_class + zeros_class + auto_class + xengine_diff_class).bad_ants,\n",
" max_dims=OC_MAX_DIMS, min_dim_size=OC_MIN_DIM_SIZE)\n",
"if OC_SKIP_OUTRIGGERS:\n",
Expand Down Expand Up @@ -1226,7 +1226,7 @@
" cross_pol_cal_start = time.time()\n",
"\n",
" # Compute reds for good antennas \n",
" cross_reds = redcal.get_reds(hd.data_antpos, pols=['en', 'ne']) \n",
" cross_reds = redcal.get_reds(hd.data_antpos, pols=['en', 'ne'], bl_error_tol=2.0) \n",
" cross_reds = redcal.filter_reds(cross_reds, ex_ants=overall_class.bad_ants, pols=['en', 'ne'], antpos=hd.antpos, **fr_settings) \n",
" unflagged_data_bls = [red[0] for red in cross_reds]\n",
"\n",
Expand Down Expand Up @@ -1306,7 +1306,7 @@
" \n",
" fig, axes = plt.subplots(2, 2, figsize=(14, 6), dpi=100, sharex='col', sharey='row', gridspec_kw={'hspace': 0, 'wspace': 0})\n",
" for i, pol in enumerate(['ee', 'nn']):\n",
" reds_here = redcal.get_reds(hd.data_antpos, pols=[pol], pol_mode='1pol')\n",
" reds_here = redcal.get_reds(hd.data_antpos, pols=[pol], pol_mode='1pol', bl_error_tol=2.0)\n",
" red = sorted(redcal.filter_reds(reds_here, ex_ants=overall_class.bad_ants), key=len, reverse=True)[0]\n",
" rc_data = {bl: sol.calibrate_bl(bl, data[bl]) for bl in red}\n",
" for bl in red:\n",
Expand Down Expand Up @@ -1445,7 +1445,7 @@
"outputs": [],
"source": [
"expand_start = time.time()\n",
"expanded_reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol')\n",
"expanded_reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn'], pol_mode='2pol', bl_error_tol=2.0)\n",
"sol.vis.build_red_keys(expanded_reds)\n",
"redcal.expand_omni_gains(sol, expanded_reds, data, chisq_per_ant=meta['chisq_per_ant'])\n",
"if not np.all([ant in overall_class.bad_ants for ant in ants]):\n",
Expand Down Expand Up @@ -1677,7 +1677,7 @@
" \n",
" if SAVE_OMNIVIS_FILE:\n",
" # output results, harmonizing keys over polarizations\n",
" all_reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn', 'en', 'ne'], pol_mode='4pol')\n",
" all_reds = redcal.get_reds(hd.data_antpos, pols=['ee', 'nn', 'en', 'ne'], pol_mode='4pol', bl_error_tol=2.0)\n",
" bl_to_red_map = {bl: red[0] for red in all_reds for bl in red}\n",
" hd_vissol.read(bls=[bl_to_red_map[bl] for bl in sol.vis], return_data=False)\n",
" hd_vissol.empty_arrays()\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/file_postprocessing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
"outputs": [],
"source": [
"# pick all reds that might be in the data, using the same set across polarizations for easier output\n",
"reds = redcal.get_reds(hd.data_antpos, pols=pols, include_autos=True)\n",
"reds = redcal.get_reds(hd.data_antpos, pols=pols, include_autos=True, bl_error_tol=2.0)\n",
"ex_ants = set(read_a_priori_ant_flags(aposteriori_yaml_file))\n",
"possibly_unflagged_bls = [bl for bl in data if utils.split_bl(bl)[0] not in ex_ants and utils.split_bl(bl)[1] not in ex_ants]\n",
"possibly_unflagged_antpairs = set([ap for bl in possibly_unflagged_bls for ap in [bl[:2], bl[-2::-1]]])\n",
Expand Down
2 changes: 1 addition & 1 deletion notebooks/single_baseline_postprocessing_and_pspec.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@
"if USE_SIMULATED_NOISE:\n",
" np.random.seed(21)\n",
"\n",
" reds = redcal.get_reds(filt_data.data_antpos, pols=['ee', 'nn'], include_autos=True)\n",
" reds = redcal.get_reds(filt_data.data_antpos, pols=['ee', 'nn'], include_autos=True, bl_error_tol=2.0)\n",
" red_inpainted = datacontainer.RedDataContainer(data, reds=reds)\n",
"\n",
" for pol in ['ee', 'nn']:\n",
Expand Down

0 comments on commit c57917e

Please sign in to comment.