karabo.util.ska_sdp_datamodels.visibility package
Submodules
karabo.util.ska_sdp_datamodels.visibility.msv2 module
Source: https://gitlab.com/ska-telescope/sdp/ska-sdp-datamodels Copyright: SKAO License: Apache License 2.0
MeasurementSets V2 Codes Based on Python-casacore For ska-sdp-datamodels
- class Ms(filename, ref_time=0.0, source_name=None, frame='ITRF', verbose=False, if_delete=False)
Bases:
WriteMs
Class for storing visibility data and writing the data, along with array geometry, frequency setup, etc., to a CASA measurement set.
- class WriteMs(filename, ref_time=0.0, source_name=None, frame='ITRF', verbose=False, if_delete=False)
Bases:
BaseData
Class for storing visibility data and writing the data, along with array geometry, frequency setup, etc., to a CASA measurement set.
- add_data_set(obstime, inttime, baselines, visibilities, flags=None, weights=None, pol='XX', source=None, phasecentre=None, uvw=None)
Create a UVData object to store a collection of visibilities.
- close()
Close out the file.
- set_geometry(site_config, antennas, bits=8)
Given a station and an array of stands, set the relevant common observation parameters and add entries to the self.array list.
- Parameters:
site_config – RASCIL Configuration
antennas – Antenna array
bits – Preserved
- write()
Fill in the Measurement Sets file with correct order.
karabo.util.ska_sdp_datamodels.visibility.msv2fund module
Source: https://gitlab.com/ska-telescope/sdp/ska-sdp-datamodels Copyright: SKAO License: Apache License 2.0
MeasurementSets V2 Reference Codes Based on Python-casacore
- class Antenna(ant_id, stand=None, pol=0, theta=0.0, phi=0.0, fee=None, feePort=1, cable=None)
Bases:
object
- Object to store the information about an antenna. Stores antenna:
ID number (id)
Stand instance the antenna is part of (stand)
Polarization (0 == N-S; pol)
Antenna vertical mis-alignment in degrees (theta)
Antenna rotation mis-alignment in degrees (phi)
Fee instance the antenna is attached to (fee)
Port of the FEE used for the antenna (feePort)
Cable instance used to connect the antenna (cable)
Some arguments are designed for future extension
- class BaseData(filename, ref_time=0.0, source_name=None, frame='ITRF', verbose=False)
Bases:
object
Base Data class: For an observation of interferometer, we should have: Antenna, Frequency, Visibility Funcation, UVW
- add_data_set(obstime, inttime, baselines, visibilities, flags=None, weights=None, pol='XX', source=None)
Create a UVData object to store a collection of visibilities.
- close()
Close out the file.
- static parse_time(ref_time)
Given a time as either a integer, float, string, or datetime object, convert it to a string in the formation ‘YYYY-MM-DDTHH:MM:SS’.
- set_frequency(freq, channel_width)
Given a numpy array of frequencies, set the relevant common observation parameters and add an entry to the self.freq list.
- set_stokes(polList)
Given a list of Stokes parameters, update the object’s parameters.
- write()
Fill in the file will all of the required supporting metadata.
- class Observatory(name, lon, lat, alt)
Bases:
object
Observatory class. Contains the location of the observatory.
- class Stand(stand_id, x, y, z)
Bases:
object
Object to store the information (location and ID) about a stand. Stores stand:
ID number (id)
Position relative to the center stake in meters (x,y,z)
- The x, y, and z positions can also be accessed through subscripts:
Stand[0] = x Stand[1] = y Stand[2] = z
karabo.util.ska_sdp_datamodels.visibility.msv2supp module
Source: https://gitlab.com/ska-telescope/sdp/ska-sdp-datamodels Copyright: SKAO License: Apache License 2.0
MeasurementSets V2 Reference Codes Based on Python-casacore
karabo.util.ska_sdp_datamodels.visibility.vis_io_ms module
Source: https://gitlab.com/ska-telescope/sdp/ska-sdp-datamodels Copyright: SKAO License: Apache License 2.0
Base functions to create and export Visibility from/into Measurement Set files. They take definitions of columns from msv2.py and interact with Casacore.
- export_visibility_to_ms(msname, vis_list, source_name=None)
Minimal Visibility to MS 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.
Write a list of Visibility’s to a MS file, split by field and spectral window
- Parameters:
msname – File name of MS
vis_list – list of Visibility
source_name – Source name to use
ack – Ask casacore to acknowledge each table operation
- Returns:
Module contents
Copied from ska_sdp_datamodels v0.3.1 as a workaround. We need the export_visibility_to_ms function but it isn’t available until ska_sdp_datamodels v0.2.1, while Karabo uses v0.1.3. Upgrading to v0.2.1 will probably break RASCIL, which means we’d have to upgrade RASCIL, which in turn means we’d have to upgrade to Python 3.10, which is out-of-scope for now.
Additional info: export_visibility_to_ms added to ska_sdp_datamodels in v0.2.1. v0.2.1 and v0.2.2 would be compatible with Python 3.9. numpy is fixed to ^1.23, <1.24. Reason stated: “numpy version set to be compatible with RASCIL” RASCIL and ska_sdp_datamodels seem to be quite tightly coupled, serious doubts if RASCIL v1.0.0 would work with ska_sdp_datamodels v0.2.1 or 0.2.2. In addition, there’s a bunch of fixes to the vis_io_ms.py module that contains export_visibility_to_ms after v0.2.2 that we probably want as well.
TODO remove karabo.util.ska_sdp_datamodels when upgrade to Python 3.10, RASCIL > 1.0.0, ska_sdp_datamodels >= 0.2.1 or hopefully >= 0.3.1 is done. Change imports to ska_sdp_datamodels.visibility.*