ObservingRun¶
- class ObservingRun[source]¶
Bases:
objectA logical representation of an observing run.
- measurement_sets¶
List of measurementSet objects associated with run.
- ms_datatable_name¶
Path to directory that stores DataTable of each MeasurementSet (Single-Dish only).
- ms_reduction_group¶
Dictionary of reduction groups (Single-Dish only).
- org_directions¶
Dictionary with Direction objects of the origin (Single-Dish only).
- virtual_science_spw_ids¶
Dictionary mapping each virtual science spectral window ID (key) to corresponding science spectral window name (value) that first appears in the imported measurement sets.
- virtual_science_spw_names¶
Dictionary mapping each science spectral window name (key) to corresponding virtual spectral window ID (value). Multiple SPW names may map to the same virtual spw ID.
- virtual_science_spw_shortnames¶
Property returning a dictionary mapping each science spectral window name to its shortened version.
Attributes Summary
Return end date and time of latest measurement set in this observing run.
Return end time of latest measurement set in this observing run.
Return unique execution block ID(s) associated with the MSes in this observing run.
Return unique observer(s) associated with the MSes in this observing run.
Return unique project ID(s) associated with the MSes in this observing run.
Return unique scheduling block ID(s) associated with the MSes in this observing run.
Return start date and time of earliest measurement set in this observing run.
Return start time of earliest measurement set in this observing run.
Generate SPW shortnames derived from full SPW names.
Methods Summary
Add a MeasurementSet to the ObservingRun.
get_measurement_sets([names, intents, fields])Returns measurement sets matching the given arguments.
get_measurement_sets_of_type(dtypes[, ...])Return a list of MeasurementSet domain object with matching DataType.
get_ms([name, intent])Returns the first measurement set matching the given identifier.
get_real_spw_id_by_name(spw_name, target_ms)Translate a (science) spw name to the real spw ID for a given MS.
get_real_spwsel(spwsel, vis)Translate a virtual (science) spw selection to the real one for a given MS.
get_virtual_spw_id_by_name(spw_name)Translate a (science) spw name to the virtual spw ID for this pipeline run.
real2real_spw_id(spw_id, source_ms, target_ms)Translates a real spectral window (SPW) ID from one MS to another.
real2virtual_spw_id(spw_id, target_ms)Translate a real (science) spw ID of a given MS to the virtual one for this pipeline run.
virtual2real_spw_id(spw_id, target_ms)Translate a virtual (science) spw ID to the real one for a given MS.
Attributes Documentation
- end_datetime¶
Return end date and time of latest measurement set in this observing run.
Returns latest MS end time as a datetime object, or None if there are no measurement sets registered in this observing run.
- end_time¶
Return end time of latest measurement set in this observing run.
Returns latest MS end time as a CASA 'epoch' measure dictionary, or None if there are no measurement sets registered in this observing run.
- execblock_ids¶
Return unique execution block ID(s) associated with the MSes in this observing run.
- observers¶
Return unique observer(s) associated with the MSes in this observing run.
- project_ids¶
Return unique project ID(s) associated with the MSes in this observing run.
- schedblock_ids¶
Return unique scheduling block ID(s) associated with the MSes in this observing run.
- start_datetime¶
Return start date and time of earliest measurement set in this observing run.
Returns earliest MS start time as a datetime object, or None if there are no measurement sets registered in this observing run.
- start_time¶
Return start time of earliest measurement set in this observing run.
Returns earliest MS start time as a CASA 'epoch' measure dictionary, or None if there are no measurement sets registered in this observing run.
- virtual_science_spw_shortnames¶
Generate SPW shortnames derived from full SPW names.
If the name contains 'ALMA', it attempts to remove any suffix starting from the last '#' character. Otherwise, the name is returned unchanged. This was originally implemented from PIPE-59/PIPE-123.
- Returns:
Dictionary mapping full SPW names to their shortened versions.
Methods Documentation
- add_measurement_set(ms: MeasurementSet) None[source]¶
Add a MeasurementSet to the ObservingRun.
- get_measurement_sets(names: str | None = None, intents: Iterable | str | None = None, fields: Iterable | str | None = None) list[MeasurementSet][source]¶
Returns measurement sets matching the given arguments.
- Parameters:
names -- Name(s) to find matching measurement set(s) for.
intents -- Intent(s) to find matching measurement set(s) for.
fields -- Field name(s) to find matching measurement set(s) for.
- Returns:
List of MeasurementSet objects for measurement sets matching given arguments.
- get_measurement_sets_of_type(dtypes: list[DataType], msonly: bool = True, source: str | None = None, spw: str | None = None, vis: list[str] | None = None) list[MeasurementSet] | tuple[collections.OrderedDict, DataType | None][source]¶
Return a list of MeasurementSet domain object with matching DataType.
The method returns a list of MSes of the first matching DataType in the list of dtypes.
- Parameters:
dtypes -- Search order of DataType. The search starts with the first DataType in the list and fallbacks to another DataType in the list only if no MS is found with the searched DataType. The search order of DataType is in the order of elements in list. Search stops at the first DataType with which at least one MS is found.
msonly -- If True, return a list of MS domain object only.
source -- Filter for particular source name selection (comma separated list of names).
spw -- Filter for particular virtual spw specification (comma separated list of virtual IDs).
vis -- Filter for list of MS names (list of strings)
- Returns:
When msonly is True, a list of MeasurementSet domain objects of a matching DataType (and optionally sources and spws) is returned. Otherwise, a tuple of an ordered dictionary and a matched DataType (and optionally sources and spws) is returned. The ordered dictionary stores matching MS domain objects as keys and matching data column names as values. The order of elements is that appears in measurement_sets list attribute.
- get_ms(name: str = None, intent: str = None) MeasurementSet[source]¶
Returns the first measurement set matching the given identifier.
Identifier precedence is name then intent.
- Parameters:
name -- Name to find matching measurement set for.
intent -- Intent to find matching measurement set for.
- Returns:
MeasurementSet object for first match found.
- Raises:
KeyError, if no measurement set is found for given name or intent. --
- static get_real_spw_id_by_name(spw_name: str | None, target_ms: MeasurementSet) int | None[source]¶
Translate a (science) spw name to the real spw ID for a given MS.
- Parameters:
spw_name -- The spectral window name to convert to ID.
target_ms -- The MS for which to map name to real spectral window ID.
- Returns:
Real spectral window ID for given spectral window name in given MS, or None if name was not found in the given MS.
- get_real_spwsel(spwsel: list[str], vis: list[str]) list[str | None][source]¶
Translate a virtual (science) spw selection to the real one for a given MS.
- Parameters:
spwsel -- The list of spw selections to convert.
vis -- The list of MS names for which to convert the virtual spw selection to a real spw selection.
- Returns:
List of real spw selections for given virtual spw selections and MS names. Returns None for entries where no valid real spw mappings are found.
- get_virtual_spw_id_by_name(spw_name: str) int | None[source]¶
Translate a (science) spw name to the virtual spw ID for this pipeline run.
- Parameters:
spw_name -- The spectral window name to convert.
- Returns:
Virtual spectral window ID for given name, or None if no virtual spw was found with given name.
- real2real_spw_id(spw_id: int | str, source_ms: MeasurementSet, target_ms: MeasurementSet) int | None[source]¶
Translates a real spectral window (SPW) ID from one MS to another.
The translation is done via via the pipeline's virtual SPW ID mapping.
- Parameters:
spw_id -- The real spectral window ID to translate. Can be an integer or a string.
source_ms -- The source MeasurementSet from which the SPW ID originates.
target_ms -- The target MeasurementSet to which the SPW ID should be mapped.
- Returns:
The corresponding real SPW ID in the target MS, or None if the mapping could not be performed (e.g., if the virtual SPW ID was not found for the source SPW).
- real2virtual_spw_id(spw_id: int | str, target_ms: MeasurementSet) int | None[source]¶
Translate a real (science) spw ID of a given MS to the virtual one for this pipeline run.
- Parameters:
spw_id -- The real spectral window ID (as integer or string) to convert.
target_ms -- The MS for which to map its real spw ID to the virtual spw ID.
- Returns:
Virtual spectral window ID in the observing run corresponding to the name of the given real spectral window ID in the given MS, or None if the spectral window name was not found.
- virtual2real_spw_id(spw_id: int | str, target_ms: MeasurementSet) int | None[source]¶
Translate a virtual (science) spw ID to the real one for a given MS.
- Parameters:
spw_id -- The virtual spectral window ID (as integer or string) to convert.
target_ms -- The MS for which to map virtual spw ID to real spw ID.
- Returns:
Real spectral window ID matching given virtual spectral ID in given MS. Returns None if either the given virtual spw ID does not exist or the given virtual spw ID does not appear in given MS.