xradio 0.0.48__py3-none-any.whl → 0.0.49__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 +1 -0
- xradio/_utils/dict_helpers.py +69 -2
- xradio/image/_util/__init__.py +0 -3
- xradio/image/_util/_casacore/common.py +0 -13
- xradio/image/_util/_casacore/xds_from_casacore.py +102 -97
- xradio/image/_util/_casacore/xds_to_casacore.py +36 -24
- xradio/image/_util/_fits/xds_from_fits.py +81 -36
- xradio/image/_util/_zarr/zarr_low_level.py +3 -3
- xradio/image/_util/casacore.py +7 -5
- xradio/image/_util/common.py +13 -26
- xradio/image/_util/image_factory.py +143 -191
- xradio/image/image.py +10 -59
- xradio/measurement_set/__init__.py +11 -6
- xradio/measurement_set/_utils/_msv2/_tables/read.py +187 -46
- xradio/measurement_set/_utils/_msv2/_tables/table_query.py +22 -0
- xradio/measurement_set/_utils/_msv2/conversion.py +351 -318
- xradio/measurement_set/_utils/_msv2/msv4_info_dicts.py +20 -17
- xradio/measurement_set/convert_msv2_to_processing_set.py +46 -6
- xradio/measurement_set/load_processing_set.py +100 -53
- xradio/measurement_set/measurement_set_xdt.py +197 -0
- xradio/measurement_set/open_processing_set.py +122 -86
- xradio/measurement_set/processing_set_xdt.py +1552 -0
- xradio/measurement_set/schema.py +199 -94
- xradio/schema/bases.py +5 -1
- xradio/schema/check.py +97 -5
- {xradio-0.0.48.dist-info → xradio-0.0.49.dist-info}/METADATA +4 -4
- {xradio-0.0.48.dist-info → xradio-0.0.49.dist-info}/RECORD +30 -30
- {xradio-0.0.48.dist-info → xradio-0.0.49.dist-info}/WHEEL +1 -1
- xradio/measurement_set/measurement_set_xds.py +0 -117
- xradio/measurement_set/processing_set.py +0 -803
- {xradio-0.0.48.dist-info → xradio-0.0.49.dist-info/licenses}/LICENSE.txt +0 -0
- {xradio-0.0.48.dist-info → xradio-0.0.49.dist-info}/top_level.txt +0 -0
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
from astropy.wcs import WCS
|
|
2
|
+
from collections import OrderedDict
|
|
2
3
|
import numpy as np
|
|
3
4
|
import xarray as xr
|
|
4
5
|
from typing import List, Union
|
|
5
6
|
from .common import _c, _compute_world_sph_dims, _l_m_attr_notes
|
|
6
7
|
from xradio._utils.coord_math import _deg_to_rad
|
|
7
|
-
from xradio._utils.dict_helpers import
|
|
8
|
+
from xradio._utils.dict_helpers import (
|
|
9
|
+
make_frequency_reference_dict,
|
|
10
|
+
make_quantity,
|
|
11
|
+
make_skycoord_dict,
|
|
12
|
+
make_time_coord_attrs,
|
|
13
|
+
)
|
|
8
14
|
|
|
9
15
|
|
|
10
16
|
def _input_checks(
|
|
@@ -28,7 +34,7 @@ def _make_coords(
|
|
|
28
34
|
chan_coords = [chan_coords]
|
|
29
35
|
chan_coords = np.array(chan_coords, dtype=np.float64)
|
|
30
36
|
restfreq = chan_coords[len(chan_coords) // 2]
|
|
31
|
-
vel_coords = (1 - chan_coords / restfreq) * _c
|
|
37
|
+
vel_coords = (1 - chan_coords / restfreq) * _c.to("m/s").value
|
|
32
38
|
if not isinstance(time_coords, list) and not isinstance(time_coords, np.ndarray):
|
|
33
39
|
time_coords = [time_coords]
|
|
34
40
|
time_coords = np.array(time_coords, dtype=np.float64)
|
|
@@ -44,126 +50,124 @@ def _add_common_attrs(
|
|
|
44
50
|
cell_size: Union[List[float], np.ndarray],
|
|
45
51
|
projection: str,
|
|
46
52
|
) -> xr.Dataset:
|
|
47
|
-
xds.time.attrs =
|
|
53
|
+
xds.time.attrs = make_time_coord_attrs(units=["d"], scale="utc", time_format="mjd")
|
|
48
54
|
freq_vals = np.array(xds.frequency)
|
|
49
55
|
xds.frequency.attrs = {
|
|
56
|
+
"observer": spectral_reference.lower(),
|
|
57
|
+
"reference_value": make_frequency_reference_dict(
|
|
58
|
+
value=freq_vals[len(freq_vals) // 2].item(),
|
|
59
|
+
units=["Hz"],
|
|
60
|
+
observer=spectral_reference.lower(),
|
|
61
|
+
),
|
|
62
|
+
"rest_frequencies": make_quantity(restfreq, "Hz"),
|
|
50
63
|
"rest_frequency": make_quantity(restfreq, "Hz"),
|
|
51
|
-
"
|
|
52
|
-
"units": "Hz",
|
|
53
|
-
"wave_unit": "mm",
|
|
54
|
-
# "crval": chan_coords[len(chan_coords) // 2],
|
|
55
|
-
"crval": freq_vals[len(freq_vals) // 2].item(),
|
|
56
|
-
"cdelt": (freq_vals[1] - freq_vals[0] if len(freq_vals) > 1 else 1000.0),
|
|
57
|
-
"pc": 1.0,
|
|
64
|
+
"type": "frequency",
|
|
65
|
+
"units": ["Hz"],
|
|
66
|
+
"wave_unit": ["mm"],
|
|
58
67
|
}
|
|
59
|
-
xds.velocity.attrs = {"doppler_type": "
|
|
68
|
+
xds.velocity.attrs = {"doppler_type": "radio", "type": "doppler", "units": "m/s"}
|
|
69
|
+
reference = make_skycoord_dict(
|
|
70
|
+
data=phase_center, units=["rad", "rad"], frame=direction_reference
|
|
71
|
+
)
|
|
72
|
+
reference["attrs"].update({"equinox": "j2000.0"})
|
|
60
73
|
xds.attrs = {
|
|
74
|
+
"data_groups": {"base": {}},
|
|
61
75
|
"direction": {
|
|
62
|
-
"reference":
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
"value": list(phase_center),
|
|
67
|
-
"units": ["rad", "rad"],
|
|
68
|
-
},
|
|
69
|
-
"longpole": make_quantity(np.pi, "rad"),
|
|
70
|
-
"latpole": make_quantity(0.0, "rad"),
|
|
71
|
-
"pc": np.array([[1.0, 0.0], [0.0, 1.0]]),
|
|
76
|
+
"reference": reference,
|
|
77
|
+
"lonpole": make_quantity(np.pi, "rad", ["l", "m"]),
|
|
78
|
+
"latpole": make_quantity(0.0, "rad", ["l", "m"]),
|
|
79
|
+
"pc": [[1.0, 0.0], [0.0, 1.0]],
|
|
72
80
|
"projection": projection,
|
|
73
81
|
"projection_parameters": [0.0, 0.0],
|
|
74
82
|
},
|
|
75
|
-
"active_mask": "",
|
|
76
|
-
"beam": None,
|
|
77
|
-
"object_name": "",
|
|
78
|
-
"obsdate": {
|
|
79
|
-
"type": "time",
|
|
80
|
-
"scale": "UTC",
|
|
81
|
-
"format": "MJD",
|
|
82
|
-
"value": np.array(xds.time)[0],
|
|
83
|
-
"units": "d",
|
|
84
|
-
},
|
|
85
|
-
"observer": "Karl Jansky",
|
|
86
|
-
"pointing_center": {"value": list(phase_center), "initial": True},
|
|
87
|
-
"description": "",
|
|
88
|
-
"telescope": {
|
|
89
|
-
"name": "ALMA",
|
|
90
|
-
"position": {
|
|
91
|
-
"type": "position",
|
|
92
|
-
"ellipsoid": "GRS80",
|
|
93
|
-
"units": ["rad", "rad", "m"],
|
|
94
|
-
"value": [-1.1825465955049892, -0.3994149869262738, 6379946.01326443],
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
"history": None,
|
|
98
83
|
}
|
|
99
84
|
return xds
|
|
100
85
|
|
|
101
86
|
|
|
102
|
-
def
|
|
103
|
-
phase_center: Union[list, np.ndarray],
|
|
104
|
-
image_size: Union[list, np.ndarray],
|
|
105
|
-
cell_size: Union[list, np.ndarray],
|
|
106
|
-
chan_coords: Union[list, np.ndarray],
|
|
87
|
+
def _make_common_coords(
|
|
107
88
|
pol_coords: Union[list, np.ndarray],
|
|
89
|
+
chan_coords: Union[list, np.ndarray],
|
|
108
90
|
time_coords: Union[list, np.ndarray],
|
|
109
|
-
|
|
110
|
-
projection: str,
|
|
111
|
-
spectral_reference: str,
|
|
112
|
-
do_sky_coords: bool,
|
|
113
|
-
) -> xr.Dataset:
|
|
114
|
-
_input_checks(phase_center, image_size, cell_size)
|
|
91
|
+
) -> dict:
|
|
115
92
|
some_coords = _make_coords(chan_coords, time_coords)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
93
|
+
return {
|
|
94
|
+
"coords": {
|
|
95
|
+
"time": some_coords["time"],
|
|
96
|
+
"frequency": some_coords["chan"],
|
|
97
|
+
"velocity": ("frequency", some_coords["vel"]),
|
|
98
|
+
"polarization": pol_coords,
|
|
99
|
+
},
|
|
100
|
+
"restfreq": some_coords["restfreq"],
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def _make_lm_values(
|
|
105
|
+
image_size: Union[list, np.ndarray],
|
|
106
|
+
cell_size: Union[list, np.ndarray],
|
|
107
|
+
) -> dict:
|
|
126
108
|
# l follows RA as far as increasing/decreasing, see AIPS Meme 27, change in alpha
|
|
127
109
|
# definition three lines below Figure 2 and the first of the pair of equations 10.
|
|
128
|
-
|
|
110
|
+
l = [
|
|
129
111
|
(i - image_size[0] // 2) * (-1) * abs(cell_size[0])
|
|
130
112
|
for i in range(image_size[0])
|
|
131
113
|
]
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
114
|
+
m = [(i - image_size[1] // 2) * abs(cell_size[1]) for i in range(image_size[1])]
|
|
115
|
+
return {"l": l, "m": m}
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def _make_sky_coords(
|
|
119
|
+
projection: str,
|
|
120
|
+
image_size: Union[list, np.ndarray],
|
|
121
|
+
cell_size: Union[list, np.ndarray],
|
|
122
|
+
phase_center: Union[list, np.ndarray],
|
|
123
|
+
) -> dict:
|
|
124
|
+
long, lat = _compute_world_sph_dims(
|
|
125
|
+
projection=projection,
|
|
126
|
+
shape=image_size,
|
|
127
|
+
ctype=["RA", "Dec"],
|
|
128
|
+
crpix=[image_size[0] // 2, image_size[1] // 2],
|
|
129
|
+
crval=phase_center,
|
|
130
|
+
cdelt=[-abs(cell_size[0]), abs(cell_size[1])],
|
|
131
|
+
cunit=["rad", "rad"],
|
|
132
|
+
)["value"]
|
|
133
|
+
return {"right_ascension": (("l", "m"), long), "declination": (("l", "m"), lat)}
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def _add_lm_coord_attrs(xds: xr.Dataset) -> xr.Dataset:
|
|
147
137
|
attr_note = _l_m_attr_notes()
|
|
148
138
|
xds.l.attrs = {
|
|
149
|
-
"type": "quantity",
|
|
150
|
-
"crval": 0.0,
|
|
151
|
-
"cdelt": -abs(cell_size[0]),
|
|
152
|
-
"units": "rad",
|
|
153
|
-
"type": "quantity",
|
|
154
139
|
"note": attr_note["l"],
|
|
155
140
|
}
|
|
156
141
|
xds.m.attrs = {
|
|
157
|
-
"type": "quantity",
|
|
158
|
-
"crval": 0.0,
|
|
159
|
-
"cdelt": abs(cell_size[1]),
|
|
160
|
-
"units": "rad",
|
|
161
|
-
"type": "quantity",
|
|
162
142
|
"note": attr_note["m"],
|
|
163
143
|
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def _make_empty_sky_image(
|
|
147
|
+
phase_center: Union[list, np.ndarray],
|
|
148
|
+
image_size: Union[list, np.ndarray],
|
|
149
|
+
cell_size: Union[list, np.ndarray],
|
|
150
|
+
chan_coords: Union[list, np.ndarray],
|
|
151
|
+
pol_coords: Union[list, np.ndarray],
|
|
152
|
+
time_coords: Union[list, np.ndarray],
|
|
153
|
+
direction_reference: str,
|
|
154
|
+
projection: str,
|
|
155
|
+
spectral_reference: str,
|
|
156
|
+
do_sky_coords: bool,
|
|
157
|
+
) -> xr.Dataset:
|
|
158
|
+
_input_checks(phase_center, image_size, cell_size)
|
|
159
|
+
cc = _make_common_coords(pol_coords, chan_coords, time_coords)
|
|
160
|
+
coords = cc["coords"]
|
|
161
|
+
lm_values = _make_lm_values(image_size, cell_size)
|
|
162
|
+
coords.update(lm_values)
|
|
163
|
+
if do_sky_coords:
|
|
164
|
+
coords.update(_make_sky_coords(projection, image_size, cell_size, phase_center))
|
|
165
|
+
xds = xr.Dataset(coords=coords)
|
|
166
|
+
xds = _move_beam_param_dim_coord(xds)
|
|
167
|
+
_add_lm_coord_attrs(xds)
|
|
164
168
|
_add_common_attrs(
|
|
165
169
|
xds,
|
|
166
|
-
|
|
170
|
+
cc["restfreq"],
|
|
167
171
|
spectral_reference,
|
|
168
172
|
direction_reference,
|
|
169
173
|
phase_center,
|
|
@@ -173,6 +177,34 @@ def _make_empty_sky_image(
|
|
|
173
177
|
return xds
|
|
174
178
|
|
|
175
179
|
|
|
180
|
+
def _make_uv_coords(
|
|
181
|
+
xds: xr.Dataset,
|
|
182
|
+
image_size: Union[list, np.ndarray],
|
|
183
|
+
sky_image_cell_size: Union[list, np.ndarray],
|
|
184
|
+
) -> dict:
|
|
185
|
+
uv_values = _make_uv_values(image_size, sky_image_cell_size)
|
|
186
|
+
xds = xds.assign_coords(uv_values)
|
|
187
|
+
attr = make_quantity(0.0, "lambda")
|
|
188
|
+
xds.u.attrs = attr.copy()
|
|
189
|
+
xds.v.attrs = attr.copy()
|
|
190
|
+
return xds
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def _make_uv_values(
|
|
194
|
+
image_size: Union[list, np.ndarray],
|
|
195
|
+
sky_image_cell_size: Union[list, np.ndarray],
|
|
196
|
+
) -> dict:
|
|
197
|
+
im_size_wave = 1 / np.array(sky_image_cell_size)
|
|
198
|
+
uv_cell_size = im_size_wave / np.array(image_size)
|
|
199
|
+
u_vals = [
|
|
200
|
+
(i - image_size[0] // 2) * abs(uv_cell_size[0]) for i in range(image_size[0])
|
|
201
|
+
]
|
|
202
|
+
v_vals = [
|
|
203
|
+
(i - image_size[1] // 2) * abs(uv_cell_size[1]) for i in range(image_size[1])
|
|
204
|
+
]
|
|
205
|
+
return {"u": u_vals, "v": v_vals}
|
|
206
|
+
|
|
207
|
+
|
|
176
208
|
def _make_empty_aperture_image(
|
|
177
209
|
phase_center: Union[list, np.ndarray],
|
|
178
210
|
image_size: Union[list, np.ndarray],
|
|
@@ -185,44 +217,27 @@ def _make_empty_aperture_image(
|
|
|
185
217
|
spectral_reference: str,
|
|
186
218
|
) -> xr.Dataset:
|
|
187
219
|
_input_checks(phase_center, image_size, sky_image_cell_size)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
uv_cell_size = im_size_wave / np.array(image_size)
|
|
191
|
-
u_coords = [
|
|
192
|
-
(i - image_size[0] // 2) * abs(uv_cell_size[0]) for i in range(image_size[0])
|
|
193
|
-
]
|
|
194
|
-
v_coords = [
|
|
195
|
-
(i - image_size[1] // 2) * abs(uv_cell_size[1]) for i in range(image_size[1])
|
|
196
|
-
]
|
|
197
|
-
coords = {
|
|
198
|
-
"time": some_coords["time"],
|
|
199
|
-
"polarization": pol_coords,
|
|
200
|
-
"frequency": some_coords["chan"],
|
|
201
|
-
"velocity": ("frequency", some_coords["vel"]),
|
|
202
|
-
"u": u_coords,
|
|
203
|
-
"v": v_coords,
|
|
204
|
-
}
|
|
220
|
+
cc = _make_common_coords(pol_coords, chan_coords, time_coords)
|
|
221
|
+
coords = cc["coords"]
|
|
205
222
|
xds = xr.Dataset(coords=coords)
|
|
206
|
-
xds
|
|
207
|
-
"crval": 0.0,
|
|
208
|
-
"cdelt": abs(uv_cell_size[0]),
|
|
209
|
-
}
|
|
210
|
-
xds.v.attrs = {
|
|
211
|
-
"crval": 0.0,
|
|
212
|
-
"cdelt": abs(uv_cell_size[1]),
|
|
213
|
-
}
|
|
223
|
+
xds = _make_uv_coords(xds, image_size, sky_image_cell_size)
|
|
214
224
|
_add_common_attrs(
|
|
215
225
|
xds,
|
|
216
|
-
|
|
226
|
+
cc["restfreq"],
|
|
217
227
|
spectral_reference,
|
|
218
228
|
direction_reference,
|
|
219
229
|
phase_center,
|
|
220
230
|
sky_image_cell_size,
|
|
221
231
|
projection,
|
|
222
232
|
)
|
|
233
|
+
xds = _move_beam_param_dim_coord(xds)
|
|
223
234
|
return xds
|
|
224
235
|
|
|
225
236
|
|
|
237
|
+
def _move_beam_param_dim_coord(xds: xr.Dataset) -> xr.Dataset:
|
|
238
|
+
return xds.assign_coords(beam_param=("beam_param", ["major", "minor", "pa"]))
|
|
239
|
+
|
|
240
|
+
|
|
226
241
|
def _make_empty_lmuv_image(
|
|
227
242
|
phase_center: Union[list, np.ndarray],
|
|
228
243
|
image_size: Union[list, np.ndarray],
|
|
@@ -235,81 +250,18 @@ def _make_empty_lmuv_image(
|
|
|
235
250
|
spectral_reference: str,
|
|
236
251
|
do_sky_coords: bool,
|
|
237
252
|
) -> xr.Dataset:
|
|
238
|
-
|
|
239
|
-
some_coords = _make_coords(chan_coords, time_coords)
|
|
240
|
-
if do_sky_coords:
|
|
241
|
-
long, lat = _compute_world_sph_dims(
|
|
242
|
-
projection=projection,
|
|
243
|
-
shape=image_size,
|
|
244
|
-
ctype=["RA", "Dec"],
|
|
245
|
-
crpix=[image_size[0] // 2, image_size[1] // 2],
|
|
246
|
-
crval=phase_center,
|
|
247
|
-
cdelt=[-abs(sky_image_cell_size[0]), abs(sky_image_cell_size[1])],
|
|
248
|
-
cunit=["rad", "rad"],
|
|
249
|
-
)["value"]
|
|
250
|
-
# L follows RA as far as increasing/decreasing, see AIPS Meme 27, change in alpha
|
|
251
|
-
# definition three lines below Figure 2 and the first of the pair of equations 10.
|
|
252
|
-
l_coords = [
|
|
253
|
-
(i - image_size[0] // 2) * (-1) * abs(sky_image_cell_size[0])
|
|
254
|
-
for i in range(image_size[0])
|
|
255
|
-
]
|
|
256
|
-
m_coords = [
|
|
257
|
-
(i - image_size[1] // 2) * abs(sky_image_cell_size[1])
|
|
258
|
-
for i in range(image_size[1])
|
|
259
|
-
]
|
|
260
|
-
# im_size_wave = 1 / np.array(sky_image_cell_size)
|
|
261
|
-
# uv_cell_size = im_size_wave / np.array(image_size)
|
|
262
|
-
uv_cell_size = 1 / (np.array(image_size) * np.array(sky_image_cell_size))
|
|
263
|
-
u_coords = [
|
|
264
|
-
(i - image_size[0] // 2) * abs(uv_cell_size[0]) for i in range(image_size[0])
|
|
265
|
-
]
|
|
266
|
-
v_coords = [
|
|
267
|
-
(i - image_size[1] // 2) * abs(uv_cell_size[1]) for i in range(image_size[1])
|
|
268
|
-
]
|
|
269
|
-
coords = {
|
|
270
|
-
"time": some_coords["time"],
|
|
271
|
-
"polarization": pol_coords,
|
|
272
|
-
"frequency": some_coords["chan"],
|
|
273
|
-
"velocity": ("frequency", some_coords["vel"]),
|
|
274
|
-
"l": l_coords,
|
|
275
|
-
"m": m_coords,
|
|
276
|
-
"u": u_coords,
|
|
277
|
-
"v": v_coords,
|
|
278
|
-
}
|
|
279
|
-
if do_sky_coords:
|
|
280
|
-
coords["right_ascension"] = (("l", "m"), long)
|
|
281
|
-
coords["declination"] = (("l", "m"), lat)
|
|
282
|
-
xds = xr.Dataset(coords=coords)
|
|
283
|
-
attr_note = _l_m_attr_notes()
|
|
284
|
-
xds.l.attrs = {
|
|
285
|
-
"type": "quantity",
|
|
286
|
-
"crval": 0.0,
|
|
287
|
-
"cdelt": -abs(sky_image_cell_size[0]),
|
|
288
|
-
"units": "rad",
|
|
289
|
-
"note": attr_note["l"],
|
|
290
|
-
}
|
|
291
|
-
xds.m.attrs = {
|
|
292
|
-
"type": "quantity",
|
|
293
|
-
"crval": 0.0,
|
|
294
|
-
"cdelt": abs(sky_image_cell_size[1]),
|
|
295
|
-
"units": "rad",
|
|
296
|
-
"note": attr_note["m"],
|
|
297
|
-
}
|
|
298
|
-
xds.u.attrs = {
|
|
299
|
-
"crval": 0.0,
|
|
300
|
-
"cdelt": abs(uv_cell_size[0]),
|
|
301
|
-
}
|
|
302
|
-
xds.v.attrs = {
|
|
303
|
-
"crval": 0.0,
|
|
304
|
-
"cdelt": abs(uv_cell_size[1]),
|
|
305
|
-
}
|
|
306
|
-
_add_common_attrs(
|
|
307
|
-
xds,
|
|
308
|
-
some_coords["restfreq"],
|
|
309
|
-
spectral_reference,
|
|
310
|
-
direction_reference,
|
|
253
|
+
xds = _make_empty_sky_image(
|
|
311
254
|
phase_center,
|
|
255
|
+
image_size,
|
|
312
256
|
sky_image_cell_size,
|
|
257
|
+
chan_coords,
|
|
258
|
+
pol_coords,
|
|
259
|
+
time_coords,
|
|
260
|
+
direction_reference,
|
|
313
261
|
projection,
|
|
262
|
+
spectral_reference,
|
|
263
|
+
do_sky_coords,
|
|
314
264
|
)
|
|
265
|
+
xds = _make_uv_coords(xds, image_size, sky_image_cell_size)
|
|
266
|
+
xds = _move_beam_param_dim_coord(xds)
|
|
315
267
|
return xds
|
xradio/image/image.py
CHANGED
|
@@ -82,7 +82,7 @@ def read_image(
|
|
|
82
82
|
)
|
|
83
83
|
do_casa = False
|
|
84
84
|
if do_casa:
|
|
85
|
-
# next statement is for debug
|
|
85
|
+
# next statement is short circuit for debug, comment out when not debugging
|
|
86
86
|
# return _read_casa_image(infile, chunks, verbose, do_sky_coords)
|
|
87
87
|
try:
|
|
88
88
|
return _read_casa_image(infile, chunks, verbose, do_sky_coords)
|
|
@@ -221,14 +221,14 @@ def make_empty_sky_image(
|
|
|
221
221
|
chan_coords: Union[list, np.ndarray],
|
|
222
222
|
pol_coords: Union[list, np.ndarray],
|
|
223
223
|
time_coords: Union[list, np.ndarray],
|
|
224
|
-
direction_reference: str = "
|
|
224
|
+
direction_reference: str = "fK5",
|
|
225
225
|
projection: str = "SIN",
|
|
226
226
|
spectral_reference: str = "lsrk",
|
|
227
227
|
do_sky_coords: bool = True,
|
|
228
228
|
) -> xr.Dataset:
|
|
229
229
|
"""
|
|
230
230
|
Create an image xarray.Dataset with only coordinates (no datavariables).
|
|
231
|
-
The image dimensionality is time,
|
|
231
|
+
The image dimensionality is time, frequency, polarization, l, m
|
|
232
232
|
|
|
233
233
|
Parameters
|
|
234
234
|
----------
|
|
@@ -244,7 +244,7 @@ def make_empty_sky_image(
|
|
|
244
244
|
The polarization code for each image polarization.
|
|
245
245
|
time_coords : list or np.ndarray
|
|
246
246
|
The time for each temporal plane in MJD.
|
|
247
|
-
direction_reference : str, default = '
|
|
247
|
+
direction_reference : str, default = 'fk5'
|
|
248
248
|
projection : str, default = 'SIN'
|
|
249
249
|
spectral_reference : str, default = 'lsrk'
|
|
250
250
|
do_sky_coords : bool
|
|
@@ -275,13 +275,13 @@ def make_empty_aperture_image(
|
|
|
275
275
|
chan_coords: Union[List[float], np.ndarray],
|
|
276
276
|
pol_coords: Union[List[str], np.ndarray],
|
|
277
277
|
time_coords: Union[List[float], np.ndarray],
|
|
278
|
-
direction_reference: str = "
|
|
278
|
+
direction_reference: str = "fk5",
|
|
279
279
|
projection: str = "SIN",
|
|
280
280
|
spectral_reference: str = "lsrk",
|
|
281
281
|
) -> xr.Dataset:
|
|
282
282
|
"""
|
|
283
283
|
Create an aperture (uv) mage xarray.Dataset with only coordinates (no datavariables).
|
|
284
|
-
The image dimensionality is time,
|
|
284
|
+
The image dimensionality is time, frequency, polarization, u, v
|
|
285
285
|
|
|
286
286
|
Parameters
|
|
287
287
|
----------
|
|
@@ -297,56 +297,7 @@ def make_empty_aperture_image(
|
|
|
297
297
|
The polarization code for each image polarization.
|
|
298
298
|
time_coords : list or np.ndarray
|
|
299
299
|
The time for each temporal plane in MJD.
|
|
300
|
-
direction_reference : str, default = '
|
|
301
|
-
projection : str, default = 'SIN'
|
|
302
|
-
spectral_reference : str, default = 'lsrk'
|
|
303
|
-
Returns
|
|
304
|
-
-------
|
|
305
|
-
xarray.Dataset
|
|
306
|
-
"""
|
|
307
|
-
return _make_empty_aperture_image(
|
|
308
|
-
phase_center,
|
|
309
|
-
image_size,
|
|
310
|
-
sky_image_cell_size,
|
|
311
|
-
chan_coords,
|
|
312
|
-
pol_coords,
|
|
313
|
-
time_coords,
|
|
314
|
-
direction_reference,
|
|
315
|
-
projection,
|
|
316
|
-
spectral_reference,
|
|
317
|
-
)
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
def make_empty_aperture_image(
|
|
321
|
-
phase_center: Union[List[float], np.ndarray],
|
|
322
|
-
image_size: Union[List[int], np.ndarray],
|
|
323
|
-
sky_image_cell_size: Union[List[float], np.ndarray],
|
|
324
|
-
chan_coords: Union[List[float], np.ndarray],
|
|
325
|
-
pol_coords: Union[List[str], np.ndarray],
|
|
326
|
-
time_coords: Union[List[float], np.ndarray],
|
|
327
|
-
direction_reference: str = "FK5",
|
|
328
|
-
projection: str = "SIN",
|
|
329
|
-
spectral_reference: str = "lsrk",
|
|
330
|
-
) -> xr.Dataset:
|
|
331
|
-
"""
|
|
332
|
-
Create an aperture (uv) mage xarray.Dataset with only coordinates (no datavariables).
|
|
333
|
-
The image dimensionality is time, pol, chan, u, v
|
|
334
|
-
|
|
335
|
-
Parameters
|
|
336
|
-
----------
|
|
337
|
-
phase_center : array of float, length = 2, units = rad
|
|
338
|
-
Image phase center.
|
|
339
|
-
image_size : array of int, length = 2
|
|
340
|
-
Number of x and y axis pixels in image.
|
|
341
|
-
sky_image_cell_size : array of float, length = 2, units = rad
|
|
342
|
-
Cell size of x and y axis pixels in sky image, used to get cell size in uv image
|
|
343
|
-
chan_coords : list or np.ndarray
|
|
344
|
-
The center frequency in Hz of each image channel.
|
|
345
|
-
pol_coords : list or np.ndarray
|
|
346
|
-
The polarization code for each image polarization.
|
|
347
|
-
time_coords : list or np.ndarray
|
|
348
|
-
The time for each temporal plane in MJD.
|
|
349
|
-
direction_reference : str, default = 'FK5'
|
|
300
|
+
direction_reference : str, default = 'fk5'
|
|
350
301
|
projection : str, default = 'SIN'
|
|
351
302
|
spectral_reference : str, default = 'lsrk'
|
|
352
303
|
Returns
|
|
@@ -373,14 +324,14 @@ def make_empty_lmuv_image(
|
|
|
373
324
|
chan_coords: Union[List[float], np.ndarray],
|
|
374
325
|
pol_coords: Union[List[float], np.ndarray],
|
|
375
326
|
time_coords: Union[List[float], np.ndarray],
|
|
376
|
-
direction_reference: str = "
|
|
327
|
+
direction_reference: str = "fk5",
|
|
377
328
|
projection: str = "SIN",
|
|
378
329
|
spectral_reference: str = "lsrk",
|
|
379
330
|
do_sky_coords: bool = True,
|
|
380
331
|
) -> xr.Dataset:
|
|
381
332
|
"""
|
|
382
333
|
Create an image xarray.Dataset with only coordinates (no datavariables).
|
|
383
|
-
The image dimensionality is time,
|
|
334
|
+
The image dimensionality is time, frequency, polarization, l, m, u, v
|
|
384
335
|
|
|
385
336
|
Parameters
|
|
386
337
|
----------
|
|
@@ -397,7 +348,7 @@ def make_empty_lmuv_image(
|
|
|
397
348
|
The polarization code for each image polarization.
|
|
398
349
|
time_coords : list or np.ndarray
|
|
399
350
|
The time for each temporal plane in MJD.
|
|
400
|
-
direction_reference : str, default = '
|
|
351
|
+
direction_reference : str, default = 'fk5'
|
|
401
352
|
projection : str, default = 'SIN'
|
|
402
353
|
spectral_reference : str, default = 'lsrk'
|
|
403
354
|
do_sky_coords : bool
|
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
"""
|
|
2
|
+
Processing Set and Measurement Set v4 API. Includes functions and classes to open, load,
|
|
3
|
+
convert, and retrieve information from Processing Set and Measurement Sets nodes of the
|
|
4
|
+
Processing Set DataTree
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .processing_set_xdt import *
|
|
2
8
|
from .open_processing_set import open_processing_set
|
|
3
|
-
from .load_processing_set import load_processing_set, ProcessingSetIterator
|
|
9
|
+
from .load_processing_set import load_processing_set # , ProcessingSetIterator
|
|
4
10
|
from .convert_msv2_to_processing_set import (
|
|
5
11
|
convert_msv2_to_processing_set,
|
|
6
12
|
estimate_conversion_memory_and_cores,
|
|
7
13
|
)
|
|
8
|
-
from .
|
|
9
|
-
|
|
14
|
+
from .measurement_set_xdt import MeasurementSetXdt
|
|
10
15
|
from .schema import SpectrumXds, VisibilityXds
|
|
11
16
|
|
|
12
17
|
__all__ = [
|
|
13
|
-
"
|
|
14
|
-
"
|
|
18
|
+
"ProcessingSetXdt",
|
|
19
|
+
"MeasurementSetXdt",
|
|
15
20
|
"open_processing_set",
|
|
16
21
|
"load_processing_set",
|
|
17
22
|
"ProcessingSetIterator",
|