Skip to content

Commit

Permalink
Minor updates and fixes based on SMA user testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
kartographer committed Mar 19, 2024
1 parent e3fbdca commit 8cfe88e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pyuvdata/uvcal/ms_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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)"

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions pyuvdata/uvcal/tests/test_uvcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
5 changes: 5 additions & 0 deletions pyuvdata/uvcal/uvcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 8cfe88e

Please sign in to comment.