xradio 0.0.49__py3-none-any.whl → 0.0.50__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/measurement_set/_utils/_msv2/conversion.py +2 -1
- xradio/measurement_set/measurement_set_xdt.py +126 -4
- xradio/measurement_set/processing_set_xdt.py +5 -5
- xradio/measurement_set/schema.py +2 -0
- {xradio-0.0.49.dist-info → xradio-0.0.50.dist-info}/METADATA +2 -1
- {xradio-0.0.49.dist-info → xradio-0.0.50.dist-info}/RECORD +9 -9
- {xradio-0.0.49.dist-info → xradio-0.0.50.dist-info}/WHEEL +0 -0
- {xradio-0.0.49.dist-info → xradio-0.0.50.dist-info}/licenses/LICENSE.txt +0 -0
- {xradio-0.0.49.dist-info → xradio-0.0.50.dist-info}/top_level.txt +0 -0
|
@@ -1341,7 +1341,7 @@ def convert_and_write_partition(
|
|
|
1341
1341
|
|
|
1342
1342
|
ms_xdt["/antenna_xds"] = ant_xds
|
|
1343
1343
|
for group_name in xds.attrs["data_groups"]:
|
|
1344
|
-
ms_xdt["/" + f"
|
|
1344
|
+
ms_xdt["/" + f"field_and_source_{group_name}_xds"] = field_and_source_xds
|
|
1345
1345
|
|
|
1346
1346
|
if with_pointing and len(pointing_xds.data_vars) > 0:
|
|
1347
1347
|
ms_xdt["/pointing_xds"] = pointing_xds
|
|
@@ -1468,6 +1468,7 @@ def add_group_to_data_groups(
|
|
|
1468
1468
|
"correlated_data": correlated_data_name,
|
|
1469
1469
|
"flag": "FLAG",
|
|
1470
1470
|
"weight": "WEIGHT",
|
|
1471
|
+
"field_and_source": f"field_and_source_{what_group}_xds",
|
|
1471
1472
|
"description": f"Data group derived from the data column '{correlated_data_name}' of an MSv2 converted to MSv4",
|
|
1472
1473
|
"date": datetime.datetime.now(datetime.timezone.utc).isoformat(),
|
|
1473
1474
|
}
|
|
@@ -93,17 +93,34 @@ class MeasurementSetXdt:
|
|
|
93
93
|
if data_group_name is not None:
|
|
94
94
|
sel_data_group_set = set(
|
|
95
95
|
self._xdt.attrs["data_groups"][data_group_name].values()
|
|
96
|
-
)
|
|
96
|
+
) - set(["date", "description"])
|
|
97
|
+
|
|
98
|
+
sel_field_and_source_xds = self._xdt.attrs["data_groups"][data_group_name][
|
|
99
|
+
"field_and_source"
|
|
100
|
+
]
|
|
97
101
|
|
|
98
102
|
data_variables_to_drop = []
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
field_and_source_to_drop = []
|
|
104
|
+
for dg_name, dg in self._xdt.attrs["data_groups"].items():
|
|
105
|
+
print(f"Data group: {dg_name}", dg)
|
|
106
|
+
f_and_s = dg["field_and_source"]
|
|
107
|
+
dg_copy = dg.copy()
|
|
108
|
+
dg_copy.pop("date", None)
|
|
109
|
+
dg_copy.pop("description", None)
|
|
110
|
+
dg_copy.pop("field_and_source", None)
|
|
111
|
+
temp_set = set(dg_copy.values()) - sel_data_group_set
|
|
101
112
|
data_variables_to_drop.extend(list(temp_set))
|
|
102
113
|
|
|
114
|
+
if f_and_s != sel_field_and_source_xds:
|
|
115
|
+
field_and_source_to_drop.append(f_and_s)
|
|
116
|
+
|
|
103
117
|
data_variables_to_drop = list(set(data_variables_to_drop))
|
|
104
118
|
|
|
105
119
|
sel_ms_xdt = self._xdt
|
|
106
120
|
|
|
121
|
+
print("Data variables to drop: ", data_variables_to_drop)
|
|
122
|
+
print("Field and source to drop: ", field_and_source_to_drop)
|
|
123
|
+
|
|
107
124
|
sel_corr_xds = self._xdt.ds.sel(
|
|
108
125
|
indexers, method, tolerance, drop, **indexers_kwargs
|
|
109
126
|
).drop_vars(data_variables_to_drop)
|
|
@@ -140,7 +157,10 @@ class MeasurementSetXdt:
|
|
|
140
157
|
else:
|
|
141
158
|
data_group_name = list(self._xdt.attrs["data_groups"].keys())[0]
|
|
142
159
|
|
|
143
|
-
|
|
160
|
+
field_and_source_xds_name = self._xdt.attrs["data_groups"][data_group_name][
|
|
161
|
+
"field_and_source"
|
|
162
|
+
]
|
|
163
|
+
return self._xdt[field_and_source_xds_name].ds
|
|
144
164
|
|
|
145
165
|
def get_partition_info(self, data_group_name: str = None) -> dict:
|
|
146
166
|
"""
|
|
@@ -195,3 +215,105 @@ class MeasurementSetXdt:
|
|
|
195
215
|
}
|
|
196
216
|
|
|
197
217
|
return partition_info
|
|
218
|
+
|
|
219
|
+
def add_data_group(
|
|
220
|
+
self,
|
|
221
|
+
new_data_group_name: str,
|
|
222
|
+
correlated_data: str = None,
|
|
223
|
+
weight: str = None,
|
|
224
|
+
flag: str = None,
|
|
225
|
+
uvw: str = None,
|
|
226
|
+
field_and_source_xds: str = None,
|
|
227
|
+
date_time: str = None,
|
|
228
|
+
description: str = None,
|
|
229
|
+
data_group_dv_shared_with: str = None,
|
|
230
|
+
) -> xr.DataTree:
|
|
231
|
+
"""_summary_
|
|
232
|
+
|
|
233
|
+
Parameters
|
|
234
|
+
----------
|
|
235
|
+
new_data_group_name : str
|
|
236
|
+
_description_
|
|
237
|
+
correlated_data : str, optional
|
|
238
|
+
_description_, by default None
|
|
239
|
+
weights : str, optional
|
|
240
|
+
_description_, by default None
|
|
241
|
+
flag : str, optional
|
|
242
|
+
_description_, by default None
|
|
243
|
+
uvw : str, optional
|
|
244
|
+
_description_, by default None
|
|
245
|
+
field_and_source_xds : str, optional
|
|
246
|
+
_description_, by default None
|
|
247
|
+
date_time : str, optional
|
|
248
|
+
_description_, by default None
|
|
249
|
+
description : str, optional
|
|
250
|
+
_description_, by default None
|
|
251
|
+
data_group_dv_shared_with : str, optional
|
|
252
|
+
_description_, by default "base"
|
|
253
|
+
|
|
254
|
+
Returns
|
|
255
|
+
-------
|
|
256
|
+
xr.DataTree
|
|
257
|
+
_description_
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
if data_group_dv_shared_with is None:
|
|
261
|
+
data_group_dv_shared_with = self._xdt.xr_ms._get_default_data_group_name()
|
|
262
|
+
default_data_group = self._xdt.attrs["data_groups"][data_group_dv_shared_with]
|
|
263
|
+
|
|
264
|
+
new_data_group = {}
|
|
265
|
+
|
|
266
|
+
if correlated_data is None:
|
|
267
|
+
correlated_data = default_data_group["correlated_data"]
|
|
268
|
+
new_data_group["correlated_data"] = correlated_data
|
|
269
|
+
assert (
|
|
270
|
+
correlated_data in self._xdt.ds.data_vars
|
|
271
|
+
), f"Data variable {correlated_data} not found in dataset."
|
|
272
|
+
|
|
273
|
+
if weight is None:
|
|
274
|
+
weight = default_data_group["weight"]
|
|
275
|
+
new_data_group["weight"] = weight
|
|
276
|
+
assert (
|
|
277
|
+
weight in self._xdt.ds.data_vars
|
|
278
|
+
), f"Data variable {weight} not found in dataset."
|
|
279
|
+
|
|
280
|
+
if flag is None:
|
|
281
|
+
flag = default_data_group["flag"]
|
|
282
|
+
new_data_group["flag"] = flag
|
|
283
|
+
assert (
|
|
284
|
+
flag in self._xdt.ds.data_vars
|
|
285
|
+
), f"Data variable {flag} not found in dataset."
|
|
286
|
+
|
|
287
|
+
if self._xdt.attrs["type"] == "visibility":
|
|
288
|
+
if uvw is None:
|
|
289
|
+
uvw = default_data_group["uvw"]
|
|
290
|
+
new_data_group["uvw"] = uvw
|
|
291
|
+
assert (
|
|
292
|
+
uvw in self._xdt.ds.data_vars
|
|
293
|
+
), f"Data variable {uvw} not found in dataset."
|
|
294
|
+
|
|
295
|
+
if field_and_source_xds is None:
|
|
296
|
+
field_and_source_xds = default_data_group["field_and_source_xds"]
|
|
297
|
+
new_data_group["field_and_source"] = field_and_source_xds
|
|
298
|
+
assert (
|
|
299
|
+
field_and_source_xds in self._xdt.children
|
|
300
|
+
), f"Data variable {field_and_source_xds} not found in dataset."
|
|
301
|
+
|
|
302
|
+
if date_time is None:
|
|
303
|
+
date_time = datetime.now().isoformat()
|
|
304
|
+
new_data_group["date"] = date_time
|
|
305
|
+
|
|
306
|
+
if description is None:
|
|
307
|
+
description = ""
|
|
308
|
+
new_data_group["description"] = description
|
|
309
|
+
|
|
310
|
+
self._xdt.attrs["data_groups"][new_data_group_name] = new_data_group
|
|
311
|
+
|
|
312
|
+
return self._xdt
|
|
313
|
+
|
|
314
|
+
def _get_default_data_group_name(self):
|
|
315
|
+
if "base" in self._xdt.attrs["data_groups"].keys():
|
|
316
|
+
data_group_name = "base"
|
|
317
|
+
else:
|
|
318
|
+
data_group_name = list(self._xdt.attrs["data_groups"].keys())[0]
|
|
319
|
+
return data_group_name
|
|
@@ -193,7 +193,7 @@ class ProcessingSetXdt:
|
|
|
193
193
|
)
|
|
194
194
|
summary_data["end_frequency"].append(to_list(value["frequency"].values)[-1])
|
|
195
195
|
|
|
196
|
-
field_and_source_xds = value
|
|
196
|
+
field_and_source_xds = value.xr_ms.get_field_and_source_xds(data_group)
|
|
197
197
|
|
|
198
198
|
if field_and_source_xds.attrs["type"] == "field_and_source_ephemeris":
|
|
199
199
|
summary_data["field_coords"].append("Ephemeris")
|
|
@@ -349,7 +349,7 @@ class ProcessingSetXdt:
|
|
|
349
349
|
"correlated_data"
|
|
350
350
|
]
|
|
351
351
|
|
|
352
|
-
field_and_source_xds = ms_xdt
|
|
352
|
+
field_and_source_xds = ms_xdt.xr_ms.get_field_and_source_xds(data_group)
|
|
353
353
|
|
|
354
354
|
if not field_and_source_xds.attrs["type"] == "field_and_source_ephemeris":
|
|
355
355
|
|
|
@@ -450,9 +450,9 @@ class ProcessingSetXdt:
|
|
|
450
450
|
"correlated_data"
|
|
451
451
|
]
|
|
452
452
|
|
|
453
|
-
field_and_source_xds = field_and_source_xds =
|
|
454
|
-
|
|
455
|
-
|
|
453
|
+
field_and_source_xds = field_and_source_xds = (
|
|
454
|
+
ms_xdt.xr_ms.get_field_and_source_xds(data_group)
|
|
455
|
+
)
|
|
456
456
|
|
|
457
457
|
if field_and_source_xds.attrs["type"] == "field_and_source_ephemeris":
|
|
458
458
|
|
xradio/measurement_set/schema.py
CHANGED
|
@@ -1410,6 +1410,8 @@ class DataGroupDict:
|
|
|
1410
1410
|
""" Name of the weight variable of the group, for example 'WEIGHT'. """
|
|
1411
1411
|
uvw: Optional[str]
|
|
1412
1412
|
""" Name of the UVW variable of the group, for example 'UVW'. """
|
|
1413
|
+
field_and_source: str
|
|
1414
|
+
""" Name of the field_and_source_xds, for example field_and_source_xds_base. """
|
|
1413
1415
|
description: str
|
|
1414
1416
|
""" More details about the data group. """
|
|
1415
1417
|
date: str
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: xradio
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.50
|
|
4
4
|
Summary: Xarray Radio Astronomy Data IO
|
|
5
5
|
Author-email: Jan-Willem Steeb <jsteeb@nrao.edu>
|
|
6
6
|
License: BSD 3-Clause License
|
|
@@ -56,6 +56,7 @@ Requires-Dist: zarr<3,>=2
|
|
|
56
56
|
Requires-Dist: pyarrow
|
|
57
57
|
Requires-Dist: python_casacore>=3.6.1; sys_platform != "darwin"
|
|
58
58
|
Requires-Dist: typeguard
|
|
59
|
+
Requires-Dist: numcodecs<0.16
|
|
59
60
|
Provides-Extra: interactive
|
|
60
61
|
Requires-Dist: matplotlib; extra == "interactive"
|
|
61
62
|
Requires-Dist: prettytable; extra == "interactive"
|
|
@@ -27,15 +27,15 @@ xradio/image/_util/_zarr/zarr_low_level.py,sha256=xnYm6EmVbmLxMlOSXH32SABfQBLHfr
|
|
|
27
27
|
xradio/measurement_set/__init__.py,sha256=Vrr1Py50TvbzeZ_VMCswYNz0Wcccbf-iJDj4ArlfcJ0,870
|
|
28
28
|
xradio/measurement_set/convert_msv2_to_processing_set.py,sha256=uLZjXplVPXa0XnNa-Fty85k_-fsw6ZC98Hfiwd1WF-U,9704
|
|
29
29
|
xradio/measurement_set/load_processing_set.py,sha256=8EPApyGy0Tmzu6Seeby7dKxvtxtAFA585kK50DYVHas,8164
|
|
30
|
-
xradio/measurement_set/measurement_set_xdt.py,sha256=
|
|
30
|
+
xradio/measurement_set/measurement_set_xdt.py,sha256=kN337gyn7Q8nF4ENy292PYsmBJJLu5ozhJ3FyT5BcVo,11986
|
|
31
31
|
xradio/measurement_set/open_processing_set.py,sha256=kMODJmXT2KU12L6Y2NdTV8shvLGb5PgLIOqJgMCzlHI,5308
|
|
32
|
-
xradio/measurement_set/processing_set_xdt.py,sha256=
|
|
33
|
-
xradio/measurement_set/schema.py,sha256=
|
|
32
|
+
xradio/measurement_set/processing_set_xdt.py,sha256=LhonH1v9knkcFg5wYC1KHBB5pqhH0xPH6EkIms3-0xM,59353
|
|
33
|
+
xradio/measurement_set/schema.py,sha256=6vQEuI81V9mQ5y-Az310NfwgbdOEXkJDYQfIoZuMPdc,85757
|
|
34
34
|
xradio/measurement_set/_utils/__init__.py,sha256=XE-h1yMfr6tVD6gdUwXO1CVq5SQ6kD_oj-e5TFwslds,97
|
|
35
35
|
xradio/measurement_set/_utils/msv2.py,sha256=7hnZMFoQ-s1g0ATjEupLvtdqQCdroPv-Rl5OwjqXjh8,4430
|
|
36
36
|
xradio/measurement_set/_utils/zarr.py,sha256=ehXlu0Xh_UZ5Xm2RnHCxESsRZ26c3DQAO5rqMK5MwTk,3947
|
|
37
37
|
xradio/measurement_set/_utils/_msv2/chunks.py,sha256=JTPk3il6fk570BjWZMoOAtsbvnLmqPcBv9EPY6A2yOs,2964
|
|
38
|
-
xradio/measurement_set/_utils/_msv2/conversion.py,sha256=
|
|
38
|
+
xradio/measurement_set/_utils/_msv2/conversion.py,sha256=ERpoGBpi2x2qgX-NSql0LtpWE-uy_PG8uTvE_lJcQuY,52997
|
|
39
39
|
xradio/measurement_set/_utils/_msv2/create_antenna_xds.py,sha256=qLUDxbkJBOaD7EaVx7ufiU0CL5f8VVxK-923-j4XpXc,17758
|
|
40
40
|
xradio/measurement_set/_utils/_msv2/create_field_and_source_xds.py,sha256=iyR5LzCupA6ZJmIOjIylwCQRI1EU4JEofBL7sbDWzwA,37069
|
|
41
41
|
xradio/measurement_set/_utils/_msv2/descr.py,sha256=PGY39PYQj0K4th5RUv0jOWszcHlZDt6VQRTOuntCeYI,5213
|
|
@@ -70,8 +70,8 @@ xradio/schema/metamodel.py,sha256=WjtW7pAVzcjLRWifRH3sQoOiN6TV810hARpOIz1M_gw,38
|
|
|
70
70
|
xradio/schema/typing.py,sha256=8-o6fZd99kJ4FVdgBYRTIRJ-wDqpcUNXzCTfJvl3TIw,10439
|
|
71
71
|
xradio/sphinx/__init__.py,sha256=VGY-7Ty3q67qpnBee0-znbiJ-Iy0F93UO--IpjEdHXc,380
|
|
72
72
|
xradio/sphinx/schema_table.py,sha256=uq33habbAbReqnEG6ASKSd4UOMZGUzA3qoTX45rq84U,12373
|
|
73
|
-
xradio-0.0.
|
|
74
|
-
xradio-0.0.
|
|
75
|
-
xradio-0.0.
|
|
76
|
-
xradio-0.0.
|
|
77
|
-
xradio-0.0.
|
|
73
|
+
xradio-0.0.50.dist-info/licenses/LICENSE.txt,sha256=9CYIJt7riOXo9AD0eXBZviLxo_HebD-2JJI8oiWtzfg,1807
|
|
74
|
+
xradio-0.0.50.dist-info/METADATA,sha256=XpYcb4kWmCYjPkjybQhk-fJxKyRwM2W0wjyOMfr_s74,4471
|
|
75
|
+
xradio-0.0.50.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
76
|
+
xradio-0.0.50.dist-info/top_level.txt,sha256=dQu27fGBZJ2Yk-gW5XeD-dZ76Xa4Xcvk60Vz-dwXp7k,7
|
|
77
|
+
xradio-0.0.50.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|