From a1b68edde497e881a530ebfe67a7ae3a87597370 Mon Sep 17 00:00:00 2001 From: tgalvin Date: Fri, 9 Feb 2024 09:53:15 +0800 Subject: [PATCH] added some TODOs/test --- flint/bptools/smoother.py | 1 + flint/calibrate/aocalibrate.py | 1 + tests/test_aocalibrate.py | 16 ++++++++++++++++ 3 files changed, 18 insertions(+) diff --git a/flint/bptools/smoother.py b/flint/bptools/smoother.py index 10e825e1..c129b323 100644 --- a/flint/bptools/smoother.py +++ b/flint/bptools/smoother.py @@ -149,6 +149,7 @@ def smooth_bandpass_complex_gains( "Consider whether you really want to be smoothing when using continuum data. " ) for ant in range(ants): + # TODO: This will be smoothing the X_y and Y_x. Should this actually be done? for pol in range(pols): smoothed_complex_gains[ant, :, pol].real = smooth_data( data=complex_gains[ant, :, pol].real, diff --git a/flint/calibrate/aocalibrate.py b/flint/calibrate/aocalibrate.py index 22abe29b..955c5f8a 100644 --- a/flint/calibrate/aocalibrate.py +++ b/flint/calibrate/aocalibrate.py @@ -203,6 +203,7 @@ def plot_solutions( logger.info(f"Overwriting reference antenna selection, using {ref_ant=}") if ref_ant is not None: + # TODO: This is going to change the amplitudes as well. This is likely not wanted! data = data / ao_sols.bandpass[plot_sol, ref_ant, :, :] amplitudes = np.abs(data) diff --git a/tests/test_aocalibrate.py b/tests/test_aocalibrate.py index b37afd7a..85b2641a 100644 --- a/tests/test_aocalibrate.py +++ b/tests/test_aocalibrate.py @@ -123,6 +123,22 @@ def test_known_bad_sols(ao_sols_known_bad): flag_aosolutions(solutions_path=ao_sols_known_bad, plot_solutions_throughout=False) +def test_sols_same_with_plots(ao_sols_known_bad): + # Had a thought at one point the plktting was updating th mutable numpy array before + # it was writen back to file. Wrote the test, and it passed. Test stays + a = flag_aosolutions( + solutions_path=ao_sols_known_bad, plot_solutions_throughout=False + ) + a_loaded = AOSolutions.load(a.path) + + b = flag_aosolutions( + solutions_path=ao_sols_known_bad, plot_solutions_throughout=True + ) + b_loaded = AOSolutions.load(b.path) + + assert np.allclose(a_loaded.bandpass, b_loaded.bandpass, equal_nan=True) + + def test_flagged_aosols(ao_sols_known_bad): flagged_sols = flag_aosolutions( solutions_path=ao_sols_known_bad,