ska_sdp_spectral_line_imaging.msreader module

ska_sdp_spectral_line_imaging.msreader.msv2_to_datatree(input_path, chunks)[source]
Return type:

DataTree

class ska_sdp_spectral_line_imaging.msreader.MSReader(input_path, chunks)[source]

Bases: object

static open_dataset(input_path, chunks)[source]

Open a measurement set as an xarray DataTree.

Attempts to read the input file as MSv4 (processing set) first, then falls back to MSv2 format if that fails.

Parameters:
  • input_path (str) -- Path to the measurement set file.

  • chunks (dict[str, int]) -- Dictionary specifying chunk sizes for dimensions. Required for reading MSv2 format.

Returns:

The measurement set as an xarray DataTree object.

Return type:

xr.DataTree

Raises:

Exception -- If reading as both MSv4 and MSv2 formats fails.

get_datatree()[source]

Get the underlying DataTree object.

Returns:

The measurement set as an xarray DataTree object.

Return type:

xr.DataTree

get_dataset(obs)[source]

Get dataset from the measurement set.

Parameters:

obs (list[str] | str) -- Observation ID(s) to retrieve. Can be a single observation ID as a string, a list of observation IDs, or "all" to retrieve all available observations.

Returns:

The concatenated dataset containing the selected observations.

Return type:

xr.Dataset

Raises:

ValueError -- If the specified observation ID(s) are not found in the measurement set.