Skip to main content

xarray Datasets from CASA Tables.

Project description

https://img.shields.io/pypi/v/xarray-ms.svg https://img.shields.io/travis/ska-sa/xarray-ms.svg Documentation Status

Constructs xarray Datasets from CASA Tables via python-casacore. The DataArrays contained in the Dataset are dask arrays backed by deferred calls to pyrap.tables.table.getcol.

Supports writing DataArrays back to the respective column in the Table.

The intention behind this package is to support the Measurement Set as a data source and sink for the purposes of writing parallel, distributed Radio Astronomy algorithms.

import dask.array as da
from xarrayms import xds_from_table, xds_to_table

# Create xarray dataset from Measurement Set "WSRT.MS"
ds = xds_from_table("WSRT.MS")
# Set the flag DataArray to it's inverse
ds['flag'] = (ds.flag.dims, da.logical_not(ds.flag))
# Write the flag column back to the Measurement Set
xds_to_table(ds, "WSRT.MS", "FLAG").compute()

print ds

<xarray.Dataset>
Dimensions:         ((u,v,w): 3, chan: 64, corr: 4, row: 6552, table_row: 6552)
Coordinates:
  * row             (row) int32 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ...
  * table_row       (table_row) int32 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 ...
Dimensions without coordinates: (u,v,w), chan, corr
Data variables:
    ANTENNA1        (row) int32 dask.array<shape=(6552,), chunksize=(1000,)>
    ANTENNA2        (row) int32 dask.array<shape=(6552,), chunksize=(1000,)>
    ARRAY_ID        (row) int32 dask.array<shape=(6552,), chunksize=(1000,)>
    CORRECTED_DATA  (row, chan, corr) complex64 dask.array<shape=(6552, 64, 4), chunksize=(1000, 64, 4)>
    DATA            (row, chan, corr) complex64 dask.array<shape=(6552, 64, 4), chunksize=(1000, 64, 4)>
    EXPOSURE        (row) float64 dask.array<shape=(6552,), chunksize=(1000,)>
    FEED1           (row) int32 dask.array<shape=(6552,), chunksize=(1000,)>
    FEED2           (row) int32 dask.array<shape=(6552,), chunksize=(1000,)>
    FLAG            (row, chan, corr) bool dask.array<shape=(6552, 64, 4), chunksize=(1000, 64, 4)>
    FLAG_ROW        (row) bool dask.array<shape=(6552,), chunksize=(1000,)>
    IMAGING_WEIGHT  (row, chan) float32 dask.array<shape=(6552, 64), chunksize=(1000, 64)>
    INTERVAL        (row) float64 dask.array<shape=(6552,), chunksize=(1000,)>
    MODEL_DATA      (row, chan, corr) complex64 dask.array<shape=(6552, 64, 4), chunksize=(1000, 64, 4)>
    OBSERVATION_ID  (row) int32 dask.array<shape=(6552,), chunksize=(1000,)>
    PROCESSOR_ID    (row) int32 dask.array<shape=(6552,), chunksize=(1000,)>
    SCAN_NUMBER     (row) int32 dask.array<shape=(6552,), chunksize=(1000,)>
    SIGMA           (row, corr) float32 dask.array<shape=(6552, 4), chunksize=(1000, 4)>
    STATE_ID        (row) int32 dask.array<shape=(6552,), chunksize=(1000,)>
    TIME            (row) float64 dask.array<shape=(6552,), chunksize=(1000,)>
    TIME_CENTROID   (row) float64 dask.array<shape=(6552,), chunksize=(1000,)>
    UVW             (row, (u,v,w)) float64 dask.array<shape=(6552, 3), chunksize=(1000, 3)>
    WEIGHT          (row, corr) float32 dask.array<shape=(6552, 4), chunksize=(1000, 4)>
Attributes:
    FIELD_ID:      0
    DATA_DESC_ID:  0

Documentation

https://xarray-ms.readthedocs.io.

Limitations

  1. Many Measurement Sets columns are defined as variably shaped, but the actual data is fixed. xarray-ms will infer the shape of the data from the first row and must be consistent with that of other rows. For example, this may be issue where multiple Spectral Windows are present in the Measurement Set with differing channels per SPW.

    xarray-ms works around this by partitioning the Measurement Set into multiple datasets. The first row’s shape is used to infer the shape of the partition. Thus, in the case of multiple Spectral Window’s, we can partition the Measurement Set by DATA_DESC_ID to create a dataset for each Spectral Window.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xarray-ms-0.1.6.tar.gz (33.1 kB view details)

Uploaded Source

Built Distribution

xarray_ms-0.1.6-py2.py3-none-any.whl (28.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file xarray-ms-0.1.6.tar.gz.

File metadata

  • Download URL: xarray-ms-0.1.6.tar.gz
  • Upload date:
  • Size: 33.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for xarray-ms-0.1.6.tar.gz
Algorithm Hash digest
SHA256 9766f03e6ef716cc8ce5dd832020efc4030350d721134d78b7ff620ed65680c0
MD5 b37304d2fae678b79005575d7e0ce8e7
BLAKE2b-256 98f33ae06effd16646871daee96a95dfd5f9b1bd667c6c703db69cfa0c3a8d33

See more details on using hashes here.

File details

Details for the file xarray_ms-0.1.6-py2.py3-none-any.whl.

File metadata

  • Download URL: xarray_ms-0.1.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.3

File hashes

Hashes for xarray_ms-0.1.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e3fac9bc0646a922cb9370501e8047a6e7fd7af0408f41359bbd14d12120ea36
MD5 41eee6ee640c388a0f11977708278d79
BLAKE2b-256 5957399d42e1c8dd6509f693981b36a7ae7d6d8ac3334ef0b05dbc94167d5a4d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page