Add your description here
Project description
This package present an xarray view over observations in the MeerKAT archive.
Required Reading
You’ll need some familiarity with xarray. In particular:
Opening a dataset
Use xarray.open_datatree with engine="xarray-kat" (or let xarray infer the engine automatically from the URL). The call returns a xarray.DataTree whose children are the individual scans of the observation.
import xarray_kat # registers the "xarray-kat" engine
import xarray
token = "eyFILLMEIN"
capture_block_id = 1234567890
url = (
f"https://archive-gw-1.kat.ac.za/{capture_block_id}"
f"/{capture_block_id}_sdp_l0.full.rdb?token={token}"
)
dt = xarray.open_datatree(url, engine="xarray-kat", chunked_array_type="xarray-kat", chunks={})
Each child node is keyed "<capture_block_id>_<stream_name>/<scan_index>" and exposes the MSv4-style data variables:
VISIBILITY — complex correlator data, shape (time, baseline_id, frequency, polarization)
WEIGHT — per-sample weights, same shape as VISIBILITY
FLAG — per-sample flags, same shape as VISIBILITY
UVW — baseline UVW coordinates, shape (time, baseline_id, uvw)
Parameters
All keyword arguments below are passed through xarray.open_datatree.
- applycalstr or list of str, default ""
Calibration products to apply. Use "all" to apply every available product, an explicit list such as ["l1.G", "l1.B"] to apply specific products, or "" to skip calibration entirely.
- scan_statesiterable of str, default ("scan", "track")
Only scans whose activity-sensor state appears in this collection are included in the tree. Pass e.g. ("track",) to keep only tracking scans.
- uvw_sign_convention"casa" or "fourier", default "casa"
Sign convention for UVW coordinates. "casa" follows the antenna2 - antenna1 convention used by CASA and most radio-astronomy software. "fourier" uses the opposite sign.
- van_vleck"off" or "autocorr", default "off"
Van Vleck correction for the MeerKAT F-engine quantisation distortion. "autocorr" corrects autocorrelation amplitudes using the built-in lookup table; "off" leaves the data unchanged.
- preferred_chunksdict, optional
Preferred chunk sizes along named dimensions, e.g. {"time": 4, "frequency": 512}. These are hints; the engine uses the natural archive chunking where possible.
- capture_block_idstr, optional
Override the capture-block ID inferred from the RDB file. Rarely needed in normal use; useful when the ID embedded in the file differs from the one in the URL.
- stream_namestr, optional
Override the data-stream name inferred from the RDB file (e.g. "sdp_l0"). Useful when an observation contains multiple streams and you want to open a specific one.
Example Usage
Load a small observation entirely into memory:
import xarray_kat
import xarray
token = "eyFILLMEIN"
capture_block_id = 1234567890
url = (
f"https://archive-gw-1.kat.ac.za/{capture_block_id}"
f"/{capture_block_id}_sdp_l0.full.rdb?token={token}"
)
dt = xarray.open_datatree(url, chunked_array_type="xarray-kat", chunks={})
dt.load()
Select a subset of the data before loading:
ds = dt[f"{capture_block_id}_sdp_l0/0"].ds
ds = ds.isel(
time=slice(10, 20),
baseline_id=[1, 20, 30, 31, 32, 50],
frequency=slice(256, 768),
)
ds.load()
Apply calibration solutions and Van Vleck correction:
dt = xarray.open_datatree(
url,
chunked_array_type="xarray-kat",
chunks={},
applycal="all",
van_vleck="autocorr",
)
If dask is installed, request dask-backed chunks along specific dimensions:
# Natural (archive) chunking — most efficient
dt = xarray.open_datatree(url, chunks={})
dt = dt.compute()
# Custom chunking — may cause repeated archive requests for overlapping chunks;
# prefer rechunking on top of natural chunks, or use a cache pool
dt = xarray.open_datatree(
url, chunks={"time": 20, "baseline_id": 155, "frequency": 256}
)
dt = dt.compute()
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xarray_kat-0.0.4.tar.gz.
File metadata
- Download URL: xarray_kat-0.0.4.tar.gz
- Upload date:
- Size: 91.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3206671eb7fa8979768cd4fb04ed475cbabb2b6a8daa338543d738d3ee4986f3
|
|
| MD5 |
d5a9c198cd9ef545bde2882a0e6f2a34
|
|
| BLAKE2b-256 |
db736d88535eb2a697f66f800fc7353fd6a60410b57d419606ead4910ec4f2e3
|
Provenance
The following attestation bundles were made for xarray_kat-0.0.4.tar.gz:
Publisher:
ci.yml on ratt-ru/xarray-kat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xarray_kat-0.0.4.tar.gz -
Subject digest:
3206671eb7fa8979768cd4fb04ed475cbabb2b6a8daa338543d738d3ee4986f3 - Sigstore transparency entry: 1203449325
- Sigstore integration time:
-
Permalink:
ratt-ru/xarray-kat@e95f7d4a277ea2f44a41ba97bf471edabb87e8b8 -
Branch / Tag:
refs/tags/0.0.4 - Owner: https://github.com/ratt-ru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@e95f7d4a277ea2f44a41ba97bf471edabb87e8b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file xarray_kat-0.0.4-py3-none-any.whl.
File metadata
- Download URL: xarray_kat-0.0.4-py3-none-any.whl
- Upload date:
- Size: 110.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eeb9f5fcac5fbce7eda1fe5f266069de74c0b36d2e7dc54d3c753728da896b71
|
|
| MD5 |
ac39525f97b875ed89bf8a1660058dd2
|
|
| BLAKE2b-256 |
db4d9c67c157e4cbd9584ce5d74cee08e1b08d43af5d6c4592ce4ae419470712
|
Provenance
The following attestation bundles were made for xarray_kat-0.0.4-py3-none-any.whl:
Publisher:
ci.yml on ratt-ru/xarray-kat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xarray_kat-0.0.4-py3-none-any.whl -
Subject digest:
eeb9f5fcac5fbce7eda1fe5f266069de74c0b36d2e7dc54d3c753728da896b71 - Sigstore transparency entry: 1203449329
- Sigstore integration time:
-
Permalink:
ratt-ru/xarray-kat@e95f7d4a277ea2f44a41ba97bf471edabb87e8b8 -
Branch / Tag:
refs/tags/0.0.4 - Owner: https://github.com/ratt-ru
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@e95f7d4a277ea2f44a41ba97bf471edabb87e8b8 -
Trigger Event:
push
-
Statement type: