Measurement Set Tutorial

This tutorial notebook can be run on the Google Colaboratory environment via this link.

XRADIO is an open-source Python package that leverages xarray to provide an interface for radio astronomy data. It includes converters for legacy formats and defines versioned schemas for each dataset type. A schema checker is also included to verify whether a dataset conforms to the expected schema.

Data is organized into the following structures:

  • xarray.Dataset: A multi-dimensional, in-memory array container for labeled n-dimensional arrays.

  • xarray.DataArray: An n-dimensional array with labeled coordinates and dimensions.

  • xarray.DataTree: A tree-like hierarchical collection of xarray objects (datasets and children trees).

XRADIO extends the functionality of these xarray data structures by making use of xarray accessors.

To use XRADIO effectively, it’s important to understand the terminology and indexing methods used in xarray. The following documentation is recommended reading:

Acronyms Used

  • ps = processing set

  • ms = measurement set

  • cor = correlated

  • xdt = xarray DataTree

  • xds = xarray Dataset

  • xda = xarray DataArray

Using these acronyms one can refer for example to the Processing Set DataTree (ps_xdt), the Measurement Set DataTree (ms_xdt) or the correlated dataset (cor_xds).

Measurement Set v4 Schema Layout

The Measurement Set v4 (MSv4) schema for radio telescope interferometric data (Visibilities) and single-dish data (Spectrum) is implemented in memory as an `xarray.DataTree <https://docs.xarray.dev/en/latest/generated/xarray.DataTree.html>`__.

The root node of this data tree (the measurement set xarray.DataTree, ms_xdt), is the cor_xds (correlated xarray.Dataset), which contains the Visibility or Spectrum data. It also includes data that shares the same dimensions as the Visibility/Spectrum data and serves a similar role to the Main table in Measurement Set v2 (MSv2).

The child nodes of ms_xdt contain metadata such as antenna positions, field and source definitions, and other auxiliary information. Each ms_xdt is limited to a single observation, spectral window, polarization setup, observation mode, processor, and beam per antenna.

Multiple ms_xdt trees can be grouped together as children of a processing set data tree (ps_xdt). This tree has an empty root node, with each child node representing an individual ms_xdt. The design of ps_xdt is inspired by the Multi-MS format in MSv2.

Figure 1 illustrates a simplified comparison between the Processing Set structure in MSv4 and the Multi-MS structure in MSv2. Blocks with the same color indicate similar information content. Blocks in between parenthesis are optional in their respective schemas.

fig1_ps_vs_mms

Figure 1: Schema layouts of the Processing Set (collection of MSv4s) and the Multi Measurement Set (MSv2).

Access Pattern Cheat Sheet

import xarray as xr
import xradio  # Enables accessors
from xradio.measurement_set import open_processing_set

# Open a processing set data tree
ps_xdt = open_processing_set("my_ps.ps.zarr")  # or xr.open_datatree("...")

# Access an individual Measurement Set data tree of the processing set
msv4_name = "my_msv4"
ms_xdt = ps_xdt[msv4_name]

# Access the correlated dataset and antenna dataset
cor_xds = ms_xdt.ds
antenna_xds = ms_xdt.antenna_xds.ds

Available accessors:

  • ps_xdt.xr_ps (as processing set accessor)

    • summary # returns a data frame

    • get_max_dims

    • get_freq_axis

    • sel # based on summary data frame

    • get_combined_field_and_source_xds

    • plot_phase_centers

    • get_combined_antenna_xds

    • plot_antenna_positions

  • ms_xdt.xr_ms (as measurement set accesor)

    • sel # allows for data group selection

    • get_field_and_source_xds

    • get_partition_info

All these accessors will be used during the tutorial. Figure 2 gives an schematic overview of the PS and MS data trees.

fig2_ps_ms_datatree

Figure 2: overview of the PS and MS data trees

Preparation

Import XRADIO

[1]:
from importlib.metadata import version
import os

try:
    os.system("pip install --upgrade xradio")

    import xradio

    print("Using xradio version", version("xradio"))

except ImportError as exc:
    print(f"Could not import xradio: {exc}")
Requirement already satisfied: xradio in /Users/vdesouza/miniforge3/envs/xradio-dev/lib/python3.13/site-packages (1.1.3)
Requirement already satisfied: xarray in /Users/vdesouza/miniforge3/envs/xradio-dev/lib/python3.13/site-packages (from xradio) (2026.4.0)
Requirement already satisfied: numpy>=1.26 in /Users/vdesouza/miniforge3/envs/xradio-dev/lib/python3.13/site-packages (from xarray->xradio) (2.4.3)
Requirement already satisfied: packaging>=24.2 in /Users/vdesouza/miniforge3/envs/xradio-dev/lib/python3.13/site-packages (from xarray->xradio) (26.1)
Requirement already satisfied: pandas>=2.2 in /Users/vdesouza/miniforge3/envs/xradio-dev/lib/python3.13/site-packages (from xarray->xradio) (3.0.2)
Requirement already satisfied: python-dateutil>=2.8.2 in /Users/vdesouza/miniforge3/envs/xradio-dev/lib/python3.13/site-packages (from pandas>=2.2->xarray->xradio) (2.9.0.post0)
Requirement already satisfied: six>=1.5 in /Users/vdesouza/miniforge3/envs/xradio-dev/lib/python3.13/site-packages (from python-dateutil>=2.8.2->pandas>=2.2->xarray->xradio) (1.17.0)
Using xradio version 1.1.3

Download example MSv2

[2]:
import toolviper

toolviper.utils.data.download(file="Antennae_North.cal.lsrk.split.ms")
[2026-04-20 15:21:59,999]     INFO   toolviper:  Initializing download...
[2026-04-20 15:22:00,000]     INFO   toolviper:  File already exists: /Users/vdesouza/work/xradio/docs/source/measurement_set/tutorials/Antennae_North.cal.lsrk.split.ms

Processing Set

Convert MSv2 to Processing Set Xarray Data Tree (ps_xdt)

Before running the conversion function we can get an estimate of the resources that will be needed:

[3]:
from xradio.measurement_set import estimate_conversion_memory_and_cores

msv2_name = "Antennae_North.cal.lsrk.split.ms"
mem_estimate, max_reasonable_cores, suggested_cores = estimate_conversion_memory_and_cores(msv2_name)
mem_estimate, max_reasonable_cores, suggested_cores
[2026-04-20 15:22:00,281]     INFO   toolviper:  Updated partition scheme used: ['DATA_DESC_ID', 'OBS_MODE', 'OBSERVATION_ID']
[3]:
(0.010820237919688225, 4, 1)

The function used to estimate resources gives: - an estimate of memory required in GiB, - a maximum “reasonable” number of cores to use when converting in parallel, which is the number of partitions or MSv4s in the output processing set, - and a suggested number of cores to use, as a rule of thumb the maximum / 4.

If we want to run the conversion in parallel, using Dask, we can initialize a “VIPER” client. In this example we use a local Dask client with the suggested number of cores = Dask workers:

[4]:
do_parallel = True
if do_parallel:
    from toolviper import dask
    viper_client = toolviper.dask.local_client(cores=suggested_cores)
[2026-04-20 15:22:00,314]  WARNING      client:  It is recommended that the local cache directory be set using the dask_local_dir parameter.
[2026-04-20 15:22:00,856]     INFO      client:  Client <MenrvaClient: 'tcp://127.0.0.1:54170' processes=1 threads=1, memory=15.13 GiB>

Convert the example MeasurementSet v2 to Processing Set:

[5]:
from xradio.measurement_set import convert_msv2_to_processing_set
if do_parallel:
    parallel_mode = "partition"
else:
    parallel_mode = "none"

convert_out = "Antennae_North.cal.lsrk.split.ps.zarr"
convert_msv2_to_processing_set(
    in_file=msv2_name,
    out_file=convert_out,
    persistence_mode='w',
    parallel_mode=parallel_mode,
)
[2026-04-20 15:22:00,905]     INFO      client:  Updated partition scheme used: ['DATA_DESC_ID', 'OBS_MODE', 'OBSERVATION_ID']
[2026-04-20 15:22:00,906]     INFO      client:  Number of partitions: 4
[2026-04-20 15:22:00,907]     INFO      client:  OBSERVATION_ID [0], DDI [0], STATE [23, 24, 25, 30, 31, 32, 33, 34, 37], FIELD [0, 1, 2], SCAN [9, 17, 21, 25], EPHEMERIS [None]
[2026-04-20 15:22:00,907]     INFO      client:  OBSERVATION_ID [1], DDI [0], STATE [23, 24, 25, 30, 31, 32, 33, 34, 37], FIELD [0, 1, 2], SCAN [26, 34, 38, 42], EPHEMERIS [None]
[2026-04-20 15:22:00,907]     INFO      client:  OBSERVATION_ID [2], DDI [0], STATE [32, 33, 34], FIELD [0, 1, 2], SCAN [43], EPHEMERIS [None]
[2026-04-20 15:22:00,908]     INFO      client:  OBSERVATION_ID [3], DDI [0], STATE [39, 40, 41, 46, 47, 48, 49, 50, 53], FIELD [0, 1, 2], SCAN [48, 56, 60, 64], EPHEMERIS [None]

Processing Set Xarray Data Tree (ps_xdt)

A ps_xdt (Processing Set DataTree) can be lazily opened using either `xradio.measurement_set.open_processing_set <https://casangi.github.io/xradio/api/xradio.measurement_set.html#xradio.measurement_set.open_processing_set>`__ or `xarray.open_datatree <https://docs.xarray.dev/en/latest/generated/xarray.open_datatree.html>`__. When lazily opened, none of the data variables within the datasets are immediately loaded into memory. Instead, they are represented by lazy Dask arrays. The open_processing_set function provided by xradio.measurement_set exists to support future storage formats that are not natively handled by xarray. For example, telescopes such as ALMA and the VLA produce data in the ASDM (Astronomical Science Data Model) format, which may require custom loading and conversion logic. By using open_processing_set, XRADIO ensures flexibility and extensibility for supporting complex and evolving data formats beyond the scope of standard xarray I/O.

The Processing Set “Antennae_North.cal.lsrk.split.ps.zarr” consists of 12 Measurement Sets v4 (ms_xdt) which can be seen by clicking on the Groups dropdown arrow.

[6]:
from xradio.measurement_set import open_processing_set
convert_out = "Antennae_North.cal.lsrk.split.ps.zarr"

ps_xdt = open_processing_set(convert_out)
ps_xdt
[6]:
<xarray.DataTree>
Group: /
│   Attributes:
│       type:     processing_set
├── Group: /Antennae_North.cal.lsrk.split_0
│   │   Dimensions:                     (time: 50, baseline_id: 45, frequency: 8,
│   │                                    polarization: 2, uvw_label: 3)
│   │   Coordinates:
│   │     * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
│   │       field_name                  (time) <U46 9kB dask.array<chunksize=(50,), meta=np.ndarray>
│   │       scan_name                   (time) <U21 4kB dask.array<chunksize=(50,), meta=np.ndarray>
│   │     * baseline_id                 (baseline_id) int64 360B 0 1 2 3 ... 41 42 43 44
│   │       baseline_antenna1_name      (baseline_id) <U9 2kB dask.array<chunksize=(45,), meta=np.ndarray>
│   │       baseline_antenna2_name      (baseline_id) <U9 2kB dask.array<chunksize=(45,), meta=np.ndarray>
│   │     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│   │     * polarization                (polarization) <U2 16B 'XX' 'YY'
│   │     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   │   Data variables:
│   │       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 18kB dask.array<chunksize=(50, 45), meta=np.ndarray>
│   │       FLAG                        (time, baseline_id, frequency, polarization) bool 36kB dask.array<chunksize=(50, 45, 8, 2), meta=np.ndarray>
│   │       TIME_CENTROID               (time, baseline_id) float64 18kB dask.array<chunksize=(50, 45), meta=np.ndarray>
│   │       UVW                         (time, baseline_id, uvw_label) float64 54kB dask.array<chunksize=(50, 45, 3), meta=np.ndarray>
│   │       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 288kB dask.array<chunksize=(50, 45, 8, 2), meta=np.ndarray>
│   │       WEIGHT                      (time, baseline_id, frequency, polarization) float32 144kB dask.array<chunksize=(50, 45, 8, 2), meta=np.ndarray>
│   │   Attributes:
│   │       creation_date:     2026-04-20T21:22:01.520254+00:00
│   │       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│   │       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│   │       observation_info:  {'execution_block_UID': 'uid://A002/X1ff7b0/Xb', 'obse...
│   │       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│   │       schema_version:    4.0.0
│   │       type:              visibility
│   ├── Group: /Antennae_North.cal.lsrk.split_0/antenna_xds
│   │       Dimensions:                 (antenna_name: 10, cartesian_pos_label: 3,
│   │                                    receptor_label: 2)
│   │       Coordinates:
│   │         * antenna_name            (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
│   │           mount                   (antenna_name) <U6 240B dask.array<chunksize=(10,), meta=np.ndarray>
│   │           station_name            (antenna_name) <U4 160B dask.array<chunksize=(10,), meta=np.ndarray>
│   │           telescope_name          (antenna_name) <U4 160B dask.array<chunksize=(10,), meta=np.ndarray>
│   │         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│   │         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│   │           polarization_type       (antenna_name, receptor_label) <U1 80B dask.array<chunksize=(10, 2), meta=np.ndarray>
│   │       Data variables:
│   │           ANTENNA_DISH_DIAMETER   (antenna_name) float64 80B dask.array<chunksize=(10,), meta=np.ndarray>
│   │           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 240B dask.array<chunksize=(10, 3), meta=np.ndarray>
│   │           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 160B dask.array<chunksize=(10, 2), meta=np.ndarray>
│   │       Attributes:
│   │           overall_telescope_name:  ALMA
│   │           relocatable_antennas:    True
│   │           type:                    antenna
│   ├── Group: /Antennae_North.cal.lsrk.split_0/field_and_source_base_xds
│   │       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│   │       Coordinates:
│   │         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│   │           source_name                   (field_name) <U46 552B dask.array<chunksize=(3,), meta=np.ndarray>
│   │         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│   │       Data variables:
│   │           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>
│   │           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>
│   │       Attributes:
│   │           type:     field_and_source
│   └── Group: /Antennae_North.cal.lsrk.split_0/weather_xds
│           Dimensions:              (station_name: 2, time_weather: 259,
│                                     cartesian_pos_label: 3)
│           Coordinates:
│             * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
│             * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
│             * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│           Data variables:
│               DEW_POINT            (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               PRESSURE             (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               REL_HUMIDITY         (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               STATION_POSITION     (station_name, cartesian_pos_label) float64 48B dask.array<chunksize=(2, 3), meta=np.ndarray>
│               TEMPERATURE          (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               WIND_DIRECTION       (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               WIND_SPEED           (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│           Attributes:
│               type:     weather
├── Group: /Antennae_North.cal.lsrk.split_1
│   │   Dimensions:                     (time: 50, baseline_id: 55, frequency: 8,
│   │                                    polarization: 2, uvw_label: 3)
│   │   Coordinates:
│   │     * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
│   │       field_name                  (time) <U46 9kB dask.array<chunksize=(50,), meta=np.ndarray>
│   │       scan_name                   (time) <U21 4kB dask.array<chunksize=(50,), meta=np.ndarray>
│   │     * baseline_id                 (baseline_id) int64 440B 0 1 2 3 ... 51 52 53 54
│   │       baseline_antenna1_name      (baseline_id) <U9 2kB dask.array<chunksize=(55,), meta=np.ndarray>
│   │       baseline_antenna2_name      (baseline_id) <U9 2kB dask.array<chunksize=(55,), meta=np.ndarray>
│   │     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│   │     * polarization                (polarization) <U2 16B 'XX' 'YY'
│   │     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   │   Data variables:
│   │       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 22kB dask.array<chunksize=(50, 55), meta=np.ndarray>
│   │       FLAG                        (time, baseline_id, frequency, polarization) bool 44kB dask.array<chunksize=(50, 55, 8, 2), meta=np.ndarray>
│   │       TIME_CENTROID               (time, baseline_id) float64 22kB dask.array<chunksize=(50, 55), meta=np.ndarray>
│   │       UVW                         (time, baseline_id, uvw_label) float64 66kB dask.array<chunksize=(50, 55, 3), meta=np.ndarray>
│   │       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 352kB dask.array<chunksize=(50, 55, 8, 2), meta=np.ndarray>
│   │       WEIGHT                      (time, baseline_id, frequency, polarization) float32 176kB dask.array<chunksize=(50, 55, 8, 2), meta=np.ndarray>
│   │   Attributes:
│   │       creation_date:     2026-04-20T21:22:01.416058+00:00
│   │       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│   │       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│   │       observation_info:  {'execution_block_UID': 'uid://A002/X207fe4/X3a', 'obs...
│   │       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│   │       schema_version:    4.0.0
│   │       type:              visibility
│   ├── Group: /Antennae_North.cal.lsrk.split_1/antenna_xds
│   │       Dimensions:                 (antenna_name: 11, cartesian_pos_label: 3,
│   │                                    receptor_label: 2)
│   │       Coordinates:
│   │         * antenna_name            (antenna_name) <U9 396B 'DV02_A015' ... 'DV05_A067'
│   │           mount                   (antenna_name) <U6 264B dask.array<chunksize=(11,), meta=np.ndarray>
│   │           station_name            (antenna_name) <U4 176B dask.array<chunksize=(11,), meta=np.ndarray>
│   │           telescope_name          (antenna_name) <U4 176B dask.array<chunksize=(11,), meta=np.ndarray>
│   │         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│   │         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│   │           polarization_type       (antenna_name, receptor_label) <U1 88B dask.array<chunksize=(11, 2), meta=np.ndarray>
│   │       Data variables:
│   │           ANTENNA_DISH_DIAMETER   (antenna_name) float64 88B dask.array<chunksize=(11,), meta=np.ndarray>
│   │           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 264B dask.array<chunksize=(11, 3), meta=np.ndarray>
│   │           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 176B dask.array<chunksize=(11, 2), meta=np.ndarray>
│   │       Attributes:
│   │           overall_telescope_name:  ALMA
│   │           relocatable_antennas:    True
│   │           type:                    antenna
│   ├── Group: /Antennae_North.cal.lsrk.split_1/field_and_source_base_xds
│   │       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│   │       Coordinates:
│   │         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│   │           source_name                   (field_name) <U46 552B dask.array<chunksize=(3,), meta=np.ndarray>
│   │         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│   │       Data variables:
│   │           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>
│   │           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>
│   │       Attributes:
│   │           type:     field_and_source
│   └── Group: /Antennae_North.cal.lsrk.split_1/weather_xds
│           Dimensions:              (station_name: 2, time_weather: 259,
│                                     cartesian_pos_label: 3)
│           Coordinates:
│             * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
│             * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
│             * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│           Data variables:
│               DEW_POINT            (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               PRESSURE             (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               REL_HUMIDITY         (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               STATION_POSITION     (station_name, cartesian_pos_label) float64 48B dask.array<chunksize=(2, 3), meta=np.ndarray>
│               TEMPERATURE          (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               WIND_DIRECTION       (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               WIND_SPEED           (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│           Attributes:
│               type:     weather
├── Group: /Antennae_North.cal.lsrk.split_2
│   │   Dimensions:                     (time: 15, baseline_id: 55, frequency: 8,
│   │                                    polarization: 2, uvw_label: 3)
│   │   Coordinates:
│   │     * time                        (time) float64 120B 1.307e+09 ... 1.307e+09
│   │       field_name                  (time) <U46 3kB dask.array<chunksize=(15,), meta=np.ndarray>
│   │       scan_name                   (time) <U21 1kB dask.array<chunksize=(15,), meta=np.ndarray>
│   │     * baseline_id                 (baseline_id) int64 440B 0 1 2 3 ... 51 52 53 54
│   │       baseline_antenna1_name      (baseline_id) <U9 2kB dask.array<chunksize=(55,), meta=np.ndarray>
│   │       baseline_antenna2_name      (baseline_id) <U9 2kB dask.array<chunksize=(55,), meta=np.ndarray>
│   │     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│   │     * polarization                (polarization) <U2 16B 'XX' 'YY'
│   │     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   │   Data variables:
│   │       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 7kB dask.array<chunksize=(15, 55), meta=np.ndarray>
│   │       FLAG                        (time, baseline_id, frequency, polarization) bool 13kB dask.array<chunksize=(15, 55, 8, 2), meta=np.ndarray>
│   │       TIME_CENTROID               (time, baseline_id) float64 7kB dask.array<chunksize=(15, 55), meta=np.ndarray>
│   │       UVW                         (time, baseline_id, uvw_label) float64 20kB dask.array<chunksize=(15, 55, 3), meta=np.ndarray>
│   │       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 106kB dask.array<chunksize=(15, 55, 8, 2), meta=np.ndarray>
│   │       WEIGHT                      (time, baseline_id, frequency, polarization) float32 53kB dask.array<chunksize=(15, 55, 8, 2), meta=np.ndarray>
│   │   Attributes:
│   │       creation_date:     2026-04-20T21:22:01.188518+00:00
│   │       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│   │       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│   │       observation_info:  {'execution_block_UID': 'uid://A002/X207fe4/X3b9', 'ob...
│   │       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│   │       schema_version:    4.0.0
│   │       type:              visibility
│   ├── Group: /Antennae_North.cal.lsrk.split_2/antenna_xds
│   │       Dimensions:                 (antenna_name: 11, cartesian_pos_label: 3,
│   │                                    receptor_label: 2)
│   │       Coordinates:
│   │         * antenna_name            (antenna_name) <U9 396B 'DV02_A015' ... 'DV05_A067'
│   │           mount                   (antenna_name) <U6 264B dask.array<chunksize=(11,), meta=np.ndarray>
│   │           station_name            (antenna_name) <U4 176B dask.array<chunksize=(11,), meta=np.ndarray>
│   │           telescope_name          (antenna_name) <U4 176B dask.array<chunksize=(11,), meta=np.ndarray>
│   │         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│   │         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│   │           polarization_type       (antenna_name, receptor_label) <U1 88B dask.array<chunksize=(11, 2), meta=np.ndarray>
│   │       Data variables:
│   │           ANTENNA_DISH_DIAMETER   (antenna_name) float64 88B dask.array<chunksize=(11,), meta=np.ndarray>
│   │           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 264B dask.array<chunksize=(11, 3), meta=np.ndarray>
│   │           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 176B dask.array<chunksize=(11, 2), meta=np.ndarray>
│   │       Attributes:
│   │           overall_telescope_name:  ALMA
│   │           relocatable_antennas:    True
│   │           type:                    antenna
│   ├── Group: /Antennae_North.cal.lsrk.split_2/field_and_source_base_xds
│   │       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│   │       Coordinates:
│   │         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│   │           source_name                   (field_name) <U46 552B dask.array<chunksize=(3,), meta=np.ndarray>
│   │         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│   │       Data variables:
│   │           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>
│   │           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>
│   │       Attributes:
│   │           type:     field_and_source
│   └── Group: /Antennae_North.cal.lsrk.split_2/weather_xds
│           Dimensions:              (station_name: 2, time_weather: 259,
│                                     cartesian_pos_label: 3)
│           Coordinates:
│             * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
│             * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
│             * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│           Data variables:
│               DEW_POINT            (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               PRESSURE             (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               REL_HUMIDITY         (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               STATION_POSITION     (station_name, cartesian_pos_label) float64 48B dask.array<chunksize=(2, 3), meta=np.ndarray>
│               TEMPERATURE          (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               WIND_DIRECTION       (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│               WIND_SPEED           (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
│           Attributes:
│               type:     weather
└── Group: /Antennae_North.cal.lsrk.split_3
    │   Dimensions:                     (time: 50, baseline_id: 77, frequency: 8,
    │                                    polarization: 2, uvw_label: 3)
    │   Coordinates:
    │     * time                        (time) float64 400B 1.308e+09 ... 1.308e+09
    │       field_name                  (time) <U46 9kB dask.array<chunksize=(50,), meta=np.ndarray>
    │       scan_name                   (time) <U21 4kB dask.array<chunksize=(50,), meta=np.ndarray>
    │     * baseline_id                 (baseline_id) int64 616B 0 1 2 3 ... 73 74 75 76
    │       baseline_antenna1_name      (baseline_id) <U9 3kB dask.array<chunksize=(77,), meta=np.ndarray>
    │       baseline_antenna2_name      (baseline_id) <U9 3kB dask.array<chunksize=(77,), meta=np.ndarray>
    │     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
    │     * polarization                (polarization) <U2 16B 'XX' 'YY'
    │     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
    │   Data variables:
    │       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 31kB dask.array<chunksize=(50, 77), meta=np.ndarray>
    │       FLAG                        (time, baseline_id, frequency, polarization) bool 62kB dask.array<chunksize=(50, 77, 8, 2), meta=np.ndarray>
    │       TIME_CENTROID               (time, baseline_id) float64 31kB dask.array<chunksize=(50, 77), meta=np.ndarray>
    │       UVW                         (time, baseline_id, uvw_label) float64 92kB dask.array<chunksize=(50, 77, 3), meta=np.ndarray>
    │       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 493kB dask.array<chunksize=(50, 77, 8, 2), meta=np.ndarray>
    │       WEIGHT                      (time, baseline_id, frequency, polarization) float32 246kB dask.array<chunksize=(50, 77, 8, 2), meta=np.ndarray>
    │   Attributes:
    │       creation_date:     2026-04-20T21:22:01.307587+00:00
    │       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
    │       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
    │       observation_info:  {'execution_block_UID': 'uid://A002/X2181fb/X49', 'obs...
    │       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
    │       schema_version:    4.0.0
    │       type:              visibility
    ├── Group: /Antennae_North.cal.lsrk.split_3/antenna_xds
    │       Dimensions:                 (antenna_name: 13, cartesian_pos_label: 3,
    │                                    receptor_label: 2)
    │       Coordinates:
    │         * antenna_name            (antenna_name) <U9 468B 'DV02_A015' ... 'DV13_A075'
    │           mount                   (antenna_name) <U6 312B dask.array<chunksize=(13,), meta=np.ndarray>
    │           station_name            (antenna_name) <U4 208B dask.array<chunksize=(13,), meta=np.ndarray>
    │           telescope_name          (antenna_name) <U4 208B dask.array<chunksize=(13,), meta=np.ndarray>
    │         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
    │         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
    │           polarization_type       (antenna_name, receptor_label) <U1 104B dask.array<chunksize=(13, 2), meta=np.ndarray>
    │       Data variables:
    │           ANTENNA_DISH_DIAMETER   (antenna_name) float64 104B dask.array<chunksize=(13,), meta=np.ndarray>
    │           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 312B dask.array<chunksize=(13, 3), meta=np.ndarray>
    │           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 208B dask.array<chunksize=(13, 2), meta=np.ndarray>
    │       Attributes:
    │           overall_telescope_name:  ALMA
    │           relocatable_antennas:    True
    │           type:                    antenna
    ├── Group: /Antennae_North.cal.lsrk.split_3/field_and_source_base_xds
    │       Dimensions:                       (field_name: 3, sky_dir_label: 2)
    │       Coordinates:
    │         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
    │           source_name                   (field_name) <U46 552B dask.array<chunksize=(3,), meta=np.ndarray>
    │         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
    │       Data variables:
    │           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>
    │           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B dask.array<chunksize=(3, 2), meta=np.ndarray>
    │       Attributes:
    │           type:     field_and_source
    └── Group: /Antennae_North.cal.lsrk.split_3/weather_xds
            Dimensions:              (station_name: 2, time_weather: 259,
                                      cartesian_pos_label: 3)
            Coordinates:
              * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
              * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
              * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
            Data variables:
                DEW_POINT            (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
                PRESSURE             (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
                REL_HUMIDITY         (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
                STATION_POSITION     (station_name, cartesian_pos_label) float64 48B dask.array<chunksize=(2, 3), meta=np.ndarray>
                TEMPERATURE          (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
                WIND_DIRECTION       (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
                WIND_SPEED           (station_name, time_weather) float64 4kB dask.array<chunksize=(2, 259), meta=np.ndarray>
            Attributes:
                type:     weather
[7]:
import xarray

ps_xdt = xarray.open_datatree(convert_out, engine="zarr")
ps_xdt
[7]:
<xarray.DataTree>
Group: /
│   Attributes:
│       type:     processing_set
├── Group: /Antennae_North.cal.lsrk.split_0
│   │   Dimensions:                     (time: 50, baseline_id: 45, frequency: 8,
│   │                                    polarization: 2, uvw_label: 3)
│   │   Coordinates:
│   │     * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
│   │       field_name                  (time) <U46 9kB ...
│   │       scan_name                   (time) <U21 4kB ...
│   │     * baseline_id                 (baseline_id) int64 360B 0 1 2 3 ... 41 42 43 44
│   │       baseline_antenna1_name      (baseline_id) <U9 2kB ...
│   │       baseline_antenna2_name      (baseline_id) <U9 2kB ...
│   │     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│   │     * polarization                (polarization) <U2 16B 'XX' 'YY'
│   │     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   │   Data variables:
│   │       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 18kB ...
│   │       FLAG                        (time, baseline_id, frequency, polarization) bool 36kB ...
│   │       TIME_CENTROID               (time, baseline_id) float64 18kB ...
│   │       UVW                         (time, baseline_id, uvw_label) float64 54kB ...
│   │       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 288kB ...
│   │       WEIGHT                      (time, baseline_id, frequency, polarization) float32 144kB ...
│   │   Attributes:
│   │       creation_date:     2026-04-20T21:22:01.520254+00:00
│   │       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│   │       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│   │       observation_info:  {'execution_block_UID': 'uid://A002/X1ff7b0/Xb', 'obse...
│   │       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│   │       schema_version:    4.0.0
│   │       type:              visibility
│   ├── Group: /Antennae_North.cal.lsrk.split_0/antenna_xds
│   │       Dimensions:                 (antenna_name: 10, cartesian_pos_label: 3,
│   │                                    receptor_label: 2)
│   │       Coordinates:
│   │         * antenna_name            (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
│   │           mount                   (antenna_name) <U6 240B ...
│   │           station_name            (antenna_name) <U4 160B ...
│   │           telescope_name          (antenna_name) <U4 160B ...
│   │         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│   │         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│   │           polarization_type       (antenna_name, receptor_label) <U1 80B ...
│   │       Data variables:
│   │           ANTENNA_DISH_DIAMETER   (antenna_name) float64 80B ...
│   │           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 240B ...
│   │           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 160B ...
│   │       Attributes:
│   │           overall_telescope_name:  ALMA
│   │           relocatable_antennas:    True
│   │           type:                    antenna
│   ├── Group: /Antennae_North.cal.lsrk.split_0/field_and_source_base_xds
│   │       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│   │       Coordinates:
│   │         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│   │           source_name                   (field_name) <U46 552B ...
│   │         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│   │       Data variables:
│   │           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B ...
│   │           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B ...
│   │       Attributes:
│   │           type:     field_and_source
│   └── Group: /Antennae_North.cal.lsrk.split_0/weather_xds
│           Dimensions:              (station_name: 2, time_weather: 259,
│                                     cartesian_pos_label: 3)
│           Coordinates:
│             * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
│             * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
│             * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│           Data variables:
│               DEW_POINT            (station_name, time_weather) float64 4kB ...
│               PRESSURE             (station_name, time_weather) float64 4kB ...
│               REL_HUMIDITY         (station_name, time_weather) float64 4kB ...
│               STATION_POSITION     (station_name, cartesian_pos_label) float64 48B ...
│               TEMPERATURE          (station_name, time_weather) float64 4kB ...
│               WIND_DIRECTION       (station_name, time_weather) float64 4kB ...
│               WIND_SPEED           (station_name, time_weather) float64 4kB ...
│           Attributes:
│               type:     weather
├── Group: /Antennae_North.cal.lsrk.split_1
│   │   Dimensions:                     (time: 50, baseline_id: 55, frequency: 8,
│   │                                    polarization: 2, uvw_label: 3)
│   │   Coordinates:
│   │     * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
│   │       field_name                  (time) <U46 9kB ...
│   │       scan_name                   (time) <U21 4kB ...
│   │     * baseline_id                 (baseline_id) int64 440B 0 1 2 3 ... 51 52 53 54
│   │       baseline_antenna1_name      (baseline_id) <U9 2kB ...
│   │       baseline_antenna2_name      (baseline_id) <U9 2kB ...
│   │     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│   │     * polarization                (polarization) <U2 16B 'XX' 'YY'
│   │     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   │   Data variables:
│   │       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 22kB ...
│   │       FLAG                        (time, baseline_id, frequency, polarization) bool 44kB ...
│   │       TIME_CENTROID               (time, baseline_id) float64 22kB ...
│   │       UVW                         (time, baseline_id, uvw_label) float64 66kB ...
│   │       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 352kB ...
│   │       WEIGHT                      (time, baseline_id, frequency, polarization) float32 176kB ...
│   │   Attributes:
│   │       creation_date:     2026-04-20T21:22:01.416058+00:00
│   │       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│   │       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│   │       observation_info:  {'execution_block_UID': 'uid://A002/X207fe4/X3a', 'obs...
│   │       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│   │       schema_version:    4.0.0
│   │       type:              visibility
│   ├── Group: /Antennae_North.cal.lsrk.split_1/antenna_xds
│   │       Dimensions:                 (antenna_name: 11, cartesian_pos_label: 3,
│   │                                    receptor_label: 2)
│   │       Coordinates:
│   │         * antenna_name            (antenna_name) <U9 396B 'DV02_A015' ... 'DV05_A067'
│   │           mount                   (antenna_name) <U6 264B ...
│   │           station_name            (antenna_name) <U4 176B ...
│   │           telescope_name          (antenna_name) <U4 176B ...
│   │         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│   │         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│   │           polarization_type       (antenna_name, receptor_label) <U1 88B ...
│   │       Data variables:
│   │           ANTENNA_DISH_DIAMETER   (antenna_name) float64 88B ...
│   │           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 264B ...
│   │           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 176B ...
│   │       Attributes:
│   │           overall_telescope_name:  ALMA
│   │           relocatable_antennas:    True
│   │           type:                    antenna
│   ├── Group: /Antennae_North.cal.lsrk.split_1/field_and_source_base_xds
│   │       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│   │       Coordinates:
│   │         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│   │           source_name                   (field_name) <U46 552B ...
│   │         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│   │       Data variables:
│   │           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B ...
│   │           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B ...
│   │       Attributes:
│   │           type:     field_and_source
│   └── Group: /Antennae_North.cal.lsrk.split_1/weather_xds
│           Dimensions:              (station_name: 2, time_weather: 259,
│                                     cartesian_pos_label: 3)
│           Coordinates:
│             * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
│             * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
│             * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│           Data variables:
│               DEW_POINT            (station_name, time_weather) float64 4kB ...
│               PRESSURE             (station_name, time_weather) float64 4kB ...
│               REL_HUMIDITY         (station_name, time_weather) float64 4kB ...
│               STATION_POSITION     (station_name, cartesian_pos_label) float64 48B ...
│               TEMPERATURE          (station_name, time_weather) float64 4kB ...
│               WIND_DIRECTION       (station_name, time_weather) float64 4kB ...
│               WIND_SPEED           (station_name, time_weather) float64 4kB ...
│           Attributes:
│               type:     weather
├── Group: /Antennae_North.cal.lsrk.split_2
│   │   Dimensions:                     (time: 15, baseline_id: 55, frequency: 8,
│   │                                    polarization: 2, uvw_label: 3)
│   │   Coordinates:
│   │     * time                        (time) float64 120B 1.307e+09 ... 1.307e+09
│   │       field_name                  (time) <U46 3kB ...
│   │       scan_name                   (time) <U21 1kB ...
│   │     * baseline_id                 (baseline_id) int64 440B 0 1 2 3 ... 51 52 53 54
│   │       baseline_antenna1_name      (baseline_id) <U9 2kB ...
│   │       baseline_antenna2_name      (baseline_id) <U9 2kB ...
│   │     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│   │     * polarization                (polarization) <U2 16B 'XX' 'YY'
│   │     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   │   Data variables:
│   │       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 7kB ...
│   │       FLAG                        (time, baseline_id, frequency, polarization) bool 13kB ...
│   │       TIME_CENTROID               (time, baseline_id) float64 7kB ...
│   │       UVW                         (time, baseline_id, uvw_label) float64 20kB ...
│   │       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 106kB ...
│   │       WEIGHT                      (time, baseline_id, frequency, polarization) float32 53kB ...
│   │   Attributes:
│   │       creation_date:     2026-04-20T21:22:01.188518+00:00
│   │       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│   │       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│   │       observation_info:  {'execution_block_UID': 'uid://A002/X207fe4/X3b9', 'ob...
│   │       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│   │       schema_version:    4.0.0
│   │       type:              visibility
│   ├── Group: /Antennae_North.cal.lsrk.split_2/antenna_xds
│   │       Dimensions:                 (antenna_name: 11, cartesian_pos_label: 3,
│   │                                    receptor_label: 2)
│   │       Coordinates:
│   │         * antenna_name            (antenna_name) <U9 396B 'DV02_A015' ... 'DV05_A067'
│   │           mount                   (antenna_name) <U6 264B ...
│   │           station_name            (antenna_name) <U4 176B ...
│   │           telescope_name          (antenna_name) <U4 176B ...
│   │         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│   │         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│   │           polarization_type       (antenna_name, receptor_label) <U1 88B ...
│   │       Data variables:
│   │           ANTENNA_DISH_DIAMETER   (antenna_name) float64 88B ...
│   │           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 264B ...
│   │           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 176B ...
│   │       Attributes:
│   │           overall_telescope_name:  ALMA
│   │           relocatable_antennas:    True
│   │           type:                    antenna
│   ├── Group: /Antennae_North.cal.lsrk.split_2/field_and_source_base_xds
│   │       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│   │       Coordinates:
│   │         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│   │           source_name                   (field_name) <U46 552B ...
│   │         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│   │       Data variables:
│   │           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B ...
│   │           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B ...
│   │       Attributes:
│   │           type:     field_and_source
│   └── Group: /Antennae_North.cal.lsrk.split_2/weather_xds
│           Dimensions:              (station_name: 2, time_weather: 259,
│                                     cartesian_pos_label: 3)
│           Coordinates:
│             * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
│             * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
│             * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│           Data variables:
│               DEW_POINT            (station_name, time_weather) float64 4kB ...
│               PRESSURE             (station_name, time_weather) float64 4kB ...
│               REL_HUMIDITY         (station_name, time_weather) float64 4kB ...
│               STATION_POSITION     (station_name, cartesian_pos_label) float64 48B ...
│               TEMPERATURE          (station_name, time_weather) float64 4kB ...
│               WIND_DIRECTION       (station_name, time_weather) float64 4kB ...
│               WIND_SPEED           (station_name, time_weather) float64 4kB ...
│           Attributes:
│               type:     weather
└── Group: /Antennae_North.cal.lsrk.split_3
    │   Dimensions:                     (time: 50, baseline_id: 77, frequency: 8,
    │                                    polarization: 2, uvw_label: 3)
    │   Coordinates:
    │     * time                        (time) float64 400B 1.308e+09 ... 1.308e+09
    │       field_name                  (time) <U46 9kB ...
    │       scan_name                   (time) <U21 4kB ...
    │     * baseline_id                 (baseline_id) int64 616B 0 1 2 3 ... 73 74 75 76
    │       baseline_antenna1_name      (baseline_id) <U9 3kB ...
    │       baseline_antenna2_name      (baseline_id) <U9 3kB ...
    │     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
    │     * polarization                (polarization) <U2 16B 'XX' 'YY'
    │     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
    │   Data variables:
    │       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 31kB ...
    │       FLAG                        (time, baseline_id, frequency, polarization) bool 62kB ...
    │       TIME_CENTROID               (time, baseline_id) float64 31kB ...
    │       UVW                         (time, baseline_id, uvw_label) float64 92kB ...
    │       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 493kB ...
    │       WEIGHT                      (time, baseline_id, frequency, polarization) float32 246kB ...
    │   Attributes:
    │       creation_date:     2026-04-20T21:22:01.307587+00:00
    │       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
    │       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
    │       observation_info:  {'execution_block_UID': 'uid://A002/X2181fb/X49', 'obs...
    │       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
    │       schema_version:    4.0.0
    │       type:              visibility
    ├── Group: /Antennae_North.cal.lsrk.split_3/antenna_xds
    │       Dimensions:                 (antenna_name: 13, cartesian_pos_label: 3,
    │                                    receptor_label: 2)
    │       Coordinates:
    │         * antenna_name            (antenna_name) <U9 468B 'DV02_A015' ... 'DV13_A075'
    │           mount                   (antenna_name) <U6 312B ...
    │           station_name            (antenna_name) <U4 208B ...
    │           telescope_name          (antenna_name) <U4 208B ...
    │         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
    │         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
    │           polarization_type       (antenna_name, receptor_label) <U1 104B ...
    │       Data variables:
    │           ANTENNA_DISH_DIAMETER   (antenna_name) float64 104B ...
    │           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 312B ...
    │           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 208B ...
    │       Attributes:
    │           overall_telescope_name:  ALMA
    │           relocatable_antennas:    True
    │           type:                    antenna
    ├── Group: /Antennae_North.cal.lsrk.split_3/field_and_source_base_xds
    │       Dimensions:                       (field_name: 3, sky_dir_label: 2)
    │       Coordinates:
    │         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
    │           source_name                   (field_name) <U46 552B ...
    │         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
    │       Data variables:
    │           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B ...
    │           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B ...
    │       Attributes:
    │           type:     field_and_source
    └── Group: /Antennae_North.cal.lsrk.split_3/weather_xds
            Dimensions:              (station_name: 2, time_weather: 259,
                                      cartesian_pos_label: 3)
            Coordinates:
              * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
              * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
              * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
            Data variables:
                DEW_POINT            (station_name, time_weather) float64 4kB ...
                PRESSURE             (station_name, time_weather) float64 4kB ...
                REL_HUMIDITY         (station_name, time_weather) float64 4kB ...
                STATION_POSITION     (station_name, cartesian_pos_label) float64 48B ...
                TEMPERATURE          (station_name, time_weather) float64 4kB ...
                WIND_DIRECTION       (station_name, time_weather) float64 4kB ...
                WIND_SPEED           (station_name, time_weather) float64 4kB ...
            Attributes:
                type:     weather

Processing Set Xarray Data Tree (ps_xdt) Accessors

  • ps_xdt.xr_ps.

    • summary # returns a data frame

    • get_max_dims

    • get_freq_axis

    • query # based on summary data frame

    • get_combined_field_and_source_xds

    • plot_phase_centers

    • get_combined_antenna_xds

    • plot_antenna_positions

    • Additional Accessors can be requested using a GitHub Issue

Note: All accessors used in this tutorial are only available if import xradio has been called. This ensures the XRADIO-specific accessor methods are properly registered with xarray.

For a convenient summary of the ms_xdts within a ps_xdt, the .summary() function from the xr_ps accessor can be used.

[8]:
ps_xdt.xr_ps.summary()
[8]:
name scan_intents shape execution_block_UID polarization scan_name spw_name spw_intents field_name source_name line_name field_coords session_reference_UID scheduling_block_UID project_UID start_frequency end_frequency
0 Antennae_North.cal.lsrk.split_0 [OBSERVE_TARGET#ON_SOURCE] (50, 45, 8, 2) uid://A002/X1ff7b0/Xb [XX, YY] [17, 21, 25, 9] spw_0 [UNSPECIFIED] [NGC4038 - Antennae North_0, NGC4038 - Antenna... [NGC4038 - Antennae North_0] [] Multi-Phase-Center --- uid://A002/X1fd4e7/X64d T.B.D. 3.439281e+11 3.440067e+11
1 Antennae_North.cal.lsrk.split_1 [OBSERVE_TARGET#ON_SOURCE] (50, 55, 8, 2) uid://A002/X207fe4/X3a [XX, YY] [26, 34, 38, 42] spw_0 [UNSPECIFIED] [NGC4038 - Antennae North_0, NGC4038 - Antenna... [NGC4038 - Antennae North_0] [] Multi-Phase-Center --- uid://A002/X1fd4e7/X64d T.B.D. 3.439281e+11 3.440067e+11
2 Antennae_North.cal.lsrk.split_2 [OBSERVE_TARGET#ON_SOURCE] (15, 55, 8, 2) uid://A002/X207fe4/X3b9 [XX, YY] [43] spw_0 [UNSPECIFIED] [NGC4038 - Antennae North_0, NGC4038 - Antenna... [NGC4038 - Antennae North_0] [] Multi-Phase-Center --- uid://A002/X1fd4e7/X64d T.B.D. 3.439281e+11 3.440067e+11
3 Antennae_North.cal.lsrk.split_3 [OBSERVE_TARGET#ON_SOURCE, CALIBRATE_WVR#ON_SO... (50, 77, 8, 2) uid://A002/X2181fb/X49 [XX, YY] [48, 56, 60, 64] spw_0 [UNSPECIFIED] [NGC4038 - Antennae North_0, NGC4038 - Antenna... [NGC4038 - Antennae North_0] [] Multi-Phase-Center --- uid://A002/X1fd4e7/X64d T.B.D. 3.439281e+11 3.440067e+11
[9]:
ps_xdt.xr_ps.get_max_dims()
[9]:
{'time': 50,
 'baseline_id': 77,
 'frequency': 8,
 'polarization': 2,
 'uvw_label': 3}
[10]:
ps_xdt.xr_ps.get_freq_axis()
[10]:
<xarray.DataArray 'frequency' (frequency: 8)> Size: 64B
array([3.439281e+11, 3.439393e+11, 3.439506e+11, 3.439618e+11, 3.439730e+11,
       3.439843e+11, 3.439955e+11, 3.440067e+11])
Coordinates:
  * frequency  (frequency) float64 64B 3.439e+11 3.439e+11 ... 3.44e+11 3.44e+11
Attributes:
    channel_width:            {'attrs': {'type': 'quantity', 'units': 'Hz'}, ...
    observer:                 lsrk
    reference_frequency:      {'attrs': {'observer': 'lsrk', 'type': 'spectra...
    spectral_window_intents:  ['UNSPECIFIED']
    spectral_window_name:     spw_0
    type:                     spectral_coord
    units:                    Hz
[11]:
sub_ps_xdt = ps_xdt.xr_ps.query(
    field_name=["NGC4038 - Antennae North_0", "NGC4038 - Antennae North_1"],
    scan_name = ["17"]
)
sub_ps_xdt.xr_ps.summary()

[11]:
name scan_intents shape execution_block_UID polarization scan_name spw_name spw_intents field_name source_name line_name field_coords session_reference_UID scheduling_block_UID project_UID start_frequency end_frequency
0 Antennae_North.cal.lsrk.split_0 [OBSERVE_TARGET#ON_SOURCE] (50, 45, 8, 2) uid://A002/X1ff7b0/Xb [XX, YY] [17, 21, 25, 9] spw_0 [UNSPECIFIED] [NGC4038 - Antennae North_0, NGC4038 - Antenna... [NGC4038 - Antennae North_0] [] Multi-Phase-Center --- uid://A002/X1fd4e7/X64d T.B.D. 3.439281e+11 3.440067e+11
[12]:
ps_xdt.xr_ps.query().xr_ps.get_combined_field_and_source_xds()
[12]:
<xarray.Dataset> Size: 3kB
Dimensions:                       (field_name: 3, sky_dir_label: 2,
                                   baseline_id: 77, frequency: 8,
                                   polarization: 2, time: 165, uvw_label: 3)
Coordinates:
  * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
    source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
  * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
  * baseline_id                   (baseline_id) int64 616B 0 1 2 3 ... 74 75 76
  * frequency                     (frequency) float64 64B 3.439e+11 ... 3.44e+11
  * polarization                  (polarization) <U2 16B 'XX' 'YY'
  * time                          (time) float64 1kB 1.307e+09 ... 1.308e+09
  * uvw_label                     (uvw_label) <U1 12B 'u' 'v' 'w'
Data variables:
    FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B 3.1...
    SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B 3.1...
    MEAN_PHASE_CENTER_DIRECTION   (sky_dir_label) float64 16B 3.15 -0.3293
Attributes:
    type:               field_and_source
    center_field_name:  NGC4038 - Antennae North_1
[13]:
ps_xdt.xr_ps.query(scan_intents="OBSERVE_TARGET#ON_SOURCE").xr_ps.get_combined_field_and_source_xds()
[13]:
<xarray.Dataset> Size: 3kB
Dimensions:                       (field_name: 3, sky_dir_label: 2,
                                   baseline_id: 77, frequency: 8,
                                   polarization: 2, time: 165, uvw_label: 3)
Coordinates:
  * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
    source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
  * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
  * baseline_id                   (baseline_id) int64 616B 0 1 2 3 ... 74 75 76
  * frequency                     (frequency) float64 64B 3.439e+11 ... 3.44e+11
  * polarization                  (polarization) <U2 16B 'XX' 'YY'
  * time                          (time) float64 1kB 1.307e+09 ... 1.308e+09
  * uvw_label                     (uvw_label) <U1 12B 'u' 'v' 'w'
Data variables:
    FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B 3.1...
    SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B 3.1...
    MEAN_PHASE_CENTER_DIRECTION   (sky_dir_label) float64 16B 3.15 -0.3293
Attributes:
    type:               field_and_source
    center_field_name:  NGC4038 - Antennae North_1
[14]:
ps_xdt.xr_ps.query(scan_intents="OBSERVE_TARGET#ON_SOURCE").xr_ps.plot_phase_centers()
../../_images/measurement_set_tutorials_measurement_set_tutorial_26_0.png
[15]:
ps_xdt.xr_ps.plot_antenna_positions_2d()
../../_images/measurement_set_tutorials_measurement_set_tutorial_27_0.png

Measurement Set Data Tree (ms_xdt)

An individual ms_xdt can be accessed by using its name (from the xr_ps.summary() name column) as a dictionary key:

[16]:
ps_xdt.xr_ps.summary()
[16]:
name scan_intents shape execution_block_UID polarization scan_name spw_name spw_intents field_name source_name line_name field_coords session_reference_UID scheduling_block_UID project_UID start_frequency end_frequency
0 Antennae_North.cal.lsrk.split_0 [OBSERVE_TARGET#ON_SOURCE] (50, 45, 8, 2) uid://A002/X1ff7b0/Xb [XX, YY] [17, 21, 25, 9] spw_0 [UNSPECIFIED] [NGC4038 - Antennae North_0, NGC4038 - Antenna... [NGC4038 - Antennae North_0] [] Multi-Phase-Center --- uid://A002/X1fd4e7/X64d T.B.D. 3.439281e+11 3.440067e+11
1 Antennae_North.cal.lsrk.split_1 [OBSERVE_TARGET#ON_SOURCE] (50, 55, 8, 2) uid://A002/X207fe4/X3a [XX, YY] [26, 34, 38, 42] spw_0 [UNSPECIFIED] [NGC4038 - Antennae North_0, NGC4038 - Antenna... [NGC4038 - Antennae North_0] [] Multi-Phase-Center --- uid://A002/X1fd4e7/X64d T.B.D. 3.439281e+11 3.440067e+11
2 Antennae_North.cal.lsrk.split_2 [OBSERVE_TARGET#ON_SOURCE] (15, 55, 8, 2) uid://A002/X207fe4/X3b9 [XX, YY] [43] spw_0 [UNSPECIFIED] [NGC4038 - Antennae North_0, NGC4038 - Antenna... [NGC4038 - Antennae North_0] [] Multi-Phase-Center --- uid://A002/X1fd4e7/X64d T.B.D. 3.439281e+11 3.440067e+11
3 Antennae_North.cal.lsrk.split_3 [OBSERVE_TARGET#ON_SOURCE, CALIBRATE_WVR#ON_SO... (50, 77, 8, 2) uid://A002/X2181fb/X49 [XX, YY] [48, 56, 60, 64] spw_0 [UNSPECIFIED] [NGC4038 - Antennae North_0, NGC4038 - Antenna... [NGC4038 - Antennae North_0] [] Multi-Phase-Center --- uid://A002/X1fd4e7/X64d T.B.D. 3.439281e+11 3.440067e+11
[17]:
ms_xdt = ps_xdt.xr_ps.query(execution_block_UID="uid://A002/X1ff7b0/Xb").xr_ps.get_ms_xdt()
ms_xdt
[17]:
<xarray.DataTree 'Antennae_North.cal.lsrk.split_0'>
Group: /Antennae_North.cal.lsrk.split_0
│   Dimensions:                     (time: 50, baseline_id: 45, frequency: 8,
│                                    polarization: 2, uvw_label: 3)
│   Coordinates:
│     * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
│       field_name                  (time) <U46 9kB ...
│       scan_name                   (time) <U21 4kB '9' '9' '9' ... '25' '25' '25'
│     * baseline_id                 (baseline_id) int64 360B 0 1 2 3 ... 41 42 43 44
│       baseline_antenna1_name      (baseline_id) <U9 2kB ...
│       baseline_antenna2_name      (baseline_id) <U9 2kB ...
│     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│     * polarization                (polarization) <U2 16B 'XX' 'YY'
│     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   Data variables:
│       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 18kB ...
│       FLAG                        (time, baseline_id, frequency, polarization) bool 36kB ...
│       TIME_CENTROID               (time, baseline_id) float64 18kB ...
│       UVW                         (time, baseline_id, uvw_label) float64 54kB ...
│       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 288kB ...
│       WEIGHT                      (time, baseline_id, frequency, polarization) float32 144kB ...
│   Attributes:
│       creation_date:     2026-04-20T21:22:01.520254+00:00
│       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│       observation_info:  {'execution_block_UID': 'uid://A002/X1ff7b0/Xb', 'obse...
│       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│       schema_version:    4.0.0
│       type:              visibility
├── Group: /Antennae_North.cal.lsrk.split_0/antenna_xds
│       Dimensions:                 (antenna_name: 10, cartesian_pos_label: 3,
│                                    receptor_label: 2)
│       Coordinates:
│         * antenna_name            (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
│           mount                   (antenna_name) <U6 240B ...
│           station_name            (antenna_name) <U4 160B ...
│           telescope_name          (antenna_name) <U4 160B ...
│         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│           polarization_type       (antenna_name, receptor_label) <U1 80B ...
│       Data variables:
│           ANTENNA_DISH_DIAMETER   (antenna_name) float64 80B ...
│           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 240B ...
│           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 160B ...
│       Attributes:
│           overall_telescope_name:  ALMA
│           relocatable_antennas:    True
│           type:                    antenna
├── Group: /Antennae_North.cal.lsrk.split_0/field_and_source_base_xds
│       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│       Coordinates:
│         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│           source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
│         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│       Data variables:
│           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B ...
│           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B ...
│       Attributes:
│           type:     field_and_source
└── Group: /Antennae_North.cal.lsrk.split_0/weather_xds
        Dimensions:              (station_name: 2, time_weather: 259,
                                  cartesian_pos_label: 3)
        Coordinates:
          * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
          * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
          * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
        Data variables:
            DEW_POINT            (station_name, time_weather) float64 4kB ...
            PRESSURE             (station_name, time_weather) float64 4kB ...
            REL_HUMIDITY         (station_name, time_weather) float64 4kB ...
            STATION_POSITION     (station_name, cartesian_pos_label) float64 48B ...
            TEMPERATURE          (station_name, time_weather) float64 4kB ...
            WIND_DIRECTION       (station_name, time_weather) float64 4kB ...
            WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather

The correlated dataset (cor_xds) can be accessed by using the .ds property

[18]:
cor_xds = ms_xdt.ds
cor_xds
[18]:
<xarray.DatasetView> Size: 575kB
Dimensions:                     (time: 50, baseline_id: 45, frequency: 8,
                                 polarization: 2, uvw_label: 3)
Coordinates:
  * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
    field_name                  (time) <U46 9kB ...
    scan_name                   (time) <U21 4kB '9' '9' '9' ... '25' '25' '25'
  * baseline_id                 (baseline_id) int64 360B 0 1 2 3 ... 41 42 43 44
    baseline_antenna1_name      (baseline_id) <U9 2kB ...
    baseline_antenna2_name      (baseline_id) <U9 2kB ...
  * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
  * polarization                (polarization) <U2 16B 'XX' 'YY'
  * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
Data variables:
    EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 18kB ...
    FLAG                        (time, baseline_id, frequency, polarization) bool 36kB ...
    TIME_CENTROID               (time, baseline_id) float64 18kB ...
    UVW                         (time, baseline_id, uvw_label) float64 54kB ...
    VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 288kB ...
    WEIGHT                      (time, baseline_id, frequency, polarization) float32 144kB ...
Attributes:
    creation_date:     2026-04-20T21:22:01.520254+00:00
    creator:           {'software_name': 'xradio', 'version': '1.1.3'}
    data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
    observation_info:  {'execution_block_UID': 'uid://A002/X1ff7b0/Xb', 'obse...
    processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
    schema_version:    4.0.0
    type:              visibility

Measurement Set Accessors

  • ms_xdt.xr_ms.

    • get_partition_info

    • sel # allows for data group selection

    • get_field_and_source_xds

[19]:
ms_xdt.xr_ms.get_partition_info()
[19]:
{'spectral_window_name': 'spw_0',
 'spectral_window_intents': ['UNSPECIFIED'],
 'field_name': ['NGC4038 - Antennae North_0',
  'NGC4038 - Antennae North_1',
  'NGC4038 - Antennae North_2'],
 'polarization_setup': ['XX', 'YY'],
 'scan_name': ['17', '21', '25', '9'],
 'source_name': ['NGC4038 - Antennae North_0'],
 'scan_intents': ['OBSERVE_TARGET#ON_SOURCE'],
 'line_name': [],
 'data_group_name': 'base'}
[20]:
ms_xdt.data_groups.keys()
[20]:
dict_keys(['base'])
[21]:
ms_xdt.data_groups
[21]:
{'base': {'correlated_data': 'VISIBILITY',
  'date': '2026-04-20T21:22:01.540275+00:00',
  'description': "Data group derived from the data column 'VISIBILITY' of an MSv2 converted to MSv4",
  'field_and_source': 'field_and_source_base_xds',
  'flag': 'FLAG',
  'uvw': 'UVW',
  'weight': 'WEIGHT'}}
[22]:
ms_xdt
[22]:
<xarray.DataTree 'Antennae_North.cal.lsrk.split_0'>
Group: /Antennae_North.cal.lsrk.split_0
│   Dimensions:                     (time: 50, baseline_id: 45, frequency: 8,
│                                    polarization: 2, uvw_label: 3)
│   Coordinates:
│     * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
│       field_name                  (time) <U46 9kB ...
│       scan_name                   (time) <U21 4kB '9' '9' '9' ... '25' '25' '25'
│     * baseline_id                 (baseline_id) int64 360B 0 1 2 3 ... 41 42 43 44
│       baseline_antenna1_name      (baseline_id) <U9 2kB ...
│       baseline_antenna2_name      (baseline_id) <U9 2kB ...
│     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│     * polarization                (polarization) <U2 16B 'XX' 'YY'
│     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   Data variables:
│       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 18kB ...
│       FLAG                        (time, baseline_id, frequency, polarization) bool 36kB ...
│       TIME_CENTROID               (time, baseline_id) float64 18kB ...
│       UVW                         (time, baseline_id, uvw_label) float64 54kB ...
│       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 288kB ...
│       WEIGHT                      (time, baseline_id, frequency, polarization) float32 144kB ...
│   Attributes:
│       creation_date:     2026-04-20T21:22:01.520254+00:00
│       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│       observation_info:  {'execution_block_UID': 'uid://A002/X1ff7b0/Xb', 'obse...
│       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│       schema_version:    4.0.0
│       type:              visibility
├── Group: /Antennae_North.cal.lsrk.split_0/antenna_xds
│       Dimensions:                 (antenna_name: 10, cartesian_pos_label: 3,
│                                    receptor_label: 2)
│       Coordinates:
│         * antenna_name            (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
│           mount                   (antenna_name) <U6 240B ...
│           station_name            (antenna_name) <U4 160B ...
│           telescope_name          (antenna_name) <U4 160B ...
│         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│           polarization_type       (antenna_name, receptor_label) <U1 80B ...
│       Data variables:
│           ANTENNA_DISH_DIAMETER   (antenna_name) float64 80B ...
│           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 240B ...
│           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 160B ...
│       Attributes:
│           overall_telescope_name:  ALMA
│           relocatable_antennas:    True
│           type:                    antenna
├── Group: /Antennae_North.cal.lsrk.split_0/field_and_source_base_xds
│       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│       Coordinates:
│         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│           source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
│         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│       Data variables:
│           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B ...
│           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B ...
│       Attributes:
│           type:     field_and_source
└── Group: /Antennae_North.cal.lsrk.split_0/weather_xds
        Dimensions:              (station_name: 2, time_weather: 259,
                                  cartesian_pos_label: 3)
        Coordinates:
          * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
          * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
          * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
        Data variables:
            DEW_POINT            (station_name, time_weather) float64 4kB ...
            PRESSURE             (station_name, time_weather) float64 4kB ...
            REL_HUMIDITY         (station_name, time_weather) float64 4kB ...
            STATION_POSITION     (station_name, cartesian_pos_label) float64 48B ...
            TEMPERATURE          (station_name, time_weather) float64 4kB ...
            WIND_DIRECTION       (station_name, time_weather) float64 4kB ...
            WIND_SPEED           (station_name, time_weather) float64 4kB ...
        Attributes:
            type:     weather
[23]:
from datetime import datetime

ms_xdt["VISIBILITY_CORRECTED"] = 42*ms_xdt["VISIBILITY"]
ms_xdt["WEIGHT_IMAGING"] = ms_xdt["WEIGHT"]/42
ms_xdt["field_and_source_corrected_xds"] = 42*ms_xdt.xr_ms.get_field_and_source_xds()
import time


ms_xdt = ms_xdt.xr_ms.add_data_group(new_data_group_name="corrected",
        new_data_group={ "correlated_data":"VISIBILITY_CORRECTED",
                            "weight" : "WEIGHT_IMAGING",
                            "flag" : "FLAG",
                            "uvw" : "UVW",
                            "field_and_source_xds": "field_and_source_corrected_xds",
                            "date_time":datetime.now().isoformat(),
                            "description":"New data group with corrected data",
        })

ms_xdt

[23]:
<xarray.DataTree 'Antennae_North.cal.lsrk.split_0'>
Group: /Antennae_North.cal.lsrk.split_0
│   Dimensions:                     (time: 50, baseline_id: 45, frequency: 8,
│                                    polarization: 2, uvw_label: 3)
│   Coordinates:
│     * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
│       field_name                  (time) <U46 9kB ...
│       scan_name                   (time) <U21 4kB '9' '9' '9' ... '25' '25' '25'
│     * baseline_id                 (baseline_id) int64 360B 0 1 2 3 ... 41 42 43 44
│       baseline_antenna1_name      (baseline_id) <U9 2kB ...
│       baseline_antenna2_name      (baseline_id) <U9 2kB ...
│     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│     * polarization                (polarization) <U2 16B 'XX' 'YY'
│     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   Data variables:
│       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 18kB ...
│       FLAG                        (time, baseline_id, frequency, polarization) bool 36kB ...
│       TIME_CENTROID               (time, baseline_id) float64 18kB ...
│       UVW                         (time, baseline_id, uvw_label) float64 54kB ...
│       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 288kB ...
│       WEIGHT                      (time, baseline_id, frequency, polarization) float32 144kB ...
│       VISIBILITY_CORRECTED        (time, baseline_id, frequency, polarization) complex64 288kB ...
│       WEIGHT_IMAGING              (time, baseline_id, frequency, polarization) float32 144kB ...
│   Attributes:
│       creation_date:     2026-04-20T21:22:01.520254+00:00
│       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│       observation_info:  {'execution_block_UID': 'uid://A002/X1ff7b0/Xb', 'obse...
│       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│       schema_version:    4.0.0
│       type:              visibility
├── Group: /Antennae_North.cal.lsrk.split_0/antenna_xds
│       Dimensions:                 (antenna_name: 10, cartesian_pos_label: 3,
│                                    receptor_label: 2)
│       Coordinates:
│         * antenna_name            (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
│           mount                   (antenna_name) <U6 240B ...
│           station_name            (antenna_name) <U4 160B ...
│           telescope_name          (antenna_name) <U4 160B ...
│         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│           polarization_type       (antenna_name, receptor_label) <U1 80B ...
│       Data variables:
│           ANTENNA_DISH_DIAMETER   (antenna_name) float64 80B ...
│           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 240B ...
│           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 160B ...
│       Attributes:
│           overall_telescope_name:  ALMA
│           relocatable_antennas:    True
│           type:                    antenna
├── Group: /Antennae_North.cal.lsrk.split_0/field_and_source_base_xds
│       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│       Coordinates:
│         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│           source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
│         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│       Data variables:
│           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B 3.1...
│           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B 3.1...
│       Attributes:
│           type:     field_and_source
├── Group: /Antennae_North.cal.lsrk.split_0/weather_xds
│       Dimensions:              (station_name: 2, time_weather: 259,
│                                 cartesian_pos_label: 3)
│       Coordinates:
│         * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
│         * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
│         * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│       Data variables:
│           DEW_POINT            (station_name, time_weather) float64 4kB ...
│           PRESSURE             (station_name, time_weather) float64 4kB ...
│           REL_HUMIDITY         (station_name, time_weather) float64 4kB ...
│           STATION_POSITION     (station_name, cartesian_pos_label) float64 48B ...
│           TEMPERATURE          (station_name, time_weather) float64 4kB ...
│           WIND_DIRECTION       (station_name, time_weather) float64 4kB ...
│           WIND_SPEED           (station_name, time_weather) float64 4kB ...
│       Attributes:
│           type:     weather
└── Group: /Antennae_North.cal.lsrk.split_0/field_and_source_corrected_xds
        Dimensions:                       (field_name: 3, sky_dir_label: 2)
        Coordinates:
          * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
            source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
          * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
        Data variables:
            FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B 132...
            SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B 132...
        Attributes:
            type:     field_and_source
[24]:
ms_xdt.xr_ms.sel(data_group_name="base")
[24]:
<xarray.DataTree 'Antennae_North.cal.lsrk.split_0'>
Group: /Antennae_North.cal.lsrk.split_0
│   Dimensions:                     (time: 50, baseline_id: 45, frequency: 8,
│                                    polarization: 2, uvw_label: 3)
│   Coordinates:
│     * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
│       field_name                  (time) <U46 9kB ...
│       scan_name                   (time) <U21 4kB '9' '9' '9' ... '25' '25' '25'
│     * baseline_id                 (baseline_id) int64 360B 0 1 2 3 ... 41 42 43 44
│       baseline_antenna1_name      (baseline_id) <U9 2kB ...
│       baseline_antenna2_name      (baseline_id) <U9 2kB ...
│     * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
│     * polarization                (polarization) <U2 16B 'XX' 'YY'
│     * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
│   Data variables:
│       EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 18kB ...
│       FLAG                        (time, baseline_id, frequency, polarization) bool 36kB ...
│       TIME_CENTROID               (time, baseline_id) float64 18kB ...
│       UVW                         (time, baseline_id, uvw_label) float64 54kB ...
│       VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 288kB ...
│       WEIGHT                      (time, baseline_id, frequency, polarization) float32 144kB ...
│   Attributes:
│       creation_date:     2026-04-20T21:22:01.520254+00:00
│       creator:           {'software_name': 'xradio', 'version': '1.1.3'}
│       data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
│       observation_info:  {'execution_block_UID': 'uid://A002/X1ff7b0/Xb', 'obse...
│       processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
│       schema_version:    4.0.0
│       type:              visibility
├── Group: /Antennae_North.cal.lsrk.split_0/antenna_xds
│       Dimensions:                 (antenna_name: 10, cartesian_pos_label: 3,
│                                    receptor_label: 2)
│       Coordinates:
│         * antenna_name            (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
│           mount                   (antenna_name) <U6 240B ...
│           station_name            (antenna_name) <U4 160B ...
│           telescope_name          (antenna_name) <U4 160B ...
│         * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│         * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
│           polarization_type       (antenna_name, receptor_label) <U1 80B ...
│       Data variables:
│           ANTENNA_DISH_DIAMETER   (antenna_name) float64 80B ...
│           ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 240B ...
│           ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 160B ...
│       Attributes:
│           overall_telescope_name:  ALMA
│           relocatable_antennas:    True
│           type:                    antenna
├── Group: /Antennae_North.cal.lsrk.split_0/field_and_source_base_xds
│       Dimensions:                       (field_name: 3, sky_dir_label: 2)
│       Coordinates:
│         * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
│           source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
│         * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
│       Data variables:
│           FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B 3.1...
│           SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B 3.1...
│       Attributes:
│           type:     field_and_source
├── Group: /Antennae_North.cal.lsrk.split_0/weather_xds
│       Dimensions:              (station_name: 2, time_weather: 259,
│                                 cartesian_pos_label: 3)
│       Coordinates:
│         * station_name         (station_name) <U10 80B 'Station_11' 'Station_12'
│         * time_weather         (time_weather) float64 2kB 1.307e+09 ... 1.307e+09
│         * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
│       Data variables:
│           DEW_POINT            (station_name, time_weather) float64 4kB ...
│           PRESSURE             (station_name, time_weather) float64 4kB ...
│           REL_HUMIDITY         (station_name, time_weather) float64 4kB ...
│           STATION_POSITION     (station_name, cartesian_pos_label) float64 48B ...
│           TEMPERATURE          (station_name, time_weather) float64 4kB ...
│           WIND_DIRECTION       (station_name, time_weather) float64 4kB ...
│           WIND_SPEED           (station_name, time_weather) float64 4kB ...
│       Attributes:
│           type:     weather
└── Group: /Antennae_North.cal.lsrk.split_0/field_and_source_corrected_xds
        Dimensions:                       (field_name: 3, sky_dir_label: 2)
        Coordinates:
          * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
            source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
          * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
        Data variables:
            FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B 132...
            SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B 132...
        Attributes:
            type:     field_and_source
[25]:
ms_xdt.xr_ms. get_field_and_source_xds()
[25]:
<xarray.DatasetView> Size: 2kB
Dimensions:                       (field_name: 3, sky_dir_label: 2,
                                   baseline_id: 45, frequency: 8,
                                   polarization: 2, time: 50, uvw_label: 3)
Coordinates:
  * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
    source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
  * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
  * baseline_id                   (baseline_id) int64 360B 0 1 2 3 ... 42 43 44
  * frequency                     (frequency) float64 64B 3.439e+11 ... 3.44e+11
  * polarization                  (polarization) <U2 16B 'XX' 'YY'
  * time                          (time) float64 400B 1.307e+09 ... 1.307e+09
  * uvw_label                     (uvw_label) <U1 12B 'u' 'v' 'w'
Data variables:
    FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B 3.1...
    SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B 3.1...
Attributes:
    type:     field_and_source

Correlated Xarray Dataset

[26]:
cor_xds = ms_xdt.ds
cor_xds
[26]:
<xarray.DatasetView> Size: 575kB
Dimensions:                     (time: 50, baseline_id: 45, frequency: 8,
                                 polarization: 2, uvw_label: 3)
Coordinates:
  * time                        (time) float64 400B 1.307e+09 ... 1.307e+09
    field_name                  (time) <U46 9kB ...
    scan_name                   (time) <U21 4kB '9' '9' '9' ... '25' '25' '25'
  * baseline_id                 (baseline_id) int64 360B 0 1 2 3 ... 41 42 43 44
    baseline_antenna1_name      (baseline_id) <U9 2kB ...
    baseline_antenna2_name      (baseline_id) <U9 2kB ...
  * frequency                   (frequency) float64 64B 3.439e+11 ... 3.44e+11
  * polarization                (polarization) <U2 16B 'XX' 'YY'
  * uvw_label                   (uvw_label) <U1 12B 'u' 'v' 'w'
Data variables:
    EFFECTIVE_INTEGRATION_TIME  (time, baseline_id) float64 18kB ...
    FLAG                        (time, baseline_id, frequency, polarization) bool 36kB ...
    TIME_CENTROID               (time, baseline_id) float64 18kB ...
    UVW                         (time, baseline_id, uvw_label) float64 54kB ...
    VISIBILITY                  (time, baseline_id, frequency, polarization) complex64 288kB ...
    WEIGHT                      (time, baseline_id, frequency, polarization) float32 144kB ...
Attributes:
    creation_date:     2026-04-20T21:22:01.520254+00:00
    creator:           {'software_name': 'xradio', 'version': '1.1.3'}
    data_groups:       {'base': {'correlated_data': 'VISIBILITY', 'date': '20...
    observation_info:  {'execution_block_UID': 'uid://A002/X1ff7b0/Xb', 'obse...
    processor_info:    {'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELAT...
    schema_version:    4.0.0
    type:              visibility

Coordinates

[27]:
ms_xdt.polarization
[27]:
<xarray.DataArray 'polarization' (polarization: 2)> Size: 16B
array(['XX', 'YY'], dtype='<U2')
Coordinates:
  * polarization  (polarization) <U2 16B 'XX' 'YY'
[28]:
ms_xdt.uvw_label
[28]:
<xarray.DataArray 'uvw_label' (uvw_label: 3)> Size: 12B
array(['u', 'v', 'w'], dtype='<U1')
Coordinates:
  * uvw_label  (uvw_label) <U1 12B 'u' 'v' 'w'
[29]:
ms_xdt.coords["baseline_id"]
[29]:
<xarray.DataArray 'baseline_id' (baseline_id: 45)> Size: 360B
array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,
       18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
       36, 37, 38, 39, 40, 41, 42, 43, 44])
Coordinates:
  * baseline_id             (baseline_id) int64 360B 0 1 2 3 4 ... 41 42 43 44
    baseline_antenna1_name  (baseline_id) <U9 2kB ...
    baseline_antenna2_name  (baseline_id) <U9 2kB ...
[30]:
ms_xdt.time
[30]:
<xarray.DataArray 'time' (time: 50)> Size: 400B
array([1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09,
       1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09,
       1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09,
       1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09,
       1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09,
       1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09,
       1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09,
       1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09,
       1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09,
       1.306551e+09, 1.306551e+09, 1.306551e+09, 1.306551e+09, 1.306551e+09])
Coordinates:
  * time        (time) float64 400B 1.307e+09 1.307e+09 ... 1.307e+09 1.307e+09
    field_name  (time) <U46 9kB ...
    scan_name   (time) <U21 4kB '9' '9' '9' '9' '9' ... '25' '25' '25' '25' '25'
Attributes:
    format:            unix
    integration_time:  {'attrs': {'type': 'quantity', 'units': 's'}, 'data': ...
    scale:             utc
    type:              time
    units:             s

Correlated Xarray Dataset Data Variables

[31]:
ms_xdt.VISIBILITY
[31]:
<xarray.DataArray 'VISIBILITY' (time: 50, baseline_id: 45, frequency: 8,
                                polarization: 2)> Size: 288kB
array([[[[ 0.269382-0.254866j, -0.044234-0.050127j],
         ...,
         [-1.009038-0.527602j, -0.030134-0.753943j]],

        ...,

        [[ 0.384126+0.222491j, -0.815531-0.617437j],
         ...,
         [ 0.947552+0.087211j,  0.103122+0.387794j]]],


       ...,


       [[[ 1.350539-0.155882j, -1.342354-0.712565j],
         ...,
         [ 0.181522-0.215411j,  1.145939+0.266635j]],

        ...,

        [[ 0.342312-0.677212j,  0.049855+0.078528j],
         ...,
         [-0.525983+0.780548j,  0.61932 +0.577454j]]]],
      shape=(50, 45, 8, 2), dtype=complex64)
Coordinates:
  * time                    (time) float64 400B 1.307e+09 ... 1.307e+09
    field_name              (time) <U46 9kB ...
    scan_name               (time) <U21 4kB '9' '9' '9' '9' ... '25' '25' '25'
  * baseline_id             (baseline_id) int64 360B 0 1 2 3 4 ... 41 42 43 44
    baseline_antenna1_name  (baseline_id) <U9 2kB ...
    baseline_antenna2_name  (baseline_id) <U9 2kB ...
  * frequency               (frequency) float64 64B 3.439e+11 ... 3.44e+11
  * polarization            (polarization) <U2 16B 'XX' 'YY'
Attributes:
    type:     quanta
    units:    unkown
[32]:
ms_xdt.FLAG
[32]:
<xarray.DataArray 'FLAG' (time: 50, baseline_id: 45, frequency: 8,
                          polarization: 2)> Size: 36kB
[36000 values with dtype=bool]
Coordinates:
  * time                    (time) float64 400B 1.307e+09 ... 1.307e+09
    field_name              (time) <U46 9kB ...
    scan_name               (time) <U21 4kB '9' '9' '9' '9' ... '25' '25' '25'
  * baseline_id             (baseline_id) int64 360B 0 1 2 3 4 ... 41 42 43 44
    baseline_antenna1_name  (baseline_id) <U9 2kB ...
    baseline_antenna2_name  (baseline_id) <U9 2kB ...
  * frequency               (frequency) float64 64B 3.439e+11 ... 3.44e+11
  * polarization            (polarization) <U2 16B 'XX' 'YY'
[33]:
ms_xdt.VISIBILITY.max()
[33]:
<xarray.DataArray 'VISIBILITY' ()> Size: 8B
array(7.853105+9.024941j, dtype=complex64)
Attributes:
    type:     quanta
    units:    unkown
[34]:
ms_xdt.VISIBILITY.max().compute()
# ms_xdt.VISIBILITY.max().values
[34]:
<xarray.DataArray 'VISIBILITY' ()> Size: 8B
array(7.853105+9.024941j, dtype=complex64)
Attributes:
    type:     quanta
    units:    unkown

Meta-data

Meta-data Datasets

The meta-data datasets are stored in children nodes of the ms_xdt.

[35]:
ant_xds = ms_xdt.antenna_xds.ds
ant_xds
[35]:
<xarray.DatasetView> Size: 2kB
Dimensions:                 (antenna_name: 10, cartesian_pos_label: 3,
                             receptor_label: 2, baseline_id: 45, frequency: 8,
                             polarization: 2, time: 50, uvw_label: 3)
Coordinates:
  * antenna_name            (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
    mount                   (antenna_name) <U6 240B ...
    station_name            (antenna_name) <U4 160B ...
    telescope_name          (antenna_name) <U4 160B ...
  * cartesian_pos_label     (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
  * receptor_label          (receptor_label) <U5 40B 'pol_0' 'pol_1'
    polarization_type       (antenna_name, receptor_label) <U1 80B ...
  * baseline_id             (baseline_id) int64 360B 0 1 2 3 4 ... 41 42 43 44
  * frequency               (frequency) float64 64B 3.439e+11 ... 3.44e+11
  * polarization            (polarization) <U2 16B 'XX' 'YY'
  * time                    (time) float64 400B 1.307e+09 ... 1.307e+09
  * uvw_label               (uvw_label) <U1 12B 'u' 'v' 'w'
Data variables:
    ANTENNA_DISH_DIAMETER   (antenna_name) float64 80B ...
    ANTENNA_POSITION        (antenna_name, cartesian_pos_label) float64 240B ...
    ANTENNA_RECEPTOR_ANGLE  (antenna_name, receptor_label) float64 160B ...
Attributes:
    overall_telescope_name:  ALMA
    relocatable_antennas:    True
    type:                    antenna

As an xarray dataset, the antenna sub-xds can be used via the same API as the main xds.

[36]:
ant_xds.ANTENNA_POSITION.compute()
[36]:
<xarray.DataArray 'ANTENNA_POSITION' (antenna_name: 10, cartesian_pos_label: 3)> Size: 240B
array([[ 2225116.51436519, -5440062.8208869 , -2481625.08587685],
       [ 2225110.431677  , -5440116.42635   , -2481514.811072  ],
       [ 2225092.18094923, -5440046.02555079, -2481684.35928372],
       [ 2225196.812703  , -5440052.19132   , -2481569.079809  ],
       [ 2225111.267858  , -5440053.340209  , -2481650.399284  ],
       [ 2225096.8413    , -5440069.063138  , -2481629.022813  ],
       [ 2225091.352114  , -5440084.136991  , -2481601.581944  ],
       [ 2225039.66023   , -5440119.11878   , -2481571.98053   ],
       [ 2225096.729523  , -5440060.569471  , -2481648.625402  ],
       [ 2225086.822689  , -5440113.374706  , -2481542.478537  ]])
Coordinates:
  * antenna_name         (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
    mount                (antenna_name) <U6 240B 'ALT-AZ' 'ALT-AZ' ... 'ALT-AZ'
    station_name         (antenna_name) <U4 160B 'A015' 'T704' ... 'A017' 'J504'
    telescope_name       (antenna_name) <U4 160B 'ALMA' 'ALMA' ... 'ALMA' 'ALMA'
  * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
Attributes:
    coordinate_system:   geocentric
    frame:               ITRS
    origin_object_name:  earth
    type:                location
    units:               m
[37]:
ant_xds.ANTENNA_POSITION.load()
[37]:
<xarray.DataArray 'ANTENNA_POSITION' (antenna_name: 10, cartesian_pos_label: 3)> Size: 240B
array([[ 2225116.51436519, -5440062.8208869 , -2481625.08587685],
       [ 2225110.431677  , -5440116.42635   , -2481514.811072  ],
       [ 2225092.18094923, -5440046.02555079, -2481684.35928372],
       [ 2225196.812703  , -5440052.19132   , -2481569.079809  ],
       [ 2225111.267858  , -5440053.340209  , -2481650.399284  ],
       [ 2225096.8413    , -5440069.063138  , -2481629.022813  ],
       [ 2225091.352114  , -5440084.136991  , -2481601.581944  ],
       [ 2225039.66023   , -5440119.11878   , -2481571.98053   ],
       [ 2225096.729523  , -5440060.569471  , -2481648.625402  ],
       [ 2225086.822689  , -5440113.374706  , -2481542.478537  ]])
Coordinates:
  * antenna_name         (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
    mount                (antenna_name) <U6 240B 'ALT-AZ' 'ALT-AZ' ... 'ALT-AZ'
    station_name         (antenna_name) <U4 160B 'A015' 'T704' ... 'A017' 'J504'
    telescope_name       (antenna_name) <U4 160B 'ALMA' 'ALMA' ... 'ALMA' 'ALMA'
  * cartesian_pos_label  (cartesian_pos_label) <U1 12B 'x' 'y' 'z'
Attributes:
    coordinate_system:   geocentric
    frame:               ITRS
    origin_object_name:  earth
    type:                location
    units:               m
[38]:
ant_xds.antenna_name.values
[38]:
array(['DV02_A015', 'DV06_T704', 'DV07_A004', 'DV08_A072', 'DV09_A008',
       'DV10_A009', 'DV11_A016', 'PM01_T702', 'PM02_A017', 'PM03_J504'],
      dtype='<U9')
[39]:
ant_xds.ANTENNA_DISH_DIAMETER.load()
[39]:
<xarray.DataArray 'ANTENNA_DISH_DIAMETER' (antenna_name: 10)> Size: 80B
array([12., 12., 12., 12., 12., 12., 12., 12., 12., 12.])
Coordinates:
  * antenna_name    (antenna_name) <U9 360B 'DV02_A015' ... 'PM03_J504'
    mount           (antenna_name) <U6 240B 'ALT-AZ' 'ALT-AZ' ... 'ALT-AZ'
    station_name    (antenna_name) <U4 160B 'A015' 'T704' ... 'A017' 'J504'
    telescope_name  (antenna_name) <U4 160B 'ALMA' 'ALMA' ... 'ALMA' 'ALMA'
Attributes:
    type:     quantity
    units:    m

Attributes of Data Arrays and Coordinates. Quantities and Measures

Data variables and coordinates can have quantity and measures information in their attributes section along with other relevant metadata. These measures are specified as dictionaries in the attribute of the data variable or coordinate, with keys units and type in addition to other keys depending on the type of measure. The naming conventions are based on astropy.

Time coordinate

The time coordinate is a time measure (keys: type, units, time_scale, format) but also contains for example integration_time which is a quantity.

[40]:
ms_xdt.time
[40]:
<xarray.DataArray 'time' (time: 50)> Size: 400B
array([1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09,
       1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09,
       1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09, 1.306547e+09,
       1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09,
       1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09,
       1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09, 1.306549e+09,
       1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09,
       1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09,
       1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09, 1.306550e+09,
       1.306551e+09, 1.306551e+09, 1.306551e+09, 1.306551e+09, 1.306551e+09])
Coordinates:
  * time        (time) float64 400B 1.307e+09 1.307e+09 ... 1.307e+09 1.307e+09
    field_name  (time) <U46 9kB ...
    scan_name   (time) <U21 4kB '9' '9' '9' '9' '9' ... '25' '25' '25' '25' '25'
Attributes:
    format:            unix
    integration_time:  {'attrs': {'type': 'quantity', 'units': 's'}, 'data': ...
    scale:             utc
    type:              time
    units:             s
Quantities and measures that are not xarray

When a quantity or a measure is not an xarray, it is specificed as a dictionary with a format based on xarray’s xarray.DataArray.from_dict() and it has the following keys: {"dims": ..., "data": ..., "attrs": quantity/measures_dict}. The integration_time attribute included in the attributes of the time coordinate is an example where we can see the metadata of a time measure:

[41]:
import pprint
pprint.pprint(ms_xdt.time.attrs)
{'format': 'unix',
 'integration_time': {'attrs': {'type': 'quantity', 'units': 's'},
                      'data': 6.048,
                      'dims': []},
 'scale': 'utc',
 'type': 'time',
 'units': 's'}
Frequency coordinate

The frequency coordinate is a spectral_coord measure and as such has the following keys in its attributes: type, units, and observer. In addition, the attributes contain fields such as channel_width, spectral_window_name, spectral_window_intent, and reference_frequency.

Any metadata that is a quantity or measure (non-id numbers) is placed in the relevant measures or quantity dictionary.

[42]:
ms_xdt.frequency
[42]:
<xarray.DataArray 'frequency' (frequency: 8)> Size: 64B
array([3.439281e+11, 3.439393e+11, 3.439506e+11, 3.439618e+11, 3.439730e+11,
       3.439843e+11, 3.439955e+11, 3.440067e+11])
Coordinates:
  * frequency  (frequency) float64 64B 3.439e+11 3.439e+11 ... 3.44e+11 3.44e+11
Attributes:
    channel_width:            {'attrs': {'type': 'quantity', 'units': 'Hz'}, ...
    observer:                 lsrk
    reference_frequency:      {'attrs': {'observer': 'lsrk', 'type': 'spectra...
    spectral_window_intents:  ['UNSPECIFIED']
    spectral_window_name:     spw_0
    type:                     spectral_coord
    units:                    Hz

In the frequency coordinate we have example of: - quantity given as a dict: channel_width - measure given as a dict: reference_frequency (a spectral_coord ~= casacore/frequency)

[43]:
pprint.pprint(ms_xdt.frequency.attrs)
{'channel_width': {'attrs': {'type': 'quantity', 'units': 'Hz'},
                   'data': 11231488.981445312,
                   'dims': []},
 'observer': 'lsrk',
 'reference_frequency': {'attrs': {'observer': 'lsrk',
                                   'type': 'spectral_coord',
                                   'units': 'Hz'},
                         'data': 343928096685.9587,
                         'dims': []},
 'spectral_window_intents': ['UNSPECIFIED'],
 'spectral_window_name': 'spw_0',
 'type': 'spectral_coord',
 'units': 'Hz'}

Metadata in dicts. Observation, processor and partition info.

The MSv4 also allows for info dictionaries in the attribute section of the dataset. This is used when no n-dimensional data is required. The relevant measures metadata is included, similarly as with coordinates and data variables (when non-id) in xarray datasets.

An MSv4 has observation and processor info dicts, for example:

[44]:
ms_xdt.observation_info
[44]:
{'execution_block_UID': 'uid://A002/X1ff7b0/Xb',
 'observer': ['Unknown'],
 'observing_log': "['']",
 'project_UID': 'T.B.D.',
 'release_date': '1858-11-17T00:00:00',
 'scheduling_block_UID': 'uid://A002/X1fd4e7/X64d'}
[45]:
ms_xdt.processor_info
[45]:
{'sub_type': 'ALMA_CORRELATOR_MODE', 'type': 'CORRELATOR'}

Another example is the partition_info dict, which describes the partition of the original MSv2 that is included in the ms_xdt:

[46]:
ms_xdt.xr_ms.get_partition_info()
[46]:
{'spectral_window_name': 'spw_0',
 'spectral_window_intents': ['UNSPECIFIED'],
 'field_name': ['NGC4038 - Antennae North_0',
  'NGC4038 - Antennae North_1',
  'NGC4038 - Antennae North_2'],
 'polarization_setup': ['XX', 'YY'],
 'scan_name': ['17', '21', '25', '9'],
 'source_name': ['NGC4038 - Antennae North_0'],
 'scan_intents': ['OBSERVE_TARGET#ON_SOURCE'],
 'line_name': [],
 'data_group_name': 'base'}

Metadata in sub-xds. Field_and_source sub-dataset.

A special example of sub-xds is the field_and_source_*_xds which is referenced from the data_groups dictionary. There can a base field and source dataset, field_and_source_base_xds and an arbitrary set of additional field and source datasets with different names. This way, transformations applied on the visibilities can be reflected in variables such as the field phase center or the source direction. Here data variables such as FIELD_PHASE_CENTER or SOURCE_DIRECTION are stored as sky_coord measures (their attributes contain the following keys: type, units, frame).

A particular field and source dataset can be retrieved by name using the accessor xr_ms, function get_field_and_source_xds():

[47]:
field_and_source_xds = ms_xdt.xr_ms.get_field_and_source_xds(data_group_name="base")
[48]:
field_and_source_xds
[48]:
<xarray.DatasetView> Size: 2kB
Dimensions:                       (field_name: 3, sky_dir_label: 2,
                                   baseline_id: 45, frequency: 8,
                                   polarization: 2, time: 50, uvw_label: 3)
Coordinates:
  * field_name                    (field_name) <U46 552B 'NGC4038 - Antennae ...
    source_name                   (field_name) <U46 552B 'NGC4038 - Antennae ...
  * sky_dir_label                 (sky_dir_label) <U3 24B 'ra' 'dec'
  * baseline_id                   (baseline_id) int64 360B 0 1 2 3 ... 42 43 44
  * frequency                     (frequency) float64 64B 3.439e+11 ... 3.44e+11
  * polarization                  (polarization) <U2 16B 'XX' 'YY'
  * time                          (time) float64 400B 1.307e+09 ... 1.307e+09
  * uvw_label                     (uvw_label) <U1 12B 'u' 'v' 'w'
Data variables:
    FIELD_PHASE_CENTER_DIRECTION  (field_name, sky_dir_label) float64 48B 3.1...
    SOURCE_DIRECTION              (field_name, sky_dir_label) float64 48B 3.1...
Attributes:
    type:     field_and_source
[49]:
field_and_source_xds.FIELD_PHASE_CENTER_DIRECTION
[49]:
<xarray.DataArray 'FIELD_PHASE_CENTER_DIRECTION' (field_name: 3,
                                                  sky_dir_label: 2)> Size: 48B
array([[ 3.149769, -0.3293  ],
       [ 3.149807, -0.3293  ],
       [ 3.149846, -0.3293  ]])
Coordinates:
  * field_name     (field_name) <U46 552B 'NGC4038 - Antennae North_0' ... 'N...
    source_name    (field_name) <U46 552B 'NGC4038 - Antennae North_0' ... 'N...
  * sky_dir_label  (sky_dir_label) <U3 24B 'ra' 'dec'
Attributes:
    frame:    fk5
    type:     sky_coord
    units:    rad
[50]:
field_and_source_xds.SOURCE_DIRECTION
[50]:
<xarray.DataArray 'SOURCE_DIRECTION' (field_name: 3, sky_dir_label: 2)> Size: 48B
array([[ 3.149823, -0.329469],
       [ 3.149823, -0.329469],
       [ 3.149823, -0.329469]])
Coordinates:
  * field_name     (field_name) <U46 552B 'NGC4038 - Antennae North_0' ... 'N...
    source_name    (field_name) <U46 552B 'NGC4038 - Antennae North_0' ... 'N...
  * sky_dir_label  (sky_dir_label) <U3 24B 'ra' 'dec'
Attributes:
    frame:    fk5
    type:     sky_coord
    units:    rad

Selection examples

One can use the usual selection functionality of xarray with all arrays, the main dataset and all sub datasets. For example, selection by labels, sel():

[51]:
sel_xds = ms_xdt.sel(frequency=slice(3.43939e11, 3.4397e11))
sel_xds.frequency
[51]:
<xarray.DataArray 'frequency' (frequency: 3)> Size: 24B
array([3.439393e+11, 3.439506e+11, 3.439618e+11])
Coordinates:
  * frequency  (frequency) float64 24B 3.439e+11 3.44e+11 3.44e+11
Attributes:
    channel_width:            {'attrs': {'type': 'quantity', 'units': 'Hz'}, ...
    observer:                 lsrk
    reference_frequency:      {'attrs': {'observer': 'lsrk', 'type': 'spectra...
    spectral_window_intents:  ['UNSPECIFIED']
    spectral_window_name:     spw_0
    type:                     spectral_coord
    units:                    Hz

Or selection by indices, isel()

[52]:
isel_xds = ms_xdt.isel(frequency=slice(1, 4))
isel_xds.frequency
[52]:
<xarray.DataArray 'frequency' (frequency: 3)> Size: 24B
array([3.439393e+11, 3.439506e+11, 3.439618e+11])
Coordinates:
  * frequency  (frequency) float64 24B 3.439e+11 3.44e+11 3.44e+11
Attributes:
    channel_width:            {'attrs': {'type': 'quantity', 'units': 'Hz'}, ...
    observer:                 lsrk
    reference_frequency:      {'attrs': {'observer': 'lsrk', 'type': 'spectra...
    spectral_window_intents:  ['UNSPECIFIED']
    spectral_window_name:     spw_0
    type:                     spectral_coord
    units:                    Hz
[53]:
sel_xds.equals(isel_xds)
[53]:
True
[54]:
sel_xds.identical(isel_xds)
[54]:
True
[55]:
viper_client.close()