xradio 0.0.59__py3-none-any.whl → 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- xradio/_utils/list_and_array.py +4 -2
- xradio/image/_util/_casacore/xds_to_casacore.py +11 -4
- xradio/image/image.py +4 -2
- xradio/measurement_set/_utils/_msv2/conversion.py +36 -15
- xradio/measurement_set/_utils/_msv2/create_field_and_source_xds.py +3 -1
- xradio/measurement_set/_utils/_msv2/msv4_info_dicts.py +214 -67
- xradio/measurement_set/_utils/_msv2/partition_queries.py +248 -61
- xradio/measurement_set/convert_msv2_to_processing_set.py +28 -10
- xradio/measurement_set/measurement_set_xdt.py +14 -4
- xradio/measurement_set/open_processing_set.py +6 -6
- xradio/measurement_set/processing_set_xdt.py +69 -12
- xradio/measurement_set/schema.py +137 -180
- xradio/schema/__init__.py +0 -3
- xradio/schema/bases.py +23 -28
- xradio/schema/check.py +23 -15
- xradio/schema/common.py +45 -0
- xradio/schema/export.py +23 -2
- xradio/schema/metamodel.py +12 -8
- xradio/schema/typing.py +7 -13
- {xradio-0.0.59.dist-info → xradio-1.0.0.dist-info}/METADATA +3 -3
- {xradio-0.0.59.dist-info → xradio-1.0.0.dist-info}/RECORD +24 -23
- {xradio-0.0.59.dist-info → xradio-1.0.0.dist-info}/WHEEL +0 -0
- {xradio-0.0.59.dist-info → xradio-1.0.0.dist-info}/licenses/LICENSE.txt +0 -0
- {xradio-0.0.59.dist-info → xradio-1.0.0.dist-info}/top_level.txt +0 -0
xradio/schema/bases.py
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Class decorators to generate schemas from suitably annotated Python
|
|
3
|
+
class definition. This approach was essentially
|
|
4
|
+
copied from https://pypi.org/project/xarray-dataclasses/, though our
|
|
5
|
+
implementation differs in a number of critical ways:
|
|
6
|
+
|
|
7
|
+
* We use custom decorators on the classes instead of base classes. This
|
|
8
|
+
especially overrides the existing constructor, which makes it easier to
|
|
9
|
+
directly construct instances and allows for extra data variables
|
|
10
|
+
and attributes.
|
|
11
|
+
|
|
12
|
+
* We support multiple options for types and dimensions
|
|
13
|
+
|
|
14
|
+
* We convert the schema definition into our own meta-model, which facilitates
|
|
15
|
+
generating documentation generation using Sphinx
|
|
16
|
+
"""
|
|
17
|
+
|
|
1
18
|
import xarray
|
|
2
19
|
import inspect
|
|
3
20
|
from . import dataclass, check, metamodel, typing
|
|
@@ -166,12 +183,12 @@ def xarray_dataarray_schema(cls):
|
|
|
166
183
|
"""Decorator for classes representing :py:class:`xarray.DataArray` schemas.
|
|
167
184
|
The annotated class should exactly contain:
|
|
168
185
|
|
|
169
|
-
* one field called "``data``" annotated with :py:data:`~typing.Data`
|
|
186
|
+
* one field called "``data``" annotated with :py:data:`~xradio.schema.typing.Data`
|
|
170
187
|
to indicate the array type
|
|
171
|
-
* fields annotated with :py:data:`~typing.Coord` to indicate mappings of
|
|
188
|
+
* fields annotated with :py:data:`~xradio.schema.typing.Coord` to indicate mappings of
|
|
172
189
|
dimensions to coordinates (coordinates directly associated with dimensions
|
|
173
190
|
should have the same name as the dimension)
|
|
174
|
-
* fields annotated with :py:data:`~typing.Attr` to declare attributes
|
|
191
|
+
* fields annotated with :py:data:`~xradio.schema.typing.Attr` to declare attributes
|
|
175
192
|
|
|
176
193
|
Decorated schema classes can be used with
|
|
177
194
|
:py:func:`~xradio.schema.check.check_array` for checking
|
|
@@ -254,10 +271,6 @@ def is_dataarray_schema(val: typing.Any):
|
|
|
254
271
|
return type(val) == type and hasattr(val, "__xradio_array_schema")
|
|
255
272
|
|
|
256
273
|
|
|
257
|
-
class AsDataArray:
|
|
258
|
-
__new__ = _dataarray_new
|
|
259
|
-
|
|
260
|
-
|
|
261
274
|
def _dataset_new(cls, *args, data_vars=None, coords=None, attrs=None, **kwargs):
|
|
262
275
|
# Get standard xarray parameters (data_vars, coords, attrs)
|
|
263
276
|
# Note that we only support these as keyword arguments for now
|
|
@@ -379,12 +392,12 @@ def xarray_dataset_schema(cls):
|
|
|
379
392
|
"""Decorator for classes representing :py:class:`xarray.Dataset` schemas.
|
|
380
393
|
The annotated class should exactly contain:
|
|
381
394
|
|
|
382
|
-
* fields annotated with :py:data:`~typing.Coord` to indicate mappings of
|
|
395
|
+
* fields annotated with :py:data:`~xradio.schema.typing.Coord` to indicate mappings of
|
|
383
396
|
dimensions to coordinates (coordinates directly associated with dimensions
|
|
384
397
|
should have the same name as the dimension)
|
|
385
|
-
* fields annotated with :py:data:`~typing.Data`
|
|
398
|
+
* fields annotated with :py:data:`~xradio.schema.typing.Data`
|
|
386
399
|
to indicate data variables
|
|
387
|
-
* fields annotated with :py:data:`~typing.Attr` to declare attributes
|
|
400
|
+
* fields annotated with :py:data:`~xradio.schema.typing.Attr` to declare attributes
|
|
388
401
|
|
|
389
402
|
Decorated schema classes can be used with
|
|
390
403
|
:py:func:`~xradio.schema.check.check_dataset` for checking
|
|
@@ -413,15 +426,6 @@ def is_dataset_schema(val: typing.Any):
|
|
|
413
426
|
return type(val) == type and hasattr(val, "__xradio_dataset_schema")
|
|
414
427
|
|
|
415
428
|
|
|
416
|
-
class AsDataset:
|
|
417
|
-
"""Mix-in class to indicate dataset data classes
|
|
418
|
-
|
|
419
|
-
Deprecated - use decorator :py:func:`xarray_dataset_schema` instead
|
|
420
|
-
"""
|
|
421
|
-
|
|
422
|
-
__new__ = _dataset_new
|
|
423
|
-
|
|
424
|
-
|
|
425
429
|
def _dict_new(cls, *args, **kwargs):
|
|
426
430
|
# Get signature of __init__, map parameters and apply defaults. This
|
|
427
431
|
# will raise an exception if there are any extra parameters.
|
|
@@ -466,12 +470,3 @@ def dict_schema(cls):
|
|
|
466
470
|
|
|
467
471
|
def is_dict_schema(val: typing.Any):
|
|
468
472
|
return type(val) == type and hasattr(val, "__xradio_dict_schema")
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
class AsDict:
|
|
472
|
-
"""Mix-in class to indicate dictionary data classes
|
|
473
|
-
|
|
474
|
-
Deprecated - use decorator :py:func:`dict_schema` instead
|
|
475
|
-
"""
|
|
476
|
-
|
|
477
|
-
__new__ = _dict_new
|
xradio/schema/check.py
CHANGED
|
@@ -77,7 +77,7 @@ class SchemaIssues(Exception):
|
|
|
77
77
|
in one go.
|
|
78
78
|
"""
|
|
79
79
|
|
|
80
|
-
issues: [SchemaIssue]
|
|
80
|
+
issues: list[SchemaIssue]
|
|
81
81
|
"""List of issues found"""
|
|
82
82
|
|
|
83
83
|
def __init__(self, issues=None):
|
|
@@ -147,8 +147,8 @@ def check_array(
|
|
|
147
147
|
Check whether an xarray DataArray conforms to a schema
|
|
148
148
|
|
|
149
149
|
:param array: DataArray to check
|
|
150
|
-
:param schema: Schema to check against
|
|
151
|
-
:returns:
|
|
150
|
+
:param schema: Schema to check against
|
|
151
|
+
:returns: :py:class:`SchemaIssues` found
|
|
152
152
|
"""
|
|
153
153
|
|
|
154
154
|
# Check that this is actually a DataArray
|
|
@@ -185,8 +185,8 @@ def check_dataset(
|
|
|
185
185
|
Check whether an xarray DataArray conforms to a schema
|
|
186
186
|
|
|
187
187
|
:param array: DataArray to check
|
|
188
|
-
:param schema: Schema to check against
|
|
189
|
-
:returns:
|
|
188
|
+
:param schema: Schema to check against
|
|
189
|
+
:returns: :py:class:`SchemaIssues` found
|
|
190
190
|
"""
|
|
191
191
|
|
|
192
192
|
# Check that this is actually a Dataset
|
|
@@ -233,7 +233,7 @@ def check_dimensions(
|
|
|
233
233
|
:param array: Dimension list to check
|
|
234
234
|
:param schema: Expected possibilities for dimension list
|
|
235
235
|
:param check_order: Whether to check order of dimensions
|
|
236
|
-
:returns:
|
|
236
|
+
:returns: :py:class:`SchemaIssues` found
|
|
237
237
|
"""
|
|
238
238
|
|
|
239
239
|
# Find a dimension list that matches
|
|
@@ -295,7 +295,7 @@ def check_dtype(dtype: numpy.dtype, expected: [numpy.dtype]) -> SchemaIssues:
|
|
|
295
295
|
|
|
296
296
|
:param dtype: Numeric type to check
|
|
297
297
|
:param schema: Expected possibilities for dtype
|
|
298
|
-
:returns:
|
|
298
|
+
:returns: :py:class:`SchemaIssues` found
|
|
299
299
|
"""
|
|
300
300
|
|
|
301
301
|
for exp_dtype_str in expected:
|
|
@@ -333,7 +333,7 @@ def check_attributes(
|
|
|
333
333
|
|
|
334
334
|
:param attrs: Dictionary of attributes
|
|
335
335
|
:param attrs_schema: Expected schemas
|
|
336
|
-
:returns:
|
|
336
|
+
:returns: :py:class:`SchemaIssues` found
|
|
337
337
|
"""
|
|
338
338
|
|
|
339
339
|
issues = SchemaIssues()
|
|
@@ -367,7 +367,7 @@ def check_data_vars(
|
|
|
367
367
|
data_var_kind: str,
|
|
368
368
|
) -> SchemaIssues:
|
|
369
369
|
"""
|
|
370
|
-
Check whether
|
|
370
|
+
Check whether a data variable set conforms to a schema
|
|
371
371
|
|
|
372
372
|
As data variables are data arrays, this will recurse into checking the
|
|
373
373
|
array schemas
|
|
@@ -375,7 +375,7 @@ def check_data_vars(
|
|
|
375
375
|
:param data_vars: Dictionary(-like) of data_varinates
|
|
376
376
|
:param data_vars_schema: Expected schemas
|
|
377
377
|
:param datavar_kind: Either 'coords' or 'data_vars'
|
|
378
|
-
:returns:
|
|
378
|
+
:returns: :py:class:`SchemaIssues` found
|
|
379
379
|
"""
|
|
380
380
|
|
|
381
381
|
assert data_var_kind in ["coords", "data_vars"]
|
|
@@ -434,6 +434,14 @@ def check_data_vars(
|
|
|
434
434
|
def check_dict(
|
|
435
435
|
dct: dict, schema: typing.Union[type, metamodel.DictSchema]
|
|
436
436
|
) -> SchemaIssues:
|
|
437
|
+
"""
|
|
438
|
+
Check whether a dictionary conforms to a schema
|
|
439
|
+
|
|
440
|
+
:param dct: Dictionary to check
|
|
441
|
+
:param schema: Dictionary schema to check against
|
|
442
|
+
:returns: :py:class:`SchemaIssues` found
|
|
443
|
+
"""
|
|
444
|
+
|
|
437
445
|
# Check that this is actually a dictionary
|
|
438
446
|
if not isinstance(dct, dict):
|
|
439
447
|
raise TypeError(f"check_dict: Expected dictionary, but got {type(dct)}!")
|
|
@@ -588,13 +596,13 @@ def check_datatree(
|
|
|
588
596
|
"""
|
|
589
597
|
Check datatree for schema conformance
|
|
590
598
|
|
|
591
|
-
This is the case if
|
|
592
|
-
|
|
593
|
-
This
|
|
599
|
+
This is the case if each contained :py:class:`~xarray.Dataset` conforms to a schema
|
|
600
|
+
registed with Xradio.
|
|
601
|
+
This works by looking for a ``type`` attribute in the :py:class:`~xarray.Dataset`, which
|
|
594
602
|
must have a :py:class:`typing.Literal` type annotation specifying
|
|
595
|
-
the
|
|
603
|
+
the name of the dataset schema.
|
|
596
604
|
|
|
597
|
-
:param
|
|
605
|
+
:param datatree: Data to check for schema conformance
|
|
598
606
|
"""
|
|
599
607
|
|
|
600
608
|
# Loop through all groups in datatree
|
xradio/schema/common.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Literal, Optional, Union, List
|
|
4
|
+
from xradio.schema.bases import (
|
|
5
|
+
xarray_dataset_schema,
|
|
6
|
+
xarray_dataarray_schema,
|
|
7
|
+
dict_schema,
|
|
8
|
+
)
|
|
9
|
+
from xradio.schema.typing import Attr, Coord, Coordof, Data, Dataof, Name
|
|
10
|
+
import numpy
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
# Dimensions
|
|
14
|
+
Time = Literal["time"]
|
|
15
|
+
""" Observation time dimension """
|
|
16
|
+
Frequency = Literal["frequency"]
|
|
17
|
+
""" Frequency dimension """
|
|
18
|
+
FrequencySystemCal = Literal["frequency_system_cal"]
|
|
19
|
+
""" Frequency dimension in the system calibration dataset """
|
|
20
|
+
Polarization = Literal["polarization"]
|
|
21
|
+
""" Polarization dimension """
|
|
22
|
+
UvwLabel = Literal["uvw_label"]
|
|
23
|
+
""" Coordinate dimension of UVW data (typically shape 3 for 'u', 'v', 'w') """
|
|
24
|
+
SkyDirLabel = Literal["sky_dir_label"]
|
|
25
|
+
""" Coordinate labels of sky directions (typically shape 2 and 'ra', 'dec') """
|
|
26
|
+
LocalSkyDirLabel = Literal["local_sky_dir_label"]
|
|
27
|
+
""" Coordinate labels of local sky directions (typically shape 2 and 'az', 'alt') """
|
|
28
|
+
SphericalDirLabel = Literal["spherical_dir_label"]
|
|
29
|
+
""" Coordinate labels of spherical directions (shape 2 and 'lon', 'lat1' """
|
|
30
|
+
SkyPosLabel = Literal["sky_pos_label"]
|
|
31
|
+
""" Coordinate labels of sky positions (typically shape 3 and 'ra', 'dec', 'dist') """
|
|
32
|
+
SphericalPosLabel = Literal["spherical_pos_label"]
|
|
33
|
+
""" Coordinate labels of spherical positions (shape shape 3 and 'lon', 'lat1', 'dist2') """
|
|
34
|
+
EllipsoidPosLabel = Literal["ellipsoid_pos_label"]
|
|
35
|
+
""" Coordinate labels of geodetic earth location data (typically shape 3 and 'lon', 'lat', 'height')"""
|
|
36
|
+
CartesianPosLabel = Literal["cartesian_pos_label"]
|
|
37
|
+
""" Coordinate labels of geocentric earth location data (typically shape 3 and 'x', 'y', 'z')"""
|
|
38
|
+
nPolynomial = Literal["n_polynomial"]
|
|
39
|
+
""" For data that is represented as variable in time using Taylor expansion """
|
|
40
|
+
PolyTerm = Literal["poly_term"]
|
|
41
|
+
""" Polynomial term used in VLBI GAIN_CURVE """
|
|
42
|
+
LineLabel = Literal["line_label"]
|
|
43
|
+
""" Line labels (for line names and variables). """
|
|
44
|
+
FieldName = Literal["field_name"]
|
|
45
|
+
""" Field names dimension. """
|
xradio/schema/export.py
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Functions to import and export :py:class:`xradio.schema.metamodel.DatasetSchema`
|
|
3
|
+
as JSON representation. This can be used to externalise schema checks, or
|
|
4
|
+
generate documentation from schemas in JSON representation.
|
|
5
|
+
"""
|
|
6
|
+
|
|
1
7
|
import dataclasses
|
|
2
8
|
import json
|
|
3
9
|
|
|
@@ -9,6 +15,8 @@ from xradio.schema import (
|
|
|
9
15
|
xarray_dataclass_to_dict_schema,
|
|
10
16
|
)
|
|
11
17
|
|
|
18
|
+
__all__ = ["export_schema_json_file", "import_schema_json_file"]
|
|
19
|
+
|
|
12
20
|
CLASS_ATTR = "$class"
|
|
13
21
|
|
|
14
22
|
|
|
@@ -75,9 +83,12 @@ class DataclassDecoder(json.JSONDecoder):
|
|
|
75
83
|
return obj
|
|
76
84
|
|
|
77
85
|
|
|
78
|
-
def export_schema_json_file(schema, fname):
|
|
86
|
+
def export_schema_json_file(schema: "DatasetSchema", fname: str):
|
|
79
87
|
"""
|
|
80
88
|
Exports given schema as a JSON file
|
|
89
|
+
|
|
90
|
+
:param schema: Dataset schema. Dataclasses will be converted automatically.
|
|
91
|
+
:param fname: File name to write serialised schema to
|
|
81
92
|
"""
|
|
82
93
|
|
|
83
94
|
# Check that this is actually a Dataset
|
|
@@ -93,7 +104,17 @@ def export_schema_json_file(schema, fname):
|
|
|
93
104
|
json.dump(schema, f, cls=DataclassEncoder, ensure_ascii=False, indent=" ")
|
|
94
105
|
|
|
95
106
|
|
|
96
|
-
def import_schema_json_file(fname):
|
|
107
|
+
def import_schema_json_file(fname: str):
|
|
108
|
+
"""
|
|
109
|
+
Imports a schema from a JSON file
|
|
110
|
+
|
|
111
|
+
For JSON files generated by
|
|
112
|
+
:py:func:`export_schema_json_file`, this will return a
|
|
113
|
+
:py:class:`~xradio.schema.metamodel.DatasetSchema`.
|
|
114
|
+
|
|
115
|
+
:param fname: File name to load
|
|
116
|
+
:returns: Deserialised object
|
|
117
|
+
"""
|
|
97
118
|
|
|
98
119
|
with open(fname, "r", encoding="utf8") as f:
|
|
99
120
|
return json.load(f, cls=DataclassDecoder, dataclass_map=DATACLASS_MAP)
|
xradio/schema/metamodel.py
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Data classes used by Xradio routines to represent dataset schemas.
|
|
3
|
+
"""
|
|
4
|
+
|
|
1
5
|
from __future__ import annotations
|
|
2
6
|
|
|
3
7
|
from dataclasses import dataclass, MISSING
|
|
@@ -62,7 +66,7 @@ class AttrSchemaRef(ValueSchema):
|
|
|
62
66
|
name: str = ""
|
|
63
67
|
"""Name of attribute as given in data array / dataset."""
|
|
64
68
|
default: typing.Optional[typing.Any] = None
|
|
65
|
-
"""If optional:
|
|
69
|
+
"""If optional: what is the default value?"""
|
|
66
70
|
docstring: str = ""
|
|
67
71
|
"""Documentation string of attribute reference"""
|
|
68
72
|
|
|
@@ -108,7 +112,7 @@ class ArraySchema:
|
|
|
108
112
|
"""
|
|
109
113
|
return not self.coordinates
|
|
110
114
|
|
|
111
|
-
def required_dimensions(self) -> [str]:
|
|
115
|
+
def required_dimensions(self) -> list[str]:
|
|
112
116
|
"""
|
|
113
117
|
Returns set of dimensions that is always required
|
|
114
118
|
"""
|
|
@@ -133,7 +137,7 @@ class ArraySchemaRef(ArraySchema):
|
|
|
133
137
|
optional: bool
|
|
134
138
|
"""Is the data array optional?"""
|
|
135
139
|
default: typing.Optional[typing.Any] = None
|
|
136
|
-
"""If optional:
|
|
140
|
+
"""If optional: what is the default value?"""
|
|
137
141
|
docstring: typing.Optional[str] = None
|
|
138
142
|
"""Documentation string of array reference"""
|
|
139
143
|
|
|
@@ -147,13 +151,13 @@ class DatasetSchema:
|
|
|
147
151
|
schema_name: str
|
|
148
152
|
"""(Class) name of the schema"""
|
|
149
153
|
|
|
150
|
-
dimensions: [[str]]
|
|
154
|
+
dimensions: list[list[str]]
|
|
151
155
|
"""List of possible dimensions (derived from data arrays)"""
|
|
152
|
-
coordinates: [ArraySchemaRef]
|
|
156
|
+
coordinates: list[ArraySchemaRef]
|
|
153
157
|
"""List of coordinate data arrays"""
|
|
154
|
-
data_vars: [ArraySchemaRef]
|
|
158
|
+
data_vars: list[ArraySchemaRef]
|
|
155
159
|
"""List of data arrays"""
|
|
156
|
-
attributes: [AttrSchemaRef]
|
|
160
|
+
attributes: list[AttrSchemaRef]
|
|
157
161
|
"""List of attributes"""
|
|
158
162
|
|
|
159
163
|
class_docstring: typing.Optional[str]
|
|
@@ -169,7 +173,7 @@ class DictSchema:
|
|
|
169
173
|
schema_name: str
|
|
170
174
|
"""(Class) name of the schema"""
|
|
171
175
|
|
|
172
|
-
attributes: [AttrSchemaRef]
|
|
176
|
+
attributes: list[AttrSchemaRef]
|
|
173
177
|
"""List of attributes"""
|
|
174
178
|
|
|
175
179
|
class_docstring: typing.Optional[str]
|
xradio/schema/typing.py
CHANGED
|
@@ -117,7 +117,7 @@ Example:
|
|
|
117
117
|
::
|
|
118
118
|
|
|
119
119
|
@dataclass
|
|
120
|
-
class Image(
|
|
120
|
+
class Image():
|
|
121
121
|
data: Data[tuple[X, Y], float]
|
|
122
122
|
long_name: Attr[str] = "luminance"
|
|
123
123
|
units: Attr[str] = "cd / m^2"
|
|
@@ -140,7 +140,7 @@ Example:
|
|
|
140
140
|
::
|
|
141
141
|
|
|
142
142
|
@dataclass
|
|
143
|
-
class Image(
|
|
143
|
+
class Image():
|
|
144
144
|
data: Data[tuple[X, Y], float]
|
|
145
145
|
mask: Coord[tuple[X, Y], bool]
|
|
146
146
|
x: Coord[X, int] = 0
|
|
@@ -174,14 +174,11 @@ Example:
|
|
|
174
174
|
|
|
175
175
|
|
|
176
176
|
@dataclass
|
|
177
|
-
class Image(
|
|
177
|
+
class Image():
|
|
178
178
|
data: Data[tuple[X, Y], float]
|
|
179
179
|
x: Coordof[XAxis] = 0
|
|
180
180
|
y: Coordof[YAxis] = 0
|
|
181
181
|
|
|
182
|
-
Hint:
|
|
183
|
-
A class used in ``Coordof`` does not need to inherit ``AsDataArray``.
|
|
184
|
-
|
|
185
182
|
"""
|
|
186
183
|
|
|
187
184
|
Data = Annotated[Union[Labeled[TDims], Collection[TDType], TDType], Role.DATA]
|
|
@@ -192,13 +189,13 @@ Example:
|
|
|
192
189
|
(the second and subsequent data fields are just ignored)::
|
|
193
190
|
|
|
194
191
|
@dataclass
|
|
195
|
-
class Image(
|
|
192
|
+
class Image():
|
|
196
193
|
data: Data[tuple[X, Y], float]
|
|
197
194
|
|
|
198
195
|
Multiple data fields are allowed in a Dataset class::
|
|
199
196
|
|
|
200
197
|
@dataclass
|
|
201
|
-
class ColorImage(
|
|
198
|
+
class ColorImage():
|
|
202
199
|
red: Data[tuple[X, Y], float]
|
|
203
200
|
green: Data[tuple[X, Y], float]
|
|
204
201
|
blue: Data[tuple[X, Y], float]
|
|
@@ -222,14 +219,11 @@ Example:
|
|
|
222
219
|
|
|
223
220
|
|
|
224
221
|
@dataclass
|
|
225
|
-
class ColorImage(
|
|
222
|
+
class ColorImage():
|
|
226
223
|
red: Dataof[Image]
|
|
227
224
|
green: Dataof[Image]
|
|
228
225
|
blue: Dataof[Image]
|
|
229
226
|
|
|
230
|
-
Hint:
|
|
231
|
-
A class used in ``Dataof`` does not need to inherit ``AsDataArray``.
|
|
232
|
-
|
|
233
227
|
"""
|
|
234
228
|
|
|
235
229
|
Name = Annotated[THashable, Role.NAME]
|
|
@@ -239,7 +233,7 @@ Example:
|
|
|
239
233
|
::
|
|
240
234
|
|
|
241
235
|
@dataclass
|
|
242
|
-
class Image(
|
|
236
|
+
class Image():
|
|
243
237
|
data: Data[tuple[X, Y], float]
|
|
244
238
|
name: Name[str] = "image"
|
|
245
239
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xradio
|
|
3
|
-
Version: 0.0
|
|
3
|
+
Version: 1.0.0
|
|
4
4
|
Summary: Xarray Radio Astronomy Data IO
|
|
5
5
|
Author-email: Jan-Willem Steeb <jsteeb@nrao.edu>, Federico Montesino Pouzols <pouzols@eso.edu>, Dave Mehringer <dmehring@nrao.edu>, Peter Wortmann <peter.wortmann@skao.int>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -110,10 +110,10 @@ Xarray Radio Astronomy Data IO is still in development.
|
|
|
110
110
|
# Installing
|
|
111
111
|
XRADIO can be installed in virtual environments via pip. It is recommended to use the conda environment manager from [miniforge](https://github.com/conda-forge/miniforge) to create a clean, self-contained runtime where XRADIO and all its dependencies can be installed, for example:
|
|
112
112
|
```sh
|
|
113
|
-
conda create --name xradio python=3.
|
|
113
|
+
conda create --name xradio python=3.13 --no-default-packages
|
|
114
114
|
conda activate xradio
|
|
115
115
|
```
|
|
116
|
-
> 📝 On macOS it is required to pre-install `python-casacore
|
|
116
|
+
> 📝 On macOS, if one wants to use the functions to convert MSv2=>MSv4, it is required to pre-install `python-casacore`. That can be done using `conda install -c conda-forge python-casacore`. See more alternatives below.
|
|
117
117
|
|
|
118
118
|
XRADIO can now be installed using:
|
|
119
119
|
```sh
|
|
@@ -2,14 +2,14 @@ xradio/__init__.py,sha256=YTpM274ZBWK14HmIXyah27yiKPsmR6xCILvlXkQrYG4,387
|
|
|
2
2
|
xradio/_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
xradio/_utils/coord_math.py,sha256=ZdbgStXqQ_HS7qQ9UBPk8Z3Zse5P_DrYQsgn2UCf22U,3342
|
|
4
4
|
xradio/_utils/dict_helpers.py,sha256=a4veG6Dgwmtb9yO0kV9qvcQ9IZAKKrC9rAJ_m4EukcE,4072
|
|
5
|
-
xradio/_utils/list_and_array.py,sha256=
|
|
5
|
+
xradio/_utils/list_and_array.py,sha256=eRatx-Tt6IQC6NCxK38WHP5OlloQcKZWxEoNDHeTAOE,4375
|
|
6
6
|
xradio/_utils/schema.py,sha256=OYfAljwNU94KyxGSpKuKxSzSdebW6T43RkMA13aTaeU,7615
|
|
7
7
|
xradio/_utils/_casacore/casacore_from_casatools.py,sha256=ugmWEIzJbuXsPDgJbtuzv0qSXx5Vybu8Sp73NAFt5oQ,31207
|
|
8
8
|
xradio/_utils/_casacore/tables.py,sha256=puRidbjtVx6caEG_Z5TebTLdTUbtBUhzvqByKLQTHfo,1389
|
|
9
9
|
xradio/_utils/zarr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
10
10
|
xradio/_utils/zarr/common.py,sha256=rqqGAogp75xCE9ZiUvV-cU2n4aOw2qHycKh0F_EW518,2964
|
|
11
11
|
xradio/image/__init__.py,sha256=HAD0GfopIbhdxOYckyW6S9US_dSWmZrwIl3FHUzZwrE,435
|
|
12
|
-
xradio/image/image.py,sha256=
|
|
12
|
+
xradio/image/image.py,sha256=qhmacJ1C60ccpSEpz6ofWMP3fg47VO9rCGyh9OSHTao,16774
|
|
13
13
|
xradio/image/_util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
14
|
xradio/image/_util/casacore.py,sha256=_o8767_zYGbXMqqN4k4clq2VhfgEls09h2WXInKEFe0,4615
|
|
15
15
|
xradio/image/_util/common.py,sha256=VGJ21x-Uifk9kf_O6o7URwesYInVZeMh1RLCXQOlgq0,8428
|
|
@@ -18,29 +18,29 @@ xradio/image/_util/zarr.py,sha256=lhQqVRC1GEWClG3zRbuDr2IlQBfXeDqaLUJIN-MVMxA,16
|
|
|
18
18
|
xradio/image/_util/_casacore/__init__.py,sha256=OlsiRE40o1jSbBI4khgQQzgfDYbAlOMKIhO4UFlbGhg,41
|
|
19
19
|
xradio/image/_util/_casacore/common.py,sha256=2a88YrveQY9x8bcM7SQSn-L5y60W92rLW34OXC5VwSs,1764
|
|
20
20
|
xradio/image/_util/_casacore/xds_from_casacore.py,sha256=egL5pavyYs66sAHuWQGywnZUmaSle1IPtHSPeG25F1M,43731
|
|
21
|
-
xradio/image/_util/_casacore/xds_to_casacore.py,sha256=
|
|
21
|
+
xradio/image/_util/_casacore/xds_to_casacore.py,sha256=Z4wZJ4A9nydiLJyf49XTu64Ii3rxVCAB026UA-PVZwg,18276
|
|
22
22
|
xradio/image/_util/_fits/xds_from_fits.py,sha256=DsuKAer43rWwDjA9gFNs2sCqFrFVdFW6O0i21RVZzzE,34654
|
|
23
23
|
xradio/image/_util/_zarr/common.py,sha256=ltlj3uFa-uv8lXlDtV79QnfNmfm0tyhXN5FDAjZtjzg,308
|
|
24
24
|
xradio/image/_util/_zarr/xds_from_zarr.py,sha256=KMsfaSSm9kyVoztS6pUzGNxMZzQnCxkk0kDv2GxW5Kw,4451
|
|
25
25
|
xradio/image/_util/_zarr/xds_to_zarr.py,sha256=nsDvDD-kuMuMF2dDlj0jTxSW4mdR-jjIsvXHi5uIERU,2373
|
|
26
26
|
xradio/image/_util/_zarr/zarr_low_level.py,sha256=xnYm6EmVbmLxMlOSXH32SABfQBLHfr2H9ch9gYwFNXs,13338
|
|
27
27
|
xradio/measurement_set/__init__.py,sha256=rGhy9tz5d60hln-SSWFLieDrZ2sodli3npKuCEQc8bc,1127
|
|
28
|
-
xradio/measurement_set/convert_msv2_to_processing_set.py,sha256=
|
|
28
|
+
xradio/measurement_set/convert_msv2_to_processing_set.py,sha256=B-TpUHtouokl3sdwEVqreBmgQOtmLSG7i6bQ5Jj3FQw,10519
|
|
29
29
|
xradio/measurement_set/load_processing_set.py,sha256=r_eO7DTr-3EphujOEh-P_VfcVRpYzx1M-tGBwpxFC-8,8201
|
|
30
|
-
xradio/measurement_set/measurement_set_xdt.py,sha256=
|
|
31
|
-
xradio/measurement_set/open_processing_set.py,sha256=
|
|
32
|
-
xradio/measurement_set/processing_set_xdt.py,sha256=
|
|
33
|
-
xradio/measurement_set/schema.py,sha256=
|
|
30
|
+
xradio/measurement_set/measurement_set_xdt.py,sha256=xzn61zznJ7r3rGdeFMPA9Syy3i06ML4PZJy5iB9RbvY,12598
|
|
31
|
+
xradio/measurement_set/open_processing_set.py,sha256=LA9eTN0M9SzK0yrWeHHVVRxrqHq1MF0eHkqR46OOLm8,5296
|
|
32
|
+
xradio/measurement_set/processing_set_xdt.py,sha256=J4RB58xBcONLxkyFa5d8FDzSINxF9hJfZeJBrHLRXG4,36837
|
|
33
|
+
xradio/measurement_set/schema.py,sha256=ZH0n8lZTD8fi3JEZV2SEwdh1oRo1ric__uZ9o8p3AUE,89149
|
|
34
34
|
xradio/measurement_set/_utils/__init__.py,sha256=iTbgPiQPw9hyXSdQYPcwGRrP2PFXgF6CZi8A3KNKya0,43
|
|
35
35
|
xradio/measurement_set/_utils/_msv2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
36
|
-
xradio/measurement_set/_utils/_msv2/conversion.py,sha256=
|
|
36
|
+
xradio/measurement_set/_utils/_msv2/conversion.py,sha256=og8-gu9fMSXfW2a1l9hWZhE8HNNNukHX4o1ROyNFk7w,54871
|
|
37
37
|
xradio/measurement_set/_utils/_msv2/create_antenna_xds.py,sha256=s3HnTbyOl7h6pAocJ4dpd095s7qHSSngeQ34Ygo8Uk0,17650
|
|
38
|
-
xradio/measurement_set/_utils/_msv2/create_field_and_source_xds.py,sha256=
|
|
38
|
+
xradio/measurement_set/_utils/_msv2/create_field_and_source_xds.py,sha256=k5pJhIafu9QANaX9-pdJ1fOqGOtplHxR2Ve9xBCf3dA,33557
|
|
39
39
|
xradio/measurement_set/_utils/_msv2/msv2_to_msv4_meta.py,sha256=ZpxJJ2yTjjEy6A4XWS9eT-1J92jLwR8CNyoDBfhAVm8,1572
|
|
40
|
-
xradio/measurement_set/_utils/_msv2/msv4_info_dicts.py,sha256=
|
|
40
|
+
xradio/measurement_set/_utils/_msv2/msv4_info_dicts.py,sha256=cMgD6EB1pRShL6TBVSpom0VhkqTnsYNi9vxz_gfgGtU,11952
|
|
41
41
|
xradio/measurement_set/_utils/_msv2/msv4_sub_xdss.py,sha256=6BXZkypfe1C4n5bQDtxMdY0qnVuO3DDjtwDLUwtUOow,30453
|
|
42
42
|
xradio/measurement_set/_utils/_msv2/optimised_functions.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
43
|
-
xradio/measurement_set/_utils/_msv2/partition_queries.py,sha256=
|
|
43
|
+
xradio/measurement_set/_utils/_msv2/partition_queries.py,sha256=_eWxxgxEYRX1Pj1ZFHD_HIcrF9Rpfe6OJmp3uYJ2UiY,11970
|
|
44
44
|
xradio/measurement_set/_utils/_msv2/subtables.py,sha256=mrf7g7mbC4crtnQ0wFocPcFRNlvq_7e7iDzE5B6ugl4,843
|
|
45
45
|
xradio/measurement_set/_utils/_msv2/_tables/read.py,sha256=tW0ROevR4tXpydIWuj2UyNhWNtvkKU9NkYxMi1ZoVKc,45421
|
|
46
46
|
xradio/measurement_set/_utils/_msv2/_tables/read_main_table.py,sha256=FFoTVpY8JNvcXnTvUiraWNU9gB9-_9GR7he0NbODabg,3168
|
|
@@ -49,17 +49,18 @@ xradio/measurement_set/_utils/_utils/interpolate.py,sha256=LlDYi-h7aj_tsuZqAu5Kr
|
|
|
49
49
|
xradio/measurement_set/_utils/_utils/partition_attrs.py,sha256=JaePHts_A0EbB4K-0a_uC98RZ2EmfjB9pDSEI11oAwk,3401
|
|
50
50
|
xradio/measurement_set/_utils/_utils/stokes_types.py,sha256=DMa8TmmS7BQ99Xm8c7ZjcRapMtLbrKVxrt4f0qUIOvg,561
|
|
51
51
|
xradio/measurement_set/_utils/_zarr/encoding.py,sha256=ze5ncHEBa-sVwJCayJa2irOdaxZEkYfBKObuij7uVRc,371
|
|
52
|
-
xradio/schema/__init__.py,sha256=
|
|
53
|
-
xradio/schema/bases.py,sha256=
|
|
54
|
-
xradio/schema/check.py,sha256=
|
|
52
|
+
xradio/schema/__init__.py,sha256=tJqTUSwkwvkak_6eAZqhT5BQqunlfxciG07-y8uSrMY,683
|
|
53
|
+
xradio/schema/bases.py,sha256=TRwvOo2UA7ki-yV1Vcb5aDxAAxH2lTKtwoGx2m5VB4o,17512
|
|
54
|
+
xradio/schema/check.py,sha256=oMOEeI4S_PTvWdMJA-_-LRUULykxZmy7cu3o-F5NZog,22128
|
|
55
|
+
xradio/schema/common.py,sha256=Hi2vT8s0za0J7FfA0OhzrGdtwjJ5eQWH7x3hfhBCOuo,2016
|
|
55
56
|
xradio/schema/dataclass.py,sha256=gzNqXzkBLV7ETEyddNOd_jRgP8rkivCkfUlURLz8z5c,19300
|
|
56
|
-
xradio/schema/export.py,sha256=
|
|
57
|
-
xradio/schema/metamodel.py,sha256=
|
|
58
|
-
xradio/schema/typing.py,sha256=
|
|
57
|
+
xradio/schema/export.py,sha256=qN8O8Wc9FtrYbiEmg1u66cN4coY_8QVHrZfb-oHhYp0,3510
|
|
58
|
+
xradio/schema/metamodel.py,sha256=F0lxnn0wLrsT2HrBo2zfIcmRLxD2yQwh7XfDciPNwVs,4963
|
|
59
|
+
xradio/schema/typing.py,sha256=RLFeMEPPHetc__kDaql1N1AcVuHArfk57DsUw2rZ5CE,10204
|
|
59
60
|
xradio/sphinx/__init__.py,sha256=VGY-7Ty3q67qpnBee0-znbiJ-Iy0F93UO--IpjEdHXc,380
|
|
60
61
|
xradio/sphinx/schema_table.py,sha256=CrhWMDYHwB7CbBMGfWtW20bLoBkeQZHd6l91cihvaBA,10709
|
|
61
|
-
xradio-0.0.
|
|
62
|
-
xradio-0.0.
|
|
63
|
-
xradio-0.0.
|
|
64
|
-
xradio-0.0.
|
|
65
|
-
xradio-0.0.
|
|
62
|
+
xradio-1.0.0.dist-info/licenses/LICENSE.txt,sha256=9CYIJt7riOXo9AD0eXBZviLxo_HebD-2JJI8oiWtzfg,1807
|
|
63
|
+
xradio-1.0.0.dist-info/METADATA,sha256=NBGVwySGd_pgdAUW1b54iErJc7gioqSn53vaAawONI4,7617
|
|
64
|
+
xradio-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
65
|
+
xradio-1.0.0.dist-info/top_level.txt,sha256=dQu27fGBZJ2Yk-gW5XeD-dZ76Xa4Xcvk60Vz-dwXp7k,7
|
|
66
|
+
xradio-1.0.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|