create_visibility_from_ms
- ska_sdp_datamodels.visibility.create_visibility_from_ms(msname, channum=None, start_chan=None, end_chan=None, ack=False, datacolumn='DATA', selected_sources=None, selected_dds=None, average_channels=False)[source]
Minimal MS to Visibility converter
The MS format is much more general than the RASCIL Visibility so we cut many corners. This requires casacore to be installed. If not an exception ModuleNotFoundError is raised.
Creates a list of Visibility’s, split by field and spectral window
Reading of a subset of channels is possible using either start_chan and end_chan or channnum. Using start_chan and end_chan is preferred since it only reads the channels required. Channum is more flexible and can be used to read a random list of channels.
- Parameters:
msname – File name of MS
channum – range of channels e.g. range(17,32), default is None meaning all
start_chan – Starting channel to read
end_chan – End channel to read
ack – Ask casacore to acknowledge each table operation
datacolumn – MS data column to read DATA, CORRECTED_DATA, or MODEL_DATA
selected_sources – Sources to select
selected_dds – Data descriptors to select
average_channels – Average all channels read
- Returns:
List of Visibility
For example:
selected_sources = ['1302+5748', '1252+5634'] bvis_list = create_visibility_from_ms('../../data/3C277.1_avg.ms', datacolumn='CORRECTED_DATA', selected_sources=selected_sources) sources = numpy.unique([bv.source for bv in bvis_list]) print(sources) ['1252+5634' '1302+5748']
Issues with Polarisation bug YAN-1616
The MS Format permits the order of the polarisations to essentially be arbitrary. As long as they are explicitly defined in the CORR_TYPE column.
This loader made the assumption that the input order is XX,YX,XY,YY even if it is not as it used “sorted” on the CORR_TYPE column.
This created bug YAN-1616 which has been fixed by removing the sorted() and introducing the linearFITs frame.
I have left this comment here as: * This change did not break the existing unit tests. * I am concerned there is a use case that relies on
the sorted() and will now break.
Steve Ord - 2024 12 December