diff --git a/hera_notebook_templates/notebooks/lststack.ipynb b/hera_notebook_templates/notebooks/lststack.ipynb index 6b8a09a..9d69d34 100644 --- a/hera_notebook_templates/notebooks/lststack.ipynb +++ b/hera_notebook_templates/notebooks/lststack.ipynb @@ -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", + ")" ] }, { diff --git a/notebooks/delay_filtered_average_zscore.ipynb b/notebooks/delay_filtered_average_zscore.ipynb index 48a31f4..858717a 100644 --- a/notebooks/delay_filtered_average_zscore.ipynb +++ b/notebooks/delay_filtered_average_zscore.ipynb @@ -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", diff --git a/notebooks/file_calibration.ipynb b/notebooks/file_calibration.ipynb index f7345c6..8c78ac1 100644 --- a/notebooks/file_calibration.ipynb +++ b/notebooks/file_calibration.ipynb @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", diff --git a/notebooks/file_postprocessing.ipynb b/notebooks/file_postprocessing.ipynb index 89e0573..639df4e 100644 --- a/notebooks/file_postprocessing.ipynb +++ b/notebooks/file_postprocessing.ipynb @@ -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", diff --git a/notebooks/single_baseline_postprocessing_and_pspec.ipynb b/notebooks/single_baseline_postprocessing_and_pspec.ipynb index 17aafed..a06d41d 100644 --- a/notebooks/single_baseline_postprocessing_and_pspec.ipynb +++ b/notebooks/single_baseline_postprocessing_and_pspec.ipynb @@ -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",