From 8cfe88ec6a7d180e25d8472e1546b3987e716147 Mon Sep 17 00:00:00 2001 From: Garrett 'Karto' Keating Date: Tue, 19 Mar 2024 09:57:46 -0400 Subject: [PATCH] Minor updates and fixes based on SMA user testing. --- pyuvdata/uvcal/ms_cal.py | 12 +++++++----- pyuvdata/uvcal/tests/test_uvcal.py | 1 + pyuvdata/uvcal/uvcal.py | 5 +++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/pyuvdata/uvcal/ms_cal.py b/pyuvdata/uvcal/ms_cal.py index 63c27a5f02..488ff75f1e 100644 --- a/pyuvdata/uvcal/ms_cal.py +++ b/pyuvdata/uvcal/ms_cal.py @@ -205,7 +205,7 @@ def read_ms_cal( # Don't think CASA is going to support a non-sky based model, but hey, who knows self.cal_style = "sky" self.gain_convention = "divide" # N.b., manually verified by Karto in CASA v6.4 - self.Nsources = len(np.unique(tb_main.getcol("FIELD_ID"))) + self.Nphase = len(np.unique(tb_main.getcol("FIELD_ID"))) # Just assume that the gain scale is always in Jy self.gain_scale = "Jy" @@ -221,8 +221,6 @@ def read_ms_cal( self.freq_array = None self.channel_width = None self.flex_spw_id_array = None - self.Nfreqs = 1 - nchan = self.Nspws self.sky_catalog = "CASA (import)" @@ -300,7 +298,11 @@ def read_ms_cal( # Figure out which spectral slice this corresponds to spw_slice = spw_slice_dict[spw_id] - # Finally, start plugging in solns to various parameters. + # Finally, start plugging in solns to various parameters. Note that + # because of the conjugation scheme, normally we'd have to flip this for + # CASA, except that the Antenna1 entries appear to be "pre-conjugated", + # and thus no flip is necessary for gains solns. + # TODO: Verify this is the case for delay solns as well. ms_cal_soln[ant_idx, spw_slice, time_idx, :] = cal_soln self.time_array[time_idx] = time_val self.integration_time[time_idx] = exp_time @@ -525,7 +527,7 @@ def write_ms_cal(self, filename, clobber=False): ms.putcol("ANTENNA1", ant_array) ms.putcol("ANTENNA2", refant_array) ms.putcol("INTERVAL", interval_array) - ms.putcol("EXPOSURE", exposure_array) + # ms.putcol("EXPOSURE", exposure_array) ms.putcol("SCAN_NUMBER", scan_number_array) ms.putcol("OBSERVATION_ID", obs_id_array) diff --git a/pyuvdata/uvcal/tests/test_uvcal.py b/pyuvdata/uvcal/tests/test_uvcal.py index 9fd78015c0..0e611ff2dd 100644 --- a/pyuvdata/uvcal/tests/test_uvcal.py +++ b/pyuvdata/uvcal/tests/test_uvcal.py @@ -89,6 +89,7 @@ def uvcal_data(): "phase_center_catalog", "phase_center_id_array", "antenna_diameters", + "Nphase", ] extra_parameters = ["_" + prop for prop in extra_properties] diff --git a/pyuvdata/uvcal/uvcal.py b/pyuvdata/uvcal/uvcal.py index baaf13d44f..207d959687 100644 --- a/pyuvdata/uvcal/uvcal.py +++ b/pyuvdata/uvcal/uvcal.py @@ -506,6 +506,11 @@ def __init__(self): "Nsources", required=False, expected_type=int, description=desc ) + desc = "Number of sources used." + self._Nphase = uvp.UVParameter( + "Nphase", required=False, expected_type=int, description=desc + ) + desc = "Range of baselines used for calibration." self._baseline_range = uvp.UVParameter( "baseline_range",