xradio 0.0.27__py3-none-any.whl → 0.0.29__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 (51) hide show
  1. xradio/__init__.py +5 -4
  2. xradio/_utils/array.py +90 -0
  3. xradio/_utils/zarr/common.py +48 -3
  4. xradio/image/_util/_fits/xds_from_fits.py +10 -5
  5. xradio/image/_util/_zarr/zarr_low_level.py +27 -24
  6. xradio/image/_util/common.py +4 -1
  7. xradio/image/_util/zarr.py +4 -1
  8. xradio/schema/__init__.py +24 -6
  9. xradio/schema/bases.py +440 -2
  10. xradio/schema/check.py +96 -55
  11. xradio/schema/dataclass.py +123 -27
  12. xradio/schema/metamodel.py +21 -4
  13. xradio/schema/typing.py +33 -18
  14. xradio/vis/__init__.py +5 -2
  15. xradio/vis/_processing_set.py +30 -9
  16. xradio/vis/_vis_utils/_ms/_tables/create_field_and_source_xds.py +710 -0
  17. xradio/vis/_vis_utils/_ms/_tables/load.py +23 -10
  18. xradio/vis/_vis_utils/_ms/_tables/load_main_table.py +145 -64
  19. xradio/vis/_vis_utils/_ms/_tables/read.py +782 -156
  20. xradio/vis/_vis_utils/_ms/_tables/read_main_table.py +176 -45
  21. xradio/vis/_vis_utils/_ms/_tables/read_subtables.py +79 -28
  22. xradio/vis/_vis_utils/_ms/_tables/write.py +102 -45
  23. xradio/vis/_vis_utils/_ms/_tables/write_exp_api.py +127 -65
  24. xradio/vis/_vis_utils/_ms/chunks.py +58 -21
  25. xradio/vis/_vis_utils/_ms/conversion.py +536 -67
  26. xradio/vis/_vis_utils/_ms/descr.py +52 -20
  27. xradio/vis/_vis_utils/_ms/msv2_to_msv4_meta.py +70 -35
  28. xradio/vis/_vis_utils/_ms/msv4_infos.py +0 -59
  29. xradio/vis/_vis_utils/_ms/msv4_sub_xdss.py +76 -9
  30. xradio/vis/_vis_utils/_ms/optimised_functions.py +0 -46
  31. xradio/vis/_vis_utils/_ms/partition_queries.py +308 -119
  32. xradio/vis/_vis_utils/_ms/partitions.py +82 -25
  33. xradio/vis/_vis_utils/_ms/subtables.py +32 -14
  34. xradio/vis/_vis_utils/_utils/partition_attrs.py +30 -11
  35. xradio/vis/_vis_utils/_utils/xds_helper.py +136 -45
  36. xradio/vis/_vis_utils/_zarr/read.py +60 -22
  37. xradio/vis/_vis_utils/_zarr/write.py +83 -9
  38. xradio/vis/_vis_utils/ms.py +48 -29
  39. xradio/vis/_vis_utils/zarr.py +44 -20
  40. xradio/vis/convert_msv2_to_processing_set.py +106 -32
  41. xradio/vis/load_processing_set.py +38 -61
  42. xradio/vis/read_processing_set.py +62 -96
  43. xradio/vis/schema.py +687 -0
  44. xradio/vis/vis_io.py +75 -43
  45. {xradio-0.0.27.dist-info → xradio-0.0.29.dist-info}/LICENSE.txt +6 -1
  46. {xradio-0.0.27.dist-info → xradio-0.0.29.dist-info}/METADATA +10 -5
  47. xradio-0.0.29.dist-info/RECORD +73 -0
  48. {xradio-0.0.27.dist-info → xradio-0.0.29.dist-info}/WHEEL +1 -1
  49. xradio/vis/model.py +0 -497
  50. xradio-0.0.27.dist-info/RECORD +0 -71
  51. {xradio-0.0.27.dist-info → xradio-0.0.29.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.vis._vis_utils._ms.optimised_functions import unique_1d
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
- :param inpath: MS path (main table)
24
- :return: tuple with antenna, ddi, spw, and polarization setup subtables info
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
- """Loads a chunk of visibility data. For every DDI, a separate
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
- :param infile: MS path (main table)
55
- :param chunk: specification of chunk to load
56
-
57
- :return: dictionary of chunk datasets (keys are spw and pol_setup IDs)
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
- :param infile: MS path (main table)
101
- :param chunks: chunk xdss
102
- :param chunk_spec: specification of chunk to load
103
-
104
- :return: dictionary of chunk xdss where every xds now has pointing
105
- data variables
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(infile: str, chunk_xds: xr.Dataset, pointing_xds) -> xr.Dataset:
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
- :param infile: MS path (main table)
133
- :param xds_chunk: chunks xds
134
- :param pointing_xds: pointing (sub)table xds
135
-
136
- :return: chunk xds with pointing data variables interpolated form
137
- the pointing (sub)table
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")