xradio 0.0.60__py3-none-any.whl → 1.0.1__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 +27 -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 +23 -10
- xradio/measurement_set/measurement_set_xdt.py +11 -4
- xradio/measurement_set/open_processing_set.py +6 -6
- xradio/measurement_set/processing_set_xdt.py +70 -12
- xradio/measurement_set/schema.py +136 -179
- 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.60.dist-info → xradio-1.0.1.dist-info}/METADATA +3 -3
- {xradio-0.0.60.dist-info → xradio-1.0.1.dist-info}/RECORD +24 -23
- {xradio-0.0.60.dist-info → xradio-1.0.1.dist-info}/WHEEL +0 -0
- {xradio-0.0.60.dist-info → xradio-1.0.1.dist-info}/licenses/LICENSE.txt +0 -0
- {xradio-0.0.60.dist-info → xradio-1.0.1.dist-info}/top_level.txt +0 -0
|
@@ -37,19 +37,35 @@ class ProcessingSetXdt:
|
|
|
37
37
|
self._xdt = datatree
|
|
38
38
|
self.meta = {"summary": {}}
|
|
39
39
|
|
|
40
|
-
def summary(
|
|
40
|
+
def summary(
|
|
41
|
+
self, data_group: str | None = None, first_columns: list[str] = None
|
|
42
|
+
) -> pd.DataFrame:
|
|
41
43
|
"""
|
|
42
|
-
Generate and retrieve a summary of the Processing Set.
|
|
44
|
+
Generate and retrieve a summary of the Processing Set as a data frame.
|
|
43
45
|
|
|
44
46
|
The summary includes information such as the names of the Measurement Sets,
|
|
45
47
|
their intents, polarizations, spectral window names, field names, source names,
|
|
46
48
|
field coordinates, start frequencies, and end frequencies.
|
|
47
49
|
|
|
50
|
+
To prioritize certain columns depending on the context, the order in which the
|
|
51
|
+
columns of the data frame are sorted can be modified from the default
|
|
52
|
+
(first_columns parameter).
|
|
53
|
+
|
|
48
54
|
Parameters
|
|
49
55
|
----------
|
|
50
56
|
data_group : str, optional
|
|
51
57
|
The data group to summarize. By default the "base" group
|
|
52
58
|
is used (if found), or otherwise the first group found.
|
|
59
|
+
first_columns : list[str], optional
|
|
60
|
+
List of columns to be sorted first. Currently, the columns included in the
|
|
61
|
+
summary frame are, in this order: "name", "scan_intents", "shape",
|
|
62
|
+
"execution_block_UID", "polarization", "scan_name", "spw_name",
|
|
63
|
+
"spw_intents", "field_name", "source_name", "line_name", "field_coords",
|
|
64
|
+
"session_reference_UID", "scheduling_block_UID", "project_UID",
|
|
65
|
+
"start_frequency", "end_frequency".
|
|
66
|
+
For example, with first_columns=["spw_name", "scan_name"] one can print
|
|
67
|
+
these two columns first, followed by all the other columns in their usual
|
|
68
|
+
order.
|
|
53
69
|
|
|
54
70
|
Returns
|
|
55
71
|
-------
|
|
@@ -76,12 +92,22 @@ class ProcessingSetXdt:
|
|
|
76
92
|
data_group = find_data_group_base_or_first(data_group, self._xdt)
|
|
77
93
|
|
|
78
94
|
if data_group in self.meta["summary"]:
|
|
79
|
-
|
|
95
|
+
summary = self.meta["summary"][data_group]
|
|
80
96
|
else:
|
|
81
97
|
self.meta["summary"][data_group] = self._summary(data_group).sort_values(
|
|
82
98
|
by=["name"], ascending=True
|
|
83
99
|
)
|
|
84
|
-
|
|
100
|
+
summary = self.meta["summary"][data_group]
|
|
101
|
+
|
|
102
|
+
if first_columns:
|
|
103
|
+
found_columns = [col for col in first_columns if col in summary.columns]
|
|
104
|
+
if found_columns:
|
|
105
|
+
all_columns = (
|
|
106
|
+
found_columns + summary.columns.drop(found_columns).tolist()
|
|
107
|
+
)
|
|
108
|
+
summary = summary[all_columns]
|
|
109
|
+
|
|
110
|
+
return summary
|
|
85
111
|
|
|
86
112
|
def get_max_dims(self) -> dict[str, int]:
|
|
87
113
|
"""
|
|
@@ -164,16 +190,20 @@ class ProcessingSetXdt:
|
|
|
164
190
|
def _summary(self, data_group: str = None):
|
|
165
191
|
summary_data = {
|
|
166
192
|
"name": [],
|
|
167
|
-
"
|
|
193
|
+
"scan_intents": [],
|
|
168
194
|
"shape": [],
|
|
195
|
+
"execution_block_UID": [],
|
|
169
196
|
"polarization": [],
|
|
170
197
|
"scan_name": [],
|
|
171
198
|
"spw_name": [],
|
|
172
|
-
"
|
|
199
|
+
"spw_intents": [],
|
|
173
200
|
"field_name": [],
|
|
174
201
|
"source_name": [],
|
|
175
202
|
"line_name": [],
|
|
176
203
|
"field_coords": [],
|
|
204
|
+
"session_reference_UID": [],
|
|
205
|
+
"scheduling_block_UID": [],
|
|
206
|
+
"project_UID": [],
|
|
177
207
|
"start_frequency": [],
|
|
178
208
|
"end_frequency": [],
|
|
179
209
|
}
|
|
@@ -182,11 +212,17 @@ class ProcessingSetXdt:
|
|
|
182
212
|
|
|
183
213
|
for key, value in self._xdt.items():
|
|
184
214
|
partition_info = value.xr_ms.get_partition_info()
|
|
215
|
+
observation_info = value.observation_info
|
|
185
216
|
|
|
186
217
|
summary_data["name"].append(key)
|
|
187
|
-
summary_data["
|
|
218
|
+
summary_data["scan_intents"].append(partition_info["scan_intents"])
|
|
219
|
+
summary_data["execution_block_UID"].append(
|
|
220
|
+
observation_info.get("execution_block_UID", "---")
|
|
221
|
+
)
|
|
188
222
|
summary_data["spw_name"].append(partition_info["spectral_window_name"])
|
|
189
|
-
summary_data["
|
|
223
|
+
summary_data["spw_intents"].append(
|
|
224
|
+
partition_info["spectral_window_intents"]
|
|
225
|
+
)
|
|
190
226
|
summary_data["polarization"].append(value.polarization.values)
|
|
191
227
|
summary_data["scan_name"].append(partition_info["scan_name"])
|
|
192
228
|
data_name = value.attrs["data_groups"][data_group]["correlated_data"]
|
|
@@ -201,9 +237,17 @@ class ProcessingSetXdt:
|
|
|
201
237
|
|
|
202
238
|
summary_data["field_name"].append(partition_info["field_name"])
|
|
203
239
|
summary_data["source_name"].append(partition_info["source_name"])
|
|
204
|
-
|
|
205
240
|
summary_data["line_name"].append(partition_info["line_name"])
|
|
206
241
|
|
|
242
|
+
summary_data["session_reference_UID"].append(
|
|
243
|
+
observation_info.get("session_reference_UID", "---")
|
|
244
|
+
)
|
|
245
|
+
summary_data["scheduling_block_UID"].append(
|
|
246
|
+
observation_info.get("scheduling_block_UID", "---")
|
|
247
|
+
)
|
|
248
|
+
summary_data["project_UID"].append(
|
|
249
|
+
observation_info.get("project_UID", "---")
|
|
250
|
+
)
|
|
207
251
|
summary_data["start_frequency"].append(
|
|
208
252
|
to_list(value["frequency"].values)[0]
|
|
209
253
|
)
|
|
@@ -242,7 +286,7 @@ class ProcessingSetXdt:
|
|
|
242
286
|
|
|
243
287
|
This method allows filtering the Processing Set by matching column names and values
|
|
244
288
|
or by applying a Pandas query string. The selection criteria can target various
|
|
245
|
-
attributes of the Measurement Sets such as
|
|
289
|
+
attributes of the Measurement Sets such as scan_intents, polarization, spectral window names, etc.
|
|
246
290
|
|
|
247
291
|
A data group can be selected by name by using the `data_group_name` parameter. This is applied to each Measurement Set in the Processing Set.
|
|
248
292
|
|
|
@@ -270,8 +314,8 @@ class ProcessingSetXdt:
|
|
|
270
314
|
|
|
271
315
|
Examples
|
|
272
316
|
--------
|
|
273
|
-
>>> # Select all MSs with
|
|
274
|
-
>>> selected_ps_xdt = ps_xdt.xr_ps.query(
|
|
317
|
+
>>> # Select all MSs with scan_intents 'OBSERVE_TARGET#ON_SOURCE' and polarization 'RR' or 'LL'
|
|
318
|
+
>>> selected_ps_xdt = ps_xdt.xr_ps.query(scan_intents='OBSERVE_TARGET#ON_SOURCE', polarization=['RR', 'LL'])
|
|
275
319
|
|
|
276
320
|
>>> # Select all MSs with start_frequency greater than 100 GHz and less than 200 GHz
|
|
277
321
|
>>> selected_ps_xdt = ps_xdt.xr_ps.query(query='start_frequency > 100e9 AND end_frequency < 200e9')
|
|
@@ -878,3 +922,17 @@ class ProcessingSetXdt:
|
|
|
878
922
|
fig.canvas.mpl_connect("motion_notify_event", antenna_hover)
|
|
879
923
|
|
|
880
924
|
plt.show()
|
|
925
|
+
|
|
926
|
+
def get_ms_xdt(self):
|
|
927
|
+
"""Returns the Measurement Set associated with this Processing Set if there is only a single Measurement Set.
|
|
928
|
+
|
|
929
|
+
Returns
|
|
930
|
+
-------
|
|
931
|
+
xr.DataTree
|
|
932
|
+
The Measurement Set Data Tree object.
|
|
933
|
+
"""
|
|
934
|
+
|
|
935
|
+
assert (
|
|
936
|
+
len(self._xdt.children) == 1
|
|
937
|
+
), "Processing Set contains multiple Measurement Sets and cannot determine which to return."
|
|
938
|
+
return list(self._xdt.children.values())[0]
|