xradio 0.0.56__py3-none-any.whl → 0.0.58__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.
Files changed (62) hide show
  1. xradio/__init__.py +2 -2
  2. xradio/_utils/_casacore/casacore_from_casatools.py +12 -2
  3. xradio/_utils/_casacore/tables.py +1 -0
  4. xradio/_utils/coord_math.py +22 -23
  5. xradio/_utils/dict_helpers.py +76 -11
  6. xradio/_utils/schema.py +5 -2
  7. xradio/_utils/zarr/common.py +1 -73
  8. xradio/image/_util/_casacore/xds_from_casacore.py +49 -33
  9. xradio/image/_util/_casacore/xds_to_casacore.py +41 -14
  10. xradio/image/_util/_fits/xds_from_fits.py +146 -35
  11. xradio/image/_util/casacore.py +4 -3
  12. xradio/image/_util/common.py +4 -4
  13. xradio/image/_util/image_factory.py +8 -8
  14. xradio/image/image.py +45 -5
  15. xradio/measurement_set/__init__.py +19 -9
  16. xradio/measurement_set/_utils/__init__.py +1 -3
  17. xradio/measurement_set/_utils/_msv2/__init__.py +0 -0
  18. xradio/measurement_set/_utils/_msv2/_tables/read.py +17 -76
  19. xradio/measurement_set/_utils/_msv2/_tables/read_main_table.py +2 -685
  20. xradio/measurement_set/_utils/_msv2/conversion.py +123 -145
  21. xradio/measurement_set/_utils/_msv2/create_antenna_xds.py +9 -16
  22. xradio/measurement_set/_utils/_msv2/create_field_and_source_xds.py +125 -221
  23. xradio/measurement_set/_utils/_msv2/msv2_to_msv4_meta.py +1 -2
  24. xradio/measurement_set/_utils/_msv2/msv4_info_dicts.py +8 -7
  25. xradio/measurement_set/_utils/_msv2/msv4_sub_xdss.py +27 -72
  26. xradio/measurement_set/_utils/_msv2/partition_queries.py +1 -261
  27. xradio/measurement_set/_utils/_msv2/subtables.py +0 -107
  28. xradio/measurement_set/_utils/_utils/interpolate.py +60 -0
  29. xradio/measurement_set/_utils/_zarr/encoding.py +2 -7
  30. xradio/measurement_set/convert_msv2_to_processing_set.py +0 -2
  31. xradio/measurement_set/load_processing_set.py +2 -2
  32. xradio/measurement_set/measurement_set_xdt.py +14 -14
  33. xradio/measurement_set/open_processing_set.py +1 -3
  34. xradio/measurement_set/processing_set_xdt.py +41 -835
  35. xradio/measurement_set/schema.py +95 -122
  36. xradio/schema/check.py +91 -97
  37. xradio/schema/dataclass.py +159 -22
  38. xradio/schema/export.py +99 -0
  39. xradio/schema/metamodel.py +51 -16
  40. xradio/schema/typing.py +5 -5
  41. {xradio-0.0.56.dist-info → xradio-0.0.58.dist-info}/METADATA +2 -1
  42. xradio-0.0.58.dist-info/RECORD +65 -0
  43. {xradio-0.0.56.dist-info → xradio-0.0.58.dist-info}/WHEEL +1 -1
  44. xradio/image/_util/fits.py +0 -13
  45. xradio/measurement_set/_utils/_msv2/_tables/load.py +0 -66
  46. xradio/measurement_set/_utils/_msv2/_tables/load_main_table.py +0 -490
  47. xradio/measurement_set/_utils/_msv2/_tables/read_subtables.py +0 -398
  48. xradio/measurement_set/_utils/_msv2/_tables/write.py +0 -323
  49. xradio/measurement_set/_utils/_msv2/_tables/write_exp_api.py +0 -388
  50. xradio/measurement_set/_utils/_msv2/chunks.py +0 -115
  51. xradio/measurement_set/_utils/_msv2/descr.py +0 -165
  52. xradio/measurement_set/_utils/_msv2/msv2_msv3.py +0 -7
  53. xradio/measurement_set/_utils/_msv2/partitions.py +0 -392
  54. xradio/measurement_set/_utils/_utils/cds.py +0 -40
  55. xradio/measurement_set/_utils/_utils/xds_helper.py +0 -404
  56. xradio/measurement_set/_utils/_zarr/read.py +0 -263
  57. xradio/measurement_set/_utils/_zarr/write.py +0 -329
  58. xradio/measurement_set/_utils/msv2.py +0 -106
  59. xradio/measurement_set/_utils/zarr.py +0 -133
  60. xradio-0.0.56.dist-info/RECORD +0 -78
  61. {xradio-0.0.56.dist-info → xradio-0.0.58.dist-info}/licenses/LICENSE.txt +0 -0
  62. {xradio-0.0.56.dist-info → xradio-0.0.58.dist-info}/top_level.txt +0 -0
@@ -1,329 +0,0 @@
1
- import toolviper.utils.logger as logger, numcodecs, os, time, warnings
2
- from itertools import cycle
3
- from pathlib import Path
4
- from typing import Any, Dict, Union
5
-
6
- import xarray as xr
7
- import zarr
8
-
9
-
10
- def write_part_keys(
11
- partitions: Dict[Any, xr.Dataset], outpath: str, compressor: numcodecs.abc.Codec
12
- ) -> None:
13
- """
14
- Writes an xds with the partition keys.
15
-
16
- Parameters
17
- ----------
18
- partitions : Dict[Any, xr.Dataset]
19
- partitions from a cds
20
- outpath : str
21
- path to write a cds
22
- compressor : numcodecs.abc.Codec
23
- compressor used for the partition keys variable
24
-
25
- Returns
26
- -------
27
-
28
- """
29
-
30
- spw_ids, pol_setup_ids, intents = map(list, zip(*partitions.keys()))
31
- part_keys = xr.Dataset(
32
- data_vars={
33
- "spw_ids": spw_ids,
34
- "pol_setup_ids": pol_setup_ids,
35
- "intents": intents,
36
- }
37
- )
38
-
39
- encoding = dict(zip(list(part_keys.data_vars), cycle([{"compressor": compressor}])))
40
-
41
- out_path = Path(outpath, "partition_keys")
42
- xr.Dataset.to_zarr(
43
- part_keys,
44
- store=out_path,
45
- mode="w",
46
- encoding=encoding,
47
- consolidated=False,
48
- )
49
- zarr.consolidate_metadata(out_path)
50
-
51
-
52
- def write_metainfo(
53
- outpath: str,
54
- metainfo: Dict[str, xr.Dataset],
55
- chunks_on_disk: Union[Dict, None] = None,
56
- compressor: Union[numcodecs.abc.Codec, None] = None,
57
- consolidated: bool = True,
58
- ) -> None:
59
- """
60
- Write all metainfo subtables from a cds to zarr storage
61
-
62
- Parameters
63
- ----------
64
- outpath : str
65
-
66
- metainfo : Dict[str, xr.Dataset]:
67
-
68
- chunks_on_disk : Union[Dict, None] (Default value = None)
69
-
70
- compressor : Union[numcodecs.abc.Codec, None) (Default value = None)
71
-
72
- consolidated : bool (Default value = True)
73
-
74
-
75
- Returns
76
- -------
77
-
78
- """
79
- metadir = Path(outpath, "metainfo")
80
- os.mkdir(metadir)
81
- for key, xds in metainfo.items():
82
- xds_outpath = Path(metadir, key)
83
- logger.debug(f"Saving metainfo xds {key} into {xds_outpath}")
84
- write_xds_to_zarr(
85
- xds, key, xds_outpath, chunks_on_disk, compressor, consolidated=True
86
- )
87
-
88
-
89
- def write_partitions(
90
- outpath: str,
91
- partitions: Dict[str, xr.Dataset],
92
- chunks_on_disk: Union[Dict, None] = None,
93
- compressor: Union[numcodecs.abc.Codec, None] = None,
94
- consolidated: bool = True,
95
- ) -> None:
96
- """
97
- Write all data partitions metainfo from a cds to zarr storage
98
-
99
- Parameters
100
- ----------
101
- outpath : str :
102
-
103
- partitions : Dict[str, xr.Dataset]
104
-
105
- chunks_on_disk : Union[Dict, None] (Default value = None)
106
-
107
- compressor : Union[numcodecs.abc.Codec, None] (Default value = True)
108
-
109
- consolidated: bool (Default value = True)
110
-
111
-
112
- Returns
113
- -------
114
-
115
- """
116
-
117
- partdir = Path(outpath, "partitions")
118
- os.mkdir(partdir)
119
- for cnt, (key, xds) in enumerate(partitions.items()):
120
- xds_name = f"xds_{cnt}"
121
- xds_outpath = Path(partdir, str(xds_name))
122
- logger.debug(f"Saving partition xds {key} into {xds_outpath}")
123
- write_xds_to_zarr(
124
- xds, xds_name, xds_outpath, chunks_on_disk, compressor, consolidated=True
125
- )
126
-
127
-
128
- def write_xds_to_zarr(
129
- xds: xr.Dataset,
130
- name: str,
131
- outpath: str,
132
- chunks_on_disk: Union[Dict, None] = None,
133
- compressor: Union[numcodecs.abc.Codec, None] = None,
134
- consolidated: bool = True,
135
- graph_name: str = "write_xds_to_zarr",
136
- ) -> None:
137
- """
138
- Write one xr dataset from a cds (either metainfo or a partition).
139
-
140
- Parameters
141
- ----------
142
- xds : xr.Dataset
143
- cds (sub)dataset
144
- name : str
145
- dataset name (example subtable name, or xds{i})
146
- outpath: str :
147
-
148
- chunks_on_disk : Union[Dict, None] (Default value = None)
149
-
150
- compressor : Union[numcodecs.abc.Codec, None] (Default value = None)
151
-
152
- consolidated : bool (Default value = True)
153
-
154
- graph_name : str
155
- the time taken to execute the graph and save the
156
- dataset is measured and saved as an attribute in the zarr file.
157
- The graph_name is the label for this timing information.
158
-
159
- Returns
160
- -------
161
-
162
- """
163
-
164
- xds_for_disk = xds
165
- if chunks_on_disk is not None:
166
- xds_for_disk = xds_for_disk.chunk(chunks=chunks_on_disk)
167
-
168
- xds_for_disk = prepare_attrs_for_zarr(name, xds_for_disk)
169
-
170
- if name.startswith("xds"):
171
- # Do not write replicated/interpolated pointing (keep only original
172
- # pointing subtable
173
- pointing_vars = [
174
- var for var in xds_for_disk.data_vars if var.startswith("pointing_")
175
- ]
176
- xds_for_disk = xds_for_disk.drop_vars(pointing_vars)
177
- # https://github.com/pydata/xarray/issues/2300
178
- # Could: compute / xds_for_disk[var] = xds_for_disk[var].chunk(chunks_on_disk)
179
-
180
- for var in xds_for_disk.data_vars:
181
- # Need a dequantify/quantify-kind of pair of functions for units?
182
- if (
183
- xds_for_disk.data_vars[var].dtype == "datetime64[ns]"
184
- and "units" in xds_for_disk.data_vars[var].attrs
185
- ):
186
- xds_for_disk.data_vars[var].attrs.pop("units")
187
-
188
- for coord in xds_for_disk.coords:
189
- if (
190
- xds_for_disk.coords[coord].dtype == "datetime64[ns]"
191
- and "units" in xds_for_disk.coords[coord].attrs
192
- ):
193
- xds_for_disk.coords[coord].attrs.pop("units")
194
-
195
- # Create compression encoding for each datavariable
196
- encoding = dict(
197
- zip(list(xds_for_disk.data_vars), cycle([{"compressor": compressor}]))
198
- )
199
-
200
- start = time.time()
201
- with warnings.catch_warnings():
202
- warnings.filterwarnings("ignore", "invalid value encountered in cast")
203
- xr.Dataset.to_zarr(
204
- xds_for_disk,
205
- store=outpath,
206
- mode="w",
207
- encoding=encoding,
208
- consolidated=consolidated,
209
- )
210
- time_to_calc_and_store = time.time() - start
211
- logger.debug(
212
- f"time to store and execute graph ({graph_name}) for {name}: {time_to_calc_and_store}"
213
- )
214
-
215
- # Add timing information?
216
- # dataset_group = zarr.open_group(xds_outpath, mode='a')
217
- # dataset_group.attrs[graph_name+'_time'] = time_to_calc_and_store
218
-
219
- if consolidated:
220
- zarr.consolidate_metadata(outpath)
221
-
222
-
223
- def prepare_attrs_for_zarr(name: str, xds: xr.Dataset) -> xr.Dataset:
224
- """
225
- Deal with types that cannot be serialized as they are in the
226
- cds/xds (ndarray etc.)
227
-
228
- Parameters
229
- ----------
230
- name : str
231
-
232
- xds : xr.Dataset
233
-
234
-
235
- Returns
236
- -------
237
-
238
- """
239
- ctds_attrs = xds.attrs["other"]["msv2"]["ctds_attrs"]
240
- col_descrs = ctds_attrs["column_descriptions"]
241
-
242
- # Present in some old vla/alma MSs (model_0, model_1, model_2...
243
- # vla/ngc5921.applycal.ms, alma/uid___A002_X71a45c_X1d24.ms.split): Just drop.
244
- for attr in list(ctds_attrs):
245
- if attr.startswith("model_"):
246
- ctds_attrs.pop(attr)
247
-
248
- # Seen for example in vla/ngc5921_statwt_ref_test_algorithm_sep_corr_no_fitspw.ms. Just drop.
249
- data_cols = ["DATA", "CORRECTED_DATA", "MODEL_DATA"]
250
- for col in data_cols:
251
- if col in col_descrs and "CHANNEL_SELECTION" in col_descrs[col]["keywords"]:
252
- col_descrs[col]["keywords"].pop("CHANNEL_SELECTION")
253
-
254
- if "xds" in name:
255
- col_descrs["UVW"]["shape"] = ",".join(map(str, col_descrs["UVW"]["shape"]))
256
-
257
- if "spectral_window" == name:
258
- for col in ["CHAN_FREQ", "REF_FREQUENCY"]:
259
- measinfo = col_descrs[col]["keywords"]["MEASINFO"]
260
- if "TabRefCodes" in measinfo:
261
- measinfo["TabRefCodes"] = ",".join(
262
- map(
263
- str,
264
- measinfo["TabRefCodes"],
265
- )
266
- )
267
-
268
- if "antenna" == name:
269
- for col in ["OFFSET", "POSITION"]:
270
- if col in col_descrs:
271
- col_descrs[col]["shape"] = ",".join(map(str, col_descrs[col]["shape"]))
272
- # ARRAY_POSITION present in keywords of some ALMA-SD datasets
273
- # example: almasd/expected.ms
274
- for kw in ["ARRAY_POSITION"]:
275
- if kw in col_descrs["POSITION"]["keywords"]:
276
- col_descrs["POSITION"]["keywords"][kw] = ",".join(
277
- map(str, col_descrs["POSITION"]["keywords"][kw])
278
- )
279
-
280
- if "ephemerides" == name:
281
- if "radii" in ctds_attrs:
282
- ctds_attrs["radii"]["value"] = ",".join(
283
- map(str, ctds_attrs["radii"]["value"])
284
- )
285
-
286
- if "feed" == name:
287
- col_descrs["POSITION"]["shape"] = ",".join(
288
- map(str, col_descrs["POSITION"]["shape"])
289
- )
290
-
291
- if "field" == name:
292
- for col in ["DELAY_DIR", "PHASE_DIR", "REFERENCE_DIR"]:
293
- # These shapes are not present in many MSs
294
- if col in col_descrs and "shape" in col_descrs[col]:
295
- col_descrs[col]["shape"] = ",".join(map(str, col_descrs[col]["shape"]))
296
- if "TabRefCodes" in col_descrs[col]["keywords"]["MEASINFO"]:
297
- col_descrs[col]["keywords"]["MEASINFO"]["TabRefCodes"] = ",".join(
298
- map(
299
- str,
300
- col_descrs[col]["keywords"]["MEASINFO"]["TabRefCodes"],
301
- )
302
- )
303
-
304
- if "observation" == name:
305
- col_descrs["TIME_RANGE"]["shape"] = ",".join(
306
- map(str, col_descrs["TIME_RANGE"]["shape"])
307
- )
308
-
309
- if "source" == name:
310
- # Note several of these cols are optional and/or only
311
- # populated with arrays sometimes!
312
- for col in [
313
- "DIRECTION",
314
- "PROPER_MOTION",
315
- "POSITION",
316
- "TRANSITION",
317
- "REST_FREQUENCY",
318
- "SYSVEL",
319
- ]:
320
- if col in col_descrs and "shape" in col_descrs[col]:
321
- col_descrs[col]["shape"] = ",".join(map(str, col_descrs[col]["shape"]))
322
-
323
- if "weather" == name:
324
- # Non-std col
325
- for col in ["NS_WX_STATION_POSITION"]:
326
- if col in col_descrs and "shape" in col_descrs[col]:
327
- col_descrs[col]["shape"] = ",".join(map(str, col_descrs[col]["shape"]))
328
-
329
- return xds
@@ -1,106 +0,0 @@
1
- import os
2
- import toolviper.utils.logger as logger
3
- from typing import List, Tuple, Union
4
-
5
- from xradio.measurement_set._utils._utils.cds import CASAVisSet
6
- from xradio.measurement_set._utils._msv2.partitions import (
7
- finalize_partitions,
8
- read_ms_ddi_partitions,
9
- read_ms_scan_subscan_partitions,
10
- )
11
- from xradio.measurement_set._utils._msv2.subtables import read_ms_subtables
12
- from xradio.measurement_set._utils._utils.xds_helper import vis_xds_packager_cds
13
-
14
-
15
- def read_ms(
16
- infile: str,
17
- subtables: bool = True,
18
- asdm_subtables: bool = False,
19
- partition_scheme: str = "intent",
20
- chunks: Union[Tuple[int], List[int]] = None,
21
- expand: bool = False,
22
- **kwargs: str,
23
- ) -> CASAVisSet:
24
- """
25
- Read a MeasurementSet (MSv2 format) into a next generation CASA
26
- dataset (visibilities dataset as a set of Xarray datasets).
27
-
28
- The MS is partitioned into multiple sub- Xarray datasets (where the data variables are read as
29
- Dask delayed arrays).
30
- The MS is partitioned by DDI, which guarantees a fixed data shape per partition (in terms of channels
31
- and polarizations) and, subject to experimentation, by scan and subscan. This results in multiple
32
- partitions as xarray datasets (xds) contained within a main xds (mxds).
33
-
34
- Parameters
35
- ----------
36
- infile : str
37
- Input MS filename
38
- subtables : bool (Default value = True)
39
- Also read and include subtables along with main table selection. Default False will
40
- omit subtables (faster)
41
- asdm_subtables : bool (Default value = False)
42
- in addition to MeasurementSet subtables (if enabled), also read extension
43
- subtables named "ASDM_*"
44
- partition_scheme : str (Default value = "intent")
45
- experimenting) Whether to partition sub-xds datasets by scan/subscan
46
- (in addition to DDI), or other alternative partitioning schemes. Accepted values: 'scan/subscan',
47
- 'scan', 'ddi', 'intent'. Default: 'intent'
48
- chunks : Union[Tuple[int], List[int]] (Default value = None)
49
- Can be used to set a specific chunk shape (with a tuple of ints), or to control the
50
- optimization used for automatic chunking (with a list of ints). A tuple of ints in the form of (row,
51
- chan, pol) will use a fixed chunk shape. A list or numpy array of ints in the form of [idx1, etc]
52
- will trigger auto-chunking optimized for the given indices, with row=0, chan=1, pol=2. Default None
53
- uses auto-chunking with a best fit across all dimensions (probably sub-optimal for most cases).
54
- expand : bool (Default value = False)
55
- to be removed) Whether or not to return the original flat row structure of the MS (False)
56
- or expand the rows to time x baseline dimensions (True). Expanding the rows allows for easier indexing
57
- and parallelization across time and baseline dimensions, at the cost of some conversion time.
58
- **kwargs: str :
59
-
60
-
61
- Returns
62
- -------
63
- CASAVisSet
64
- Main xarray dataset of datasets for this visibility dataset
65
- """
66
-
67
- infile = os.path.expanduser(infile)
68
- if not os.path.isdir(infile):
69
- raise ValueError(f"invalid input filename to read_ms {infile}")
70
-
71
- # Several alternatives to experiment for now
72
- part_descr = {
73
- "intent": "scan/subscan intent + DDI",
74
- "ddi": "DDI",
75
- "scan": "scan + DDI",
76
- "scan/subscan": "scan + subscan + DDI",
77
- }
78
-
79
- if partition_scheme not in part_descr:
80
- raise ValueError(f"Invalid partition_scheme: {partition_scheme}")
81
-
82
- logger.info(
83
- f"Reading {infile} as MSv2 and applying partitioning by {part_descr[partition_scheme]}"
84
- )
85
-
86
- if partition_scheme == "ddi":
87
- logger.info(f"Reading {infile} as MSv2 and applying DDI partitioning")
88
- # get the indices of the ms selection (if any)
89
- # rowmap = ms_selection(infile, verbose=verbose, **kwargs)
90
- rowmap = None
91
- parts, subts, done_subts = read_ms_ddi_partitions(
92
- infile, expand, rowmap, chunks
93
- )
94
- else:
95
- parts, subts, done_subts = read_ms_scan_subscan_partitions(
96
- infile, partition_scheme, expand, chunks
97
- )
98
-
99
- if subtables:
100
- subts.update(read_ms_subtables(infile, done_subts, asdm_subtables))
101
-
102
- parts = finalize_partitions(parts, subts)
103
-
104
- # build the visibilities container (metainfo + partitions) to return
105
- cds = vis_xds_packager_cds(subts, parts, "read_ms")
106
- return cds
@@ -1,133 +0,0 @@
1
- import numcodecs, os, time
2
- from pathlib import Path
3
- from typing import Dict, Union
4
-
5
- import zarr
6
- import toolviper.utils.logger as logger
7
-
8
- from ._utils.cds import CASAVisSet
9
- from ._zarr.read import read_part_keys, read_partitions, read_subtables
10
- from ._zarr.write import write_metainfo, write_part_keys, write_partitions
11
-
12
-
13
- def is_zarr_cor(inpath: str) -> bool:
14
- """
15
- Check if a given path has a visibilities dataset in Zarr format
16
-
17
- Parameters
18
- ----------
19
- inpath : str
20
- path to a (possibly) Zarr vis dataset
21
-
22
- Returns
23
- -------
24
- bool
25
- whether zarr.open can open this path
26
- """
27
- try:
28
- with zarr.open(Path(inpath, "partition_keys"), mode="r"):
29
- logger.debug(f"{inpath} can be opened as Zarr format data")
30
- return True
31
- except zarr.errors.PathNotFoundError:
32
- return False
33
-
34
-
35
- def read_cor(
36
- inpath: str,
37
- subtables: bool = True,
38
- asdm_subtables: bool = False,
39
- ) -> CASAVisSet:
40
- """
41
- Read a CASAVisSet stored in zarr format.
42
-
43
- Parameters
44
- ----------
45
- inpath : str
46
- Input Zarr path
47
- subtables : bool (Default value = True)
48
- Also read and (metainformation) subtables along with main visibilities data.
49
- asdm_subtables : bool (Default value = False)
50
- Also read extension subtables named "ASDM_*"
51
-
52
- Returns
53
- -------
54
- CASAVisSet
55
- Main xarray dataset of datasets for this visibility dataset
56
- """
57
- inpath = os.path.expanduser(inpath)
58
- if not os.path.isdir(inpath):
59
- raise ValueError(f"invalid input filename to read_vis {inpath}")
60
-
61
- logger.info(f"Reading {inpath} as visibilities dataset stored in Zarr format")
62
-
63
- all_start = time.time()
64
-
65
- metainfo = {}
66
- if subtables:
67
- metainfo = read_subtables(inpath, asdm_subtables)
68
-
69
- part_keys = read_part_keys(inpath)
70
- partitions = read_partitions(inpath, part_keys)
71
-
72
- all_time = time.time() - all_start
73
- logger.info(f"Time to read dataset from_zarr {inpath}: {all_time}")
74
-
75
- vers = "version-WIP"
76
- descr_add = "read_vis from zarr"
77
- cds = CASAVisSet(
78
- metainfo=metainfo,
79
- partitions=dict.fromkeys(part_keys, partitions),
80
- descr=f"CASA vis set produced by xradio {vers}/{descr_add}",
81
- )
82
-
83
- return cds
84
-
85
-
86
- def write_cor(
87
- cds: CASAVisSet,
88
- outpath: str,
89
- chunks_on_disk: Union[Dict, None] = None,
90
- compressor: Union[numcodecs.abc.Codec, None] = None,
91
- ) -> None:
92
- """
93
- Write CASA vis dataset to zarr format on disk. When
94
- chunks_on_disk is not specified the chunking in the input dataset
95
- is used. When chunks_on_disk is specified that dataset is saved
96
- using that chunking.
97
-
98
- Parameters
99
- ----------
100
- cds : CASAVisSet
101
- CASA visibilities dataset to write to disk
102
- outpath : str
103
- output path, generally ends in .zarr
104
- chunks_on_disk : Union[Dict, None] = None (Default value = None)
105
- a dictionary with the chunk size that will
106
- be used when writing to disk. For example {'time': 20, 'chan': 6}.
107
- If chunks_on_disk is not specified the chunking of dataset will
108
- be used.
109
- compressor : Union[numcodecs.abc.Codec, None] (Default value = None)
110
- the blosc compressor to use when saving the
111
- converted data to disk using zarr. If None the zstd compression
112
- algorithm used with compression level 2.
113
-
114
- Returns
115
- -------
116
- """
117
-
118
- if compressor is None:
119
- compressor = numcodecs.Blosc(cname="zstd", clevel=2, shuffle=0)
120
-
121
- if os.path.lexists(outpath):
122
- raise ValueError(f"output vis.zarr path ({outpath}) already exists")
123
-
124
- all_start = time.time()
125
-
126
- write_part_keys(cds.partitions, outpath, compressor)
127
-
128
- write_metainfo(outpath, cds.metainfo, chunks_on_disk, compressor)
129
-
130
- write_partitions(outpath, cds.partitions, chunks_on_disk, compressor)
131
-
132
- all_time = time.time() - all_start
133
- logger.info(f"Time to prepare and save dataset to_zarr {outpath}: {all_time}")
@@ -1,78 +0,0 @@
1
- xradio/__init__.py,sha256=82picDsKDBYZRlIpp5JjWsBEf_daXgiLVM7zq6rY_6Q,383
2
- xradio/_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- xradio/_utils/coord_math.py,sha256=n4Td6jcEX4vM49Xseuwrg6USylTGsySS6CND93DEG_8,3587
4
- xradio/_utils/dict_helpers.py,sha256=-g2ZvRufOYACzD7d_8BBFpFwhDFxIm4Psm_TRaVJZ38,2690
5
- xradio/_utils/list_and_array.py,sha256=fW0LDSXlPrSQguSUcZM5oy2Zw-KQVqq9vmmLS8jhc70,4340
6
- xradio/_utils/schema.py,sha256=iF4cU9nmBvYvmG5HxkN3fJN4BFEMmIWiBY15HI7mbbw,7472
7
- xradio/_utils/_casacore/casacore_from_casatools.py,sha256=O26SLSTkKA1y1nXx2yejhxd4lou0vdVcBfvaNpqojiw,30734
8
- xradio/_utils/_casacore/tables.py,sha256=X2_-fpjcxzau8PC3ti9yAyaxrKEqbrSTkMSdVMdduUg,1379
9
- xradio/_utils/zarr/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
- xradio/_utils/zarr/common.py,sha256=egj3Zma0BUK0msOBDozMa-62rHrcxrjCNE5XkkZUq70,5332
11
- xradio/image/__init__.py,sha256=HAD0GfopIbhdxOYckyW6S9US_dSWmZrwIl3FHUzZwrE,435
12
- xradio/image/image.py,sha256=bPgjJoQaur10XEnK7nw66YG68tRKFmdXFlER7GjWh64,14579
13
- xradio/image/_util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
14
- xradio/image/_util/casacore.py,sha256=XiBE2nzkoCv1LX_gvaN6yeB0lgvJO4WaY4HqUiPYYgc,4610
15
- xradio/image/_util/common.py,sha256=y2QJXTHowvjqwNPG5a-cOzl0WneH7c8c9jAVSKQeK2w,8429
16
- xradio/image/_util/fits.py,sha256=gyGm06fuCKqVGK7uv-ObvQNfFawUDsIOa_nQyklM3Aw,329
17
- xradio/image/_util/image_factory.py,sha256=Mm0ZDraD0WoNpGqy98EneFr1PxgfyNZNQwquIH2t0nc,8610
18
- xradio/image/_util/zarr.py,sha256=lhQqVRC1GEWClG3zRbuDr2IlQBfXeDqaLUJIN-MVMxA,1652
19
- xradio/image/_util/_casacore/__init__.py,sha256=OlsiRE40o1jSbBI4khgQQzgfDYbAlOMKIhO4UFlbGhg,41
20
- xradio/image/_util/_casacore/common.py,sha256=2a88YrveQY9x8bcM7SQSn-L5y60W92rLW34OXC5VwSs,1764
21
- xradio/image/_util/_casacore/xds_from_casacore.py,sha256=7JBJwxzJ_K6hb2sE_z3BHlKCXajZOhn8p8UoYw7uLkg,43128
22
- xradio/image/_util/_casacore/xds_to_casacore.py,sha256=Wf_K_SmYqDBKhgdou2lVMW2MmJR03L0mR2dtNbZUIk4,17183
23
- xradio/image/_util/_fits/xds_from_fits.py,sha256=_QakC4_7syLPM9X_g8c94aPeEeGP_R0kVGd8Lqh7umg,29173
24
- xradio/image/_util/_zarr/common.py,sha256=ltlj3uFa-uv8lXlDtV79QnfNmfm0tyhXN5FDAjZtjzg,308
25
- xradio/image/_util/_zarr/xds_from_zarr.py,sha256=KMsfaSSm9kyVoztS6pUzGNxMZzQnCxkk0kDv2GxW5Kw,4451
26
- xradio/image/_util/_zarr/xds_to_zarr.py,sha256=nsDvDD-kuMuMF2dDlj0jTxSW4mdR-jjIsvXHi5uIERU,2373
27
- xradio/image/_util/_zarr/zarr_low_level.py,sha256=xnYm6EmVbmLxMlOSXH32SABfQBLHfr2H9ch9gYwFNXs,13338
28
- xradio/measurement_set/__init__.py,sha256=Vrr1Py50TvbzeZ_VMCswYNz0Wcccbf-iJDj4ArlfcJ0,870
29
- xradio/measurement_set/convert_msv2_to_processing_set.py,sha256=uLZjXplVPXa0XnNa-Fty85k_-fsw6ZC98Hfiwd1WF-U,9704
30
- xradio/measurement_set/load_processing_set.py,sha256=8EPApyGy0Tmzu6Seeby7dKxvtxtAFA585kK50DYVHas,8164
31
- xradio/measurement_set/measurement_set_xdt.py,sha256=kN337gyn7Q8nF4ENy292PYsmBJJLu5ozhJ3FyT5BcVo,11986
32
- xradio/measurement_set/open_processing_set.py,sha256=kMODJmXT2KU12L6Y2NdTV8shvLGb5PgLIOqJgMCzlHI,5308
33
- xradio/measurement_set/processing_set_xdt.py,sha256=CkwBbilEPh3Sy6qTdtfV2bjZ2MhTCGy3A3fYWk7JstA,64413
34
- xradio/measurement_set/schema.py,sha256=V6DdXp5tshtck5VOOvnf4iVAdZ2WCv4Iu42a945wuKg,89867
35
- xradio/measurement_set/_utils/__init__.py,sha256=XE-h1yMfr6tVD6gdUwXO1CVq5SQ6kD_oj-e5TFwslds,97
36
- xradio/measurement_set/_utils/msv2.py,sha256=7hnZMFoQ-s1g0ATjEupLvtdqQCdroPv-Rl5OwjqXjh8,4430
37
- xradio/measurement_set/_utils/zarr.py,sha256=ehXlu0Xh_UZ5Xm2RnHCxESsRZ26c3DQAO5rqMK5MwTk,3947
38
- xradio/measurement_set/_utils/_msv2/chunks.py,sha256=JTPk3il6fk570BjWZMoOAtsbvnLmqPcBv9EPY6A2yOs,2964
39
- xradio/measurement_set/_utils/_msv2/conversion.py,sha256=OErxwczoX6ElZCtftd8bSJIHU_8vdKGVBk8MIT_KTyw,53527
40
- xradio/measurement_set/_utils/_msv2/create_antenna_xds.py,sha256=MhNg-tf1B0OYpLWIq9W9RFKihzsfKw0PGfBxFFgwCj4,17798
41
- xradio/measurement_set/_utils/_msv2/create_field_and_source_xds.py,sha256=UWimMYDf4ZgF8XJpSpnZjt0Jq14kON115PY81qSf01A,37299
42
- xradio/measurement_set/_utils/_msv2/descr.py,sha256=PGY39PYQj0K4th5RUv0jOWszcHlZDt6VQRTOuntCeYI,5213
43
- xradio/measurement_set/_utils/_msv2/msv2_msv3.py,sha256=9AKs2HWly7Ivv_Cjr11dIPGmm33_rtSBoGF9wN5ZwEQ,116
44
- xradio/measurement_set/_utils/_msv2/msv2_to_msv4_meta.py,sha256=gk9gU7g2Lk7dmaiLW8qecOEt574pRtGsCHnUnHXM3D0,1614
45
- xradio/measurement_set/_utils/_msv2/msv4_info_dicts.py,sha256=IzPxzcHKDWwnaFIL4viY9PETMmmFiD3Druasy_5qA6g,7312
46
- xradio/measurement_set/_utils/_msv2/msv4_sub_xdss.py,sha256=vpRbSCSAyHUZB0W7c5Ey7dbiukINojy_W3Giw4QQlk4,31785
47
- xradio/measurement_set/_utils/_msv2/optimised_functions.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
48
- xradio/measurement_set/_utils/_msv2/partition_queries.py,sha256=7r2hU6clFFMu3xtB4nx_d2TF9pXzD2JgFK6tXT286PM,14807
49
- xradio/measurement_set/_utils/_msv2/partitions.py,sha256=_KhRq8bSx2QxuWp9K57fLoLxcU6kvJ35e6wvJ-THbwc,12979
50
- xradio/measurement_set/_utils/_msv2/subtables.py,sha256=_mpOOtHexqhiqEKt7S4LVqImJoNMJKSY18vNVw83r_U,3945
51
- xradio/measurement_set/_utils/_msv2/_tables/load.py,sha256=MEgcinRSciDRfSUSTTu_br03VbiNNCBSuIFNHmf5nL0,1897
52
- xradio/measurement_set/_utils/_msv2/_tables/load_main_table.py,sha256=Z-grLSZTODjp7d-94Cw6kT6-Zf6IYMwcomB0FGfFuv8,14904
53
- xradio/measurement_set/_utils/_msv2/_tables/read.py,sha256=ZPNA5OH6aUkE8_7x7qGw4yhrmDfAx9nhiSLs8RaU1tk,47238
54
- xradio/measurement_set/_utils/_msv2/_tables/read_main_table.py,sha256=vzxIdAnggRx3l3lEpVvwoo9tXbVfdxE9xGQWR8BpWzM,26154
55
- xradio/measurement_set/_utils/_msv2/_tables/read_subtables.py,sha256=VS2NaAt08Sn5ra_GtdtFJRLUM2jy1LErkkVxMEoc0rk,12536
56
- xradio/measurement_set/_utils/_msv2/_tables/table_query.py,sha256=Uc1zeiU-rYtCsYXpij8jzFG5NPBYvIh70qW1srn7B98,1498
57
- xradio/measurement_set/_utils/_msv2/_tables/write.py,sha256=ZaJiqn5HgxJ0WGZPbVzO4mMmfXKq-4pwpqmXTYth79I,9638
58
- xradio/measurement_set/_utils/_msv2/_tables/write_exp_api.py,sha256=-TNUZUMVaHChlx45BwdpXv0cMTeej-f4jgXlzKy-ncE,15609
59
- xradio/measurement_set/_utils/_utils/cds.py,sha256=OpvKowSheIthUbcPEv2AoKmxlEt3DqJZS5C1AYh5z10,1179
60
- xradio/measurement_set/_utils/_utils/partition_attrs.py,sha256=JaePHts_A0EbB4K-0a_uC98RZ2EmfjB9pDSEI11oAwk,3401
61
- xradio/measurement_set/_utils/_utils/stokes_types.py,sha256=DMa8TmmS7BQ99Xm8c7ZjcRapMtLbrKVxrt4f0qUIOvg,561
62
- xradio/measurement_set/_utils/_utils/xds_helper.py,sha256=3BYwpeklJCRJCkkwNU54JbFgibaQOffK6vJzNcwicHI,13229
63
- xradio/measurement_set/_utils/_zarr/encoding.py,sha256=GENIlThV6a9CUCL6gIGlu9c6NR3OFWNos6mpxZjMwDc,536
64
- xradio/measurement_set/_utils/_zarr/read.py,sha256=O9DiwD2Gn8WiatQ-Q6WGGSwjsXwFktG4f81lM-mgcSg,7596
65
- xradio/measurement_set/_utils/_zarr/write.py,sha256=k5IfqtI44Dm4KBDiKFGhL5hN7kwNOulvVHmeP5Mi7N4,10043
66
- xradio/schema/__init__.py,sha256=EzEMnOtN8G_wdjo8QBRKfq5MrYgfr_nt1pfunlI6i6Q,733
67
- xradio/schema/bases.py,sha256=dk24pFhugCe5RjaR41xxP38FxVVsIC9bdmBdsarwFvk,17162
68
- xradio/schema/check.py,sha256=1DAOeW46TC8htQSnMWOy1HkrgeZfhQJ8y9qApzKXkFo,21859
69
- xradio/schema/dataclass.py,sha256=w6FbFtmGnAX4SYwYar7v8-YFf6j40G7g_jvIfVCuxjc,14087
70
- xradio/schema/metamodel.py,sha256=WjtW7pAVzcjLRWifRH3sQoOiN6TV810hARpOIz1M_gw,3845
71
- xradio/schema/typing.py,sha256=8-o6fZd99kJ4FVdgBYRTIRJ-wDqpcUNXzCTfJvl3TIw,10439
72
- xradio/sphinx/__init__.py,sha256=VGY-7Ty3q67qpnBee0-znbiJ-Iy0F93UO--IpjEdHXc,380
73
- xradio/sphinx/schema_table.py,sha256=uq33habbAbReqnEG6ASKSd4UOMZGUzA3qoTX45rq84U,12373
74
- xradio-0.0.56.dist-info/licenses/LICENSE.txt,sha256=9CYIJt7riOXo9AD0eXBZviLxo_HebD-2JJI8oiWtzfg,1807
75
- xradio-0.0.56.dist-info/METADATA,sha256=82A_AvtUlJtGpThOuXEbLbCm247uSuVc9-6z3665n8M,6805
76
- xradio-0.0.56.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
77
- xradio-0.0.56.dist-info/top_level.txt,sha256=dQu27fGBZJ2Yk-gW5XeD-dZ76Xa4Xcvk60Vz-dwXp7k,7
78
- xradio-0.0.56.dist-info/RECORD,,