xradio 0.0.28__py3-none-any.whl → 0.0.30__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/__init__.py +5 -4
- xradio/_utils/array.py +90 -0
- xradio/_utils/zarr/common.py +48 -3
- xradio/image/_util/zarr.py +4 -1
- xradio/schema/__init__.py +24 -6
- xradio/schema/bases.py +440 -2
- xradio/schema/check.py +96 -55
- xradio/schema/dataclass.py +123 -27
- xradio/schema/metamodel.py +21 -4
- xradio/schema/typing.py +33 -18
- xradio/vis/__init__.py +5 -2
- xradio/vis/_processing_set.py +71 -32
- xradio/vis/_vis_utils/_ms/_tables/create_field_and_source_xds.py +710 -0
- xradio/vis/_vis_utils/_ms/_tables/load.py +23 -10
- xradio/vis/_vis_utils/_ms/_tables/load_main_table.py +145 -64
- xradio/vis/_vis_utils/_ms/_tables/read.py +747 -172
- xradio/vis/_vis_utils/_ms/_tables/read_main_table.py +173 -44
- xradio/vis/_vis_utils/_ms/_tables/read_subtables.py +79 -28
- xradio/vis/_vis_utils/_ms/_tables/write.py +102 -45
- xradio/vis/_vis_utils/_ms/_tables/write_exp_api.py +127 -65
- xradio/vis/_vis_utils/_ms/chunks.py +58 -21
- xradio/vis/_vis_utils/_ms/conversion.py +582 -102
- xradio/vis/_vis_utils/_ms/descr.py +52 -20
- xradio/vis/_vis_utils/_ms/msv2_to_msv4_meta.py +72 -35
- xradio/vis/_vis_utils/_ms/msv4_infos.py +0 -59
- xradio/vis/_vis_utils/_ms/msv4_sub_xdss.py +76 -9
- xradio/vis/_vis_utils/_ms/optimised_functions.py +0 -46
- xradio/vis/_vis_utils/_ms/partition_queries.py +308 -119
- xradio/vis/_vis_utils/_ms/partitions.py +82 -25
- xradio/vis/_vis_utils/_ms/subtables.py +32 -14
- xradio/vis/_vis_utils/_utils/partition_attrs.py +30 -11
- xradio/vis/_vis_utils/_utils/xds_helper.py +136 -45
- xradio/vis/_vis_utils/_zarr/read.py +60 -22
- xradio/vis/_vis_utils/_zarr/write.py +83 -9
- xradio/vis/_vis_utils/ms.py +48 -29
- xradio/vis/_vis_utils/zarr.py +44 -20
- xradio/vis/convert_msv2_to_processing_set.py +43 -32
- xradio/vis/load_processing_set.py +38 -61
- xradio/vis/read_processing_set.py +64 -96
- xradio/vis/schema.py +687 -0
- xradio/vis/vis_io.py +75 -43
- {xradio-0.0.28.dist-info → xradio-0.0.30.dist-info}/LICENSE.txt +6 -1
- {xradio-0.0.28.dist-info → xradio-0.0.30.dist-info}/METADATA +10 -5
- xradio-0.0.30.dist-info/RECORD +73 -0
- {xradio-0.0.28.dist-info → xradio-0.0.30.dist-info}/WHEEL +1 -1
- xradio/vis/model.py +0 -497
- xradio-0.0.28.dist-info/RECORD +0 -71
- {xradio-0.0.28.dist-info → xradio-0.0.30.dist-info}/top_level.txt +0 -0
|
@@ -13,15 +13,22 @@ from ._tables.read import read_generic_table, make_freq_attrs
|
|
|
13
13
|
from ._tables.read_subtables import read_delayed_pointing_table
|
|
14
14
|
from .._utils.partition_attrs import add_partition_attrs
|
|
15
15
|
from .._utils.xds_helper import make_coords
|
|
16
|
-
from xradio.
|
|
16
|
+
from xradio._utils.array import unique_1d
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def read_spw_ddi_ant_pol(inpath: str) -> Tuple[xr.Dataset]:
|
|
20
20
|
"""
|
|
21
21
|
Reads the four metainfo subtables needed to load data chunks into xdss.
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
Parameters
|
|
24
|
+
----------
|
|
25
|
+
inpath : str
|
|
26
|
+
MS path (main table)
|
|
27
|
+
|
|
28
|
+
Returns
|
|
29
|
+
-------
|
|
30
|
+
Tuple[xr.Dataset]
|
|
31
|
+
tuple with antenna, ddi, spw, and polarization setup subtables info
|
|
25
32
|
"""
|
|
26
33
|
spw_xds = read_generic_table(
|
|
27
34
|
inpath,
|
|
@@ -41,7 +48,8 @@ def read_spw_ddi_ant_pol(inpath: str) -> Tuple[xr.Dataset]:
|
|
|
41
48
|
def load_main_chunk(
|
|
42
49
|
infile: str, chunk: Dict[str, slice]
|
|
43
50
|
) -> Dict[Tuple[int, int], xr.Dataset]:
|
|
44
|
-
"""
|
|
51
|
+
"""
|
|
52
|
+
Loads a chunk of visibility data. For every DDI, a separate
|
|
45
53
|
dataset is produced.
|
|
46
54
|
This is very loosely equivalent to the
|
|
47
55
|
partitions.read_*_partitions functions, but in a load (not lazy)
|
|
@@ -51,10 +59,17 @@ def load_main_chunk(
|
|
|
51
59
|
Xarray datasets. It produces one dataset per DDI found within the
|
|
52
60
|
chunk slice of time/baseline.
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
62
|
+
Parameters
|
|
63
|
+
----------
|
|
64
|
+
infile : str
|
|
65
|
+
MS path (main table)
|
|
66
|
+
chunk : Dict[str, slice]
|
|
67
|
+
specification of chunk to load
|
|
68
|
+
|
|
69
|
+
Returns
|
|
70
|
+
-------
|
|
71
|
+
Dict[Tuple[int, int], xr.Dataset]
|
|
72
|
+
dictionary of chunk datasets (keys are spw and pol_setup IDs)
|
|
58
73
|
"""
|
|
59
74
|
|
|
60
75
|
chunk_dims = ["time", "baseline", "freq", "pol"]
|
|
@@ -97,12 +112,20 @@ def finalize_chunks(
|
|
|
97
112
|
Adds pointing variables to a dictionary of chunk xdss. This is
|
|
98
113
|
intended to be added after reading chunks from an MS main table.
|
|
99
114
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
:
|
|
105
|
-
|
|
115
|
+
Parameters
|
|
116
|
+
----------
|
|
117
|
+
infile : str
|
|
118
|
+
MS path (main table)
|
|
119
|
+
chunks : Dict[str, xr.Dataset]
|
|
120
|
+
chunk xdss
|
|
121
|
+
chunk_spec : Dict[str, slice]
|
|
122
|
+
specification of chunk to load
|
|
123
|
+
|
|
124
|
+
Returns
|
|
125
|
+
-------
|
|
126
|
+
Dict[Tuple[int, int], xr.Dataset]
|
|
127
|
+
dictionary of chunk xdss where every xds now has pointing
|
|
128
|
+
data variables
|
|
106
129
|
"""
|
|
107
130
|
pnt_name = "POINTING"
|
|
108
131
|
pnt_path = Path(infile, pnt_name)
|
|
@@ -115,6 +138,10 @@ def finalize_chunks(
|
|
|
115
138
|
rename_ids=subt_rename_ids.get(pnt_name, None),
|
|
116
139
|
time_slice=time_slice,
|
|
117
140
|
)
|
|
141
|
+
|
|
142
|
+
if "time" not in pnt_xds.dims:
|
|
143
|
+
return xr.Dataset()
|
|
144
|
+
|
|
118
145
|
pnt_xds = pnt_xds.compute()
|
|
119
146
|
|
|
120
147
|
pnt_chunks = {
|
|
@@ -125,16 +152,26 @@ def finalize_chunks(
|
|
|
125
152
|
return pnt_chunks
|
|
126
153
|
|
|
127
154
|
|
|
128
|
-
def finalize_chunk_xds(
|
|
155
|
+
def finalize_chunk_xds(
|
|
156
|
+
infile: str, chunk_xds: xr.Dataset, pointing_xds: xr.Dataset
|
|
157
|
+
) -> xr.Dataset:
|
|
129
158
|
"""
|
|
130
159
|
Adds pointing variables to one chunk xds.
|
|
131
160
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
:
|
|
137
|
-
|
|
161
|
+
Parameters
|
|
162
|
+
----------
|
|
163
|
+
infile : str
|
|
164
|
+
MS path (main table)
|
|
165
|
+
xds_chunk : xr.Dataset
|
|
166
|
+
chunks xds
|
|
167
|
+
pointing_xds : xr.Dataset
|
|
168
|
+
pointing (sub)table xds
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
-------
|
|
172
|
+
xr.Dataset
|
|
173
|
+
chunk xds with pointing data variables interpolated form
|
|
174
|
+
the pointing (sub)table
|
|
138
175
|
"""
|
|
139
176
|
|
|
140
177
|
interp_pnt = pointing_xds.interp(time=chunk_xds.time, method="nearest")
|