xradio 0.0.34__py3-none-any.whl → 0.0.36__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/vis/schema.py CHANGED
@@ -14,7 +14,11 @@ Time = Literal["time"]
14
14
  """ Observation time dimension """
15
15
  AntennaId = Literal["antenna_id"]
16
16
  """ Antenna ID dimension """
17
- ReceptorName = Literal["receptor_name"]
17
+ StationId = Literal["station_id"]
18
+ """ Station ID dimension """
19
+ ReceptorId = Literal["receptor_id"]
20
+ """ Receptor ID dimension """
21
+ ReceptorName = Literal["receptor_label"]
18
22
  """ Receptor name dimension """
19
23
  BaselineId = Literal["baseline_id"]
20
24
  """ Baseline ID dimension """
@@ -24,40 +28,73 @@ Polarization = Literal["polarization"]
24
28
  """ Polarization dimension """
25
29
  UvwLabel = Literal["uvw_label"]
26
30
  """ Coordinate dimension of UVW data (typically shape 3 for 'u', 'v', 'w') """
27
- XyzLabel = Literal["xyz_label"]
28
- """ Coordinate dimension of earth location data (typically shape 3 and 'x', 'y', 'z')"""
31
+ SkyDirLabel = Literal["sky_dir_label"]
32
+ """ Coordinate labels of sky directions (typically shape 2 and 'ra', 'dec') """
33
+ SphericalDirLabel = Literal["spherical_dir_label"]
34
+ """ Coordinate labels of spherical directions (shape 2 and 'lon', 'lat1' """
35
+ SkyPosLabel = Literal["sky_pos_label"]
36
+ """ Coordinate labels of sky positions (typically shape 3 and 'ra', 'dec', 'dist') """
37
+ SphericalPosLabel = Literal["spherical_pos_label"]
38
+ """ Coordinate labels of spherical positions (shape shape 3 and 'lon', 'lat1', 'dist2') """
39
+ EllipsoidPosLabel = Literal["ellipsoid_pos_label"]
40
+ """ Coordinate labels of geodetic earth location data (typically shape 3 and 'lon', 'lat', 'height')"""
41
+ CartesianPosLabel = Literal["cartesian_pos_label"]
42
+ """ Coordinate labels of geocentric earth location data (typically shape 3 and 'x', 'y', 'z')"""
29
43
  TimePolynomial = Literal["time_polynomial"]
30
44
  """ For data that is represented as variable in time using Taylor expansion """
31
- SkyCoordLabel = Literal["sky_coord_label"]
32
- """ Unlabeled axis """
45
+ LineLabel = Literal["line_label"]
46
+ """ Line labels (for line names and variables). """
33
47
 
48
+ # Represents "no dimension", i.e. used for coordinates and data variables with
49
+ # zero dimensions.
50
+ ZD = tuple[()]
34
51
 
35
- # Plain data class models
36
- @dict_schema
37
- class SourceInfoDict:
38
- # TODO
39
- pass
52
+ # Quantities
40
53
 
41
54
 
42
55
  @xarray_dataarray_schema
43
56
  class TimeArray:
44
- data: Data[Time, float]
57
+ """
58
+ Representation of a time quantity.
59
+
60
+ :py:class:`astropy.time.Time` serves as the reference implementation.
61
+ Data can be converted as follows::
62
+
63
+ astropy.time.Time(data * astropy.units.Unit(attrs['units'][0]),
64
+ format=attrs['format'], scale=attrs['scale'])
65
+
66
+ All formats that express time as floating point numbers since an epoch
67
+ are permissible, so at present the realistic options are:
68
+
69
+ * ``mjd`` (from 1858-11-17 00:00:00 UTC)
70
+ * ``unix`` (from 1970-01-01 00:00:00 UTC)
71
+ * ``unix_tai`` (from 1970-01-01 00:00:00 TAI)
72
+ * ``cxcsec`` (from 1998-01-01 00:00:00 TT)
73
+ * ``gps`` (from 1980-01-06 00:00:00 UTC)
74
+
75
+ """
76
+
77
+ data: Data[ZD, float]
78
+ """Time since epoch, typically in seconds (see ``units``)."""
45
79
 
46
80
  scale: Attr[str] = "tai"
47
- """Astropy time scales."""
48
- format: Attr[str] = "unix"
49
- """Seconds from 1970-01-01 00:00:00 UTC"""
81
+ """
82
+ Time scale of data. Must be one of ``(‘tai’, ‘tcb’, ‘tcg’, ‘tdb’, ‘tt’, ‘ut1’, ‘utc’)``,
83
+ see :py:class:`astropy.time.Time`
84
+ """
85
+ format: Attr[str] = "unix_tai"
86
+ """Time representation and epoch, see :py:class:`TimeArray`."""
50
87
 
51
88
  type: Attr[str] = "time"
52
- units: Attr[list] = ("s",)
89
+ units: Attr[list[str]] = ("s",)
53
90
 
54
91
 
55
92
  @xarray_dataarray_schema
56
93
  class SkyCoordArray:
57
- data: Data[SkyCoordLabel, float]
94
+ data: Data[Union[SkyDirLabel, SkyPosLabel], float]
58
95
 
59
96
  type: Attr[str] = "sky_coord"
60
- units: Attr[list] = ("rad", "rad")
97
+ units: Attr[list[str]] = ("rad", "rad")
61
98
  frame: Attr[str] = ""
62
99
  """
63
100
  From fixvis docs: clean and the im tool ignore the reference frame
@@ -69,8 +106,61 @@ class SkyCoordArray:
69
106
  """
70
107
 
71
108
 
72
- @dict_schema
73
- class FieldInfoDict:
109
+ @xarray_dataarray_schema
110
+ class SkyCoordOffsetArray:
111
+ data: Data[Union[SkyDirLabel, SkyPosLabel], float]
112
+
113
+ type: Attr[str] = "sky_coord"
114
+ units: Attr[list[str]] = ("rad", "rad")
115
+
116
+
117
+ @xarray_dataarray_schema
118
+ class QuantityArray:
119
+ """
120
+ Anonymous quantity, possibly with associated units
121
+
122
+ Often used for distances / differences (integration time, channel width etcetera).
123
+ """
124
+
125
+ data: Data[ZD, float]
126
+
127
+ units: Attr[list[str]]
128
+ type: Attr[str] = "quantity"
129
+
130
+
131
+ # Coordinates / Axes
132
+ @xarray_dataarray_schema
133
+ class TimeCoordArray:
134
+ """Data model of visibility time axis. See also :py:class:`TimeArray`."""
135
+
136
+ data: Data[Time, float]
137
+ """
138
+ Time, expressed in seconds since the epoch (see ``scale`` &
139
+ ``format``), see also see :py:class:`TimeArray`.
140
+ """
141
+
142
+ integration_time: Optional[Attr[QuantityArray]] = None
143
+ """ The nominal sampling interval (ms v2). Units of seconds. """
144
+ effective_integration_time: Optional[Attr[str]] = None
145
+ """
146
+ Name of data array that contains the integration time that includes
147
+ the effects of missing data.
148
+ """
149
+
150
+ type: Attr[str] = "time"
151
+ """ Coordinate type. Should be ``"time"``. """
152
+ units: Attr[list[str]] = ("s",)
153
+ """ Units to associate with axis"""
154
+ scale: Attr[str] = "tai"
155
+ """ Astropy time scales, see :py:class:`TimeArray` """
156
+ format: Attr[str] = "unix"
157
+ """ Astropy format, see :py:class:`TimeArray`"""
158
+ long_name: Optional[Attr[str]] = "Observation Time"
159
+ """ Long-form name to use for axis"""
160
+
161
+
162
+ @xarray_dataset_schema
163
+ class FieldSourceXds:
74
164
  """
75
165
  Field positions for each source.
76
166
 
@@ -78,52 +168,149 @@ class FieldInfoDict:
78
168
  For single dishes, this is the nominal pointing direction.
79
169
  """
80
170
 
81
- name: str
171
+ source_name: Optional[Coord[Union[ZD, Time], str]]
172
+ """ Source name. """
173
+ field_name: Optional[Coord[Union[ZD, Time], str]]
82
174
  """Field name."""
83
- field_id: int
84
- """Field id"""
85
- code: str
86
- """Field code indicating special characteristics of the field; user specified."""
87
- time_reference: Optional[TimeArray]
88
- """
89
- Time reference for the directions and rates. When used in :py:class:`VisibilityXds` should match
90
- the scale and format given for ``time`` (see :py:class:`TimeArray`).
91
- """
92
- delay_direction: SkyCoordArray
93
175
 
176
+ time: Optional[Coordof[TimeCoordArray]]
177
+ """Midpoint of time for which this set of parameters is accurate"""
94
178
 
95
- @xarray_dataarray_schema
96
- class QuantityArray:
179
+ line_label: Optional[Coord[LineLabel, str]]
180
+ """ Line labels (for line names and variables). """
181
+
182
+ line_names: Optional[Coord[Union[tuple[LineLabel], tuple[Time, LineLabel]], str]]
183
+ """ Line names (e.g. v=1, J=1-0, SiO). """
184
+
185
+ FIELD_PHASE_CENTER: Optional[Data[Union[ZD, Time], SkyCoordOffsetArray]]
186
+ """
187
+ Offset from the SOURCE_DIRECTION that gives the direction of phase
188
+ center for which the fringes have been stopped-that is a point source in
189
+ this direction will produce a constant measured phase (page 2 of
190
+ https://articles.adsabs.harvard.edu/pdf/1999ASPC..180...79F). For
191
+ conversion from MSv2, frame refers column keywords by default. If frame
192
+ varies with field, it refers DelayDir_Ref column instead.
193
+ """
194
+ FIELD_DELAY_CENTER: Optional[
195
+ Data[Union[tuple[SkyDirLabel], tuple[Time, SkyDirLabel]], numpy.float64]
196
+ ]
197
+ """
198
+ Offset from the SOURCE_DIRECTION that gives the direction of delay
199
+ center where coherence is maximized by inserting delay into one element of
200
+ an interferometer to compensate for the geometrical and instrumental
201
+ differential delay. (For conversion from MSv2, frame refers column keywords
202
+ by default. If frame varies with field, it refers PhaseDir_Ref column
203
+ instead.)
204
+ """
205
+
206
+ SOURCE_LOCATION: Optional[
207
+ Data[
208
+ Union[
209
+ tuple[SkyPosLabel],
210
+ tuple[Time, SkyPosLabel],
211
+ tuple[SkyDirLabel],
212
+ tuple[Time, SkyDirLabel],
213
+ ],
214
+ numpy.float64,
215
+ ]
216
+ ]
97
217
  """
98
- Anonymous quantity
218
+ CASA Table Cols: RA,DEC,Rho."Astrometric RA and Dec and Geocentric
219
+ distance with respect to the observer’s location (Geocentric). "Adjusted
220
+ for light-time aberration only. With respect to the reference plane and
221
+ equinox of the chosen system (ICRF or FK4/B1950). If the FK4/B1950 frame
222
+ output is selected, elliptic aberration terms are added. Astrometric RA/DEC
223
+ is generally used when comparing or reducing data against a star catalog."
224
+ https://ssd.jpl.nasa.gov/horizons/manual.html : 1. Astrometric RA & DEC
99
225
  """
100
226
 
101
- data: Data[tuple[()], float]
227
+ LINE_REST_FREQUENCY: Optional[
228
+ Data[Union[tuple[LineLabel], tuple[Time, LineLabel]], numpy.float64]
229
+ ]
230
+ """ Rest frequencies for the transitions. """
231
+
232
+ LINE_SYSTEMIC_VELOCITY: Optional[
233
+ Data[Union[tuple[LineLabel], tuple[Time, LineLabel]], numpy.float64]
234
+ ]
235
+ """ Systemic velocity at reference """
236
+
237
+ SOURCE_RADIAL_VELOCITY: Optional[Data[tuple[Time], numpy.float64]]
238
+ """ CASA Table Cols: RadVel. Geocentric distance rate """
239
+
240
+ NORTH_POLE_POSITION_ANGLE: Optional[Data[tuple[Time], numpy.float64]]
241
+ """ CASA Table cols: NP_ang, "Targets' apparent north-pole position angle (counter-clockwise with respect to direction of true-of-date reference-frame north pole) and angular distance from the sub-observer point (center of disc) at print time. A negative distance indicates the north-pole is on the hidden hemisphere." https://ssd.jpl.nasa.gov/horizons/manual.html : 17. North pole position angle & distance from disc center. """
242
+
243
+ NORTH_POLE_ANGULAR_DISTANCE: Optional[Data[tuple[Time], numpy.float64]]
244
+ """ CASA Table cols: NP_dist, "Targets' apparent north-pole position angle (counter-clockwise with respect to direction of true-of date reference-frame north pole) and angular distance from the sub-observer point (center of disc) at print time. A negative distance indicates the north-pole is on the hidden hemisphere."https://ssd.jpl.nasa.gov/horizons/manual.html : 17. North pole position angle & distance from disc center. """
245
+
246
+ SUB_OBSERVER_DIRECTION: Optional[
247
+ Data[tuple[Time, SphericalDirLabel], numpy.float64]
248
+ ]
249
+ """ CASA Table cols: DiskLong, DiskLat. "Apparent planetodetic longitude and latitude of the center of the target disc seen by the OBSERVER at print-time. This is not exactly the same as the "nearest point" for a non-spherical target shape (since the center of the disc might not be the point closest to the observer), but is generally very close if not a very irregular body shape. The IAU2009 rotation models are used except for Earth and MOON, which use higher-precision models. For the gas giants Jupiter, Saturn, Uranus and Neptune, IAU2009 longitude is based on the "System III" prime meridian rotation angle of the magnetic field. By contrast, pole direction (thus latitude) is relative to the body dynamical equator. There can be an offset between the magnetic pole and the dynamical pole of rotation. Down-leg light travel-time from target to observer is taken into account. Latitude is the angle between the equatorial plane and perpendicular to the reference ellipsoid of the body and body oblateness thereby included. The reference ellipsoid is an oblate spheroid with a single flatness coefficient in which the y-axis body radius is taken to be the same value as the x-axis radius. Whether longitude is positive to the east or west for the target will be indicated at the end of the output ephemeris." https://ssd.jpl.nasa.gov/horizons/manual.html : 14. Observer sub-longitude & sub-latitude """
250
+
251
+ SUB_SOLAR_POSITION: Optional[Data[tuple[Time, SphericalPosLabel], numpy.float64]]
252
+ """ CASA Table cols: Sl_lon, Sl_lat, r. "Heliocentric distance along with "Apparent sub-solar longitude and latitude of the Sun on the target. The apparent planetodetic longitude and latitude of the center of the target disc as seen from the Sun, as seen by the observer at print-time. This is _NOT_ exactly the same as the "sub-solar" (nearest) point for a non-spherical target shape (since the center of the disc seen from the Sun might not be the closest point to the Sun), but is very close if not a highly irregular body shape. Light travel-time from Sun to target and from target to observer is taken into account. Latitude is the angle between the equatorial plane and the line perpendicular to the reference ellipsoid of the body. The reference ellipsoid is an oblate spheroid with a single flatness coefficient in which the y-axis body radius is taken to be the same value as the x-axis radius. Uses IAU2009 rotation models except for Earth and Moon, which uses a higher precision models. Values for Jupiter, Saturn, Uranus and Neptune are Set III, referring to rotation of their magnetic fields. Whether longitude is positive to the east or west for the target will be indicated at the end of the output ephemeris." https://ssd.jpl.nasa.gov/horizons/manual.html : 15. Solar sub-longitude & sub-latitude """
102
253
 
103
- type: Attr[str]
104
- units: Attr[list]
254
+ HELIOCENTRIC_RADIAL_VELOCITY: Optional[Data[tuple[Time], numpy.float64]]
255
+ """ CASA Table cols: rdot."The Sun's apparent range-rate relative to the target, as seen by the observer. A positive "rdot" means the target was moving away from the Sun, negative indicates movement toward the Sun." https://ssd.jpl.nasa.gov/horizons/manual.html : 19. Solar range & range-rate (relative to target) """
256
+
257
+ OBSERVER_PHASE_ANGLE: Optional[Data[tuple[Time], numpy.float64]]
258
+ """ CASA Table cols: phang.""phi" is the true PHASE ANGLE at the observers' location at print time. "PAB-LON" and "PAB-LAT" are the FK4/B1950 or ICRF/J2000 ecliptic longitude and latitude of the phase angle bisector direction; the outward directed angle bisecting the arc created by the apparent vector from Sun to target center and the astrometric vector from observer to target center. For an otherwise uniform ellipsoid, the time when its long-axis is perpendicular to the PAB direction approximately corresponds to lightcurve maximum (or maximum brightness) of the body. PAB is discussed in Harris et al., Icarus 57, 251-258 (1984)." https://ssd.jpl.nasa.gov/horizons/manual.html : Phase angle and bisector """
259
+
260
+ OBSERVER_POSITION: Optional[
261
+ Data[Union[tuple[EllipsoidPosLabel], tuple[CartesianPosLabel]], numpy.float64]
262
+ ]
263
+ """ Observer location. """
264
+
265
+ # --- Attributes ---
266
+ DOPPLER_SHIFT_VELOCITY: Optional[Attr[numpy.float64]]
267
+ """ Velocity definition of the Doppler shift, e.g., RADIO or OPTICAL velocity in m/s """
268
+
269
+ source_model_url: Optional[Attr[str]]
270
+ """URL to access source model"""
271
+ ephemeris_name: Optional[Attr[str]]
272
+ """The name of the ephemeris. For example DE430.
273
+
274
+ This can be used with Astropy solar_system_ephemeris.set('DE430'), see
275
+ https://docs.astropy.org/en/stable/coordinates/solarsystem.html.
276
+ """
277
+ is_ephemeris: Attr[bool] = False
278
+
279
+ # --- Optional coordinates ---
280
+ sky_dir_label: Optional[Coord[SkyDirLabel, str]] = ("ra", "dec")
281
+ """ Coordinate labels of sky directions (typically shape 2 and 'ra', 'dec') """
282
+ sky_pos_label: Optional[Coord[SkyPosLabel, str]] = ("ra", "dec", "dist")
283
+ """ Coordinate lables of sky positions (typically shape 3 and 'ra', 'dec', 'dist') """
284
+ ellipsoid_pos_label: Optional[Coord[EllipsoidPosLabel, str]] = (
285
+ "lon",
286
+ "lat",
287
+ "height",
288
+ )
289
+ """ Coordinate labels of geodetic earth location data (typically shape 3 and 'lon', 'lat', 'height')"""
290
+ cartesian_pos_label: Optional[Coord[CartesianPosLabel, str]] = ("x", "y", "z")
291
+ """ Coordinate labels of geocentric earth location data (typically shape 3 and 'x', 'y', 'z')"""
105
292
 
106
293
 
107
294
  @xarray_dataarray_schema
108
295
  class SpectralCoordArray:
109
- data: Data[tuple[()], float]
296
+ data: Data[ZD, float]
110
297
 
111
298
  frame: Attr[str] = "gcrs"
112
299
  """Astropy time scales."""
113
300
 
114
301
  type: Attr[str] = "frequency"
115
- units: Attr[list] = ("Hz",)
302
+ units: Attr[list[str]] = ("Hz",)
116
303
 
117
304
 
118
305
  @xarray_dataarray_schema
119
306
  class EarthLocationArray:
120
- data: Data[XyzLabel, float]
307
+ data: Data[CartesianPosLabel, float]
121
308
 
122
309
  ellipsoid: Attr[str]
123
310
  """
124
311
  ITRF makes use of GRS80 ellipsoid and WGS84 makes use of WGS84 ellipsoid
125
312
  """
126
- units: Attr[list] = ("m", "m", "m")
313
+ units: Attr[list[str]] = ("m", "m", "m")
127
314
  """
128
315
  If the units are a list of strings then it must be the same length as
129
316
  the last dimension of the data array. This allows for having different
@@ -134,7 +321,7 @@ class EarthLocationArray:
134
321
 
135
322
  @dict_schema
136
323
  class ObservationInfoDict:
137
- observer: List[str]
324
+ observer: list
138
325
  """List of observer names."""
139
326
  project: str
140
327
  """Project Code/Project_UID"""
@@ -169,41 +356,6 @@ class ProcessorInfoDict:
169
356
  """Processor sub-type, e.g. ”GBT” or ”JIVE”."""
170
357
 
171
358
 
172
- # Coordinates / Axes
173
- @xarray_dataarray_schema
174
- class TimeArray:
175
- """Data model of time axis"""
176
-
177
- data: Data[Time, float]
178
- """ Time, expressed in SI seconds since the epoch (see ``scale`` & ``format``). """
179
-
180
- integration_time: Attr[Optional[TimeArray]] = None
181
- """ The nominal sampling interval (ms v2). Units of seconds. """
182
- effective_integration_time: Attr[Optional[TimeArray]] = None
183
- """ Name of data array that contains the integration time that includes the effects of missing data. """
184
-
185
- type: Attr[str] = "time"
186
- """ Coordinate type. Should be ``"time"``. """
187
- units: Attr[list[str]] = ("s",)
188
- """ Units to associate with axis"""
189
- scale: Attr[str] = "tai"
190
- """ Astropy time scales, see :py:class:`astropy.time.Time` """
191
- format: Attr[str] = "unix"
192
- """ Astropy format, see :py:class:`astropy.time.Time`. Default seconds from 1970-01-01 00:00:00 UTC """
193
- long_name: Optional[Attr[str]] = "Observation Time"
194
- """ Long-form name to use for axis"""
195
-
196
-
197
- @xarray_dataarray_schema
198
- class AntennaArray:
199
- data: Data[AntennaId, int]
200
- """
201
- Antenna id of an antenna. Maps to ``antenna_id``
202
- in :py:class:`AntennaXds`.
203
- """
204
- long_name: Optional[Attr[str]] = "Antenna ID"
205
-
206
-
207
359
  @xarray_dataarray_schema
208
360
  class BaselineArray:
209
361
  """TODO: documentation"""
@@ -237,14 +389,14 @@ class FrequencyArray:
237
389
  """ Time, expressed in SI seconds since the epoch. """
238
390
  spectral_window_name: Attr[str]
239
391
  """ Name associated with spectral window. """
240
- frequency_group_name: Attr[str]
392
+ frequency_group_name: Optional[Attr[str]]
241
393
  """ Name associated with frequency group - needed for multi-band VLBI fringe-fitting."""
242
394
  reference_frequency: Attr[SpectralCoordArray]
243
395
  """ A frequency representative of the spectral window, usually the sky
244
396
  frequency corresponding to the DC edge of the baseband. Used by the calibration
245
397
  system if a fixed scaling frequency is required or in algorithms to identify the
246
398
  observing band. """
247
- channel_width: Attr[SpectralCoordArray]
399
+ channel_width: Attr[QuantityArray] # Not SpectralCoord, as it is a difference
248
400
  """ The nominal channel bandwidth. Same units as data array (see units key). """
249
401
  doppler: Optional[Attr[DopplerXds]]
250
402
  """ Doppler tracking information """
@@ -312,14 +464,42 @@ class VisibilityArray:
312
464
  tuple[Time, BaselineId, Frequency, Polarization],
313
465
  Union[numpy.complex64, numpy.complex128],
314
466
  ]
315
- time: Coord[tuple[()], TimeArray]
467
+
468
+ time: Coord[tuple[()], TimeCoordArray]
316
469
  baseline_id: Coord[tuple[()], BaselineArray]
317
- frequency: Coord[tuple[()], FrequencyArray]
318
470
  polarization: Coord[tuple[()], PolarizationArray]
319
- field_info: Attr[FieldInfoDict]
471
+ frequency: Coord[tuple[()], FrequencyArray]
472
+ time: Coord[ZD, TimeCoordArray]
473
+ baseline_id: Coord[ZD, BaselineArray]
474
+ polarization: Coord[ZD, PolarizationArray]
475
+ frequency: Coord[ZD, FrequencyArray]
476
+
477
+ field_and_source_xds: Attr[FieldSourceXds]
320
478
  long_name: Optional[Attr[str]] = "Visibility values"
321
479
  """ Long-form name to use for axis. Should be ``"Visibility values"``"""
322
- units: Attr[list] = ("Jy",)
480
+ units: Attr[list[str]] = ("Jy",)
481
+
482
+
483
+ @xarray_dataarray_schema
484
+ class SpectrumArray:
485
+ """Definition of xr.DataArray for SPECTRUM data (single dish)"""
486
+
487
+ data: Data[
488
+ tuple[Time, BaselineId, Frequency, Polarization],
489
+ Union[numpy.float64, numpy.float32, numpy.float16],
490
+ ]
491
+ time: Coord[tuple[()], TimeCoordArray]
492
+
493
+ # in the spreadsheet this is antenna_id:
494
+ # antenna_id: Coord[AntennaId, Union[int, numpy.int32]]
495
+ baseline_id: Coord[tuple[()], BaselineArray]
496
+
497
+ polarization: Coord[tuple[()], PolarizationArray]
498
+ frequency: Coord[tuple[()], FrequencyArray]
499
+ field_and_source_xds: Attr[FieldSourceXds]
500
+ long_name: Optional[Attr[str]] = "Spectrum values"
501
+ """ Long-form name to use for axis. Should be ``"Spectrum values"``"""
502
+ units: Attr[list[str]] = ("Jy",)
323
503
 
324
504
 
325
505
  @xarray_dataarray_schema
@@ -338,7 +518,7 @@ class FlagArray:
338
518
  ],
339
519
  bool,
340
520
  ]
341
- time: Coordof[TimeArray]
521
+ time: Coordof[TimeCoordArray]
342
522
  baseline_id: Coordof[BaselineArray]
343
523
  frequency: Coordof[FrequencyArray]
344
524
  polarization: Optional[Coordof[PolarizationArray]] = None
@@ -364,7 +544,7 @@ class WeightArray:
364
544
  Union[numpy.float16, numpy.float32, numpy.float64],
365
545
  ]
366
546
  """Visibility weights"""
367
- time: Coordof[TimeArray]
547
+ time: Coordof[TimeCoordArray]
368
548
  baseline_id: Coordof[BaselineArray]
369
549
  frequency: Optional[Coordof[FrequencyArray]] = None
370
550
  polarization: Optional[Coordof[PolarizationArray]] = None
@@ -414,7 +594,7 @@ class UvwArray:
414
594
  ],
415
595
  ]
416
596
  """Baseline coordinates from ``baseline_antenna2_id`` to ``baseline_antenna1_id``"""
417
- time: Coordof[TimeArray]
597
+ time: Coordof[TimeCoordArray]
418
598
  baseline_id: Coordof[BaselineArray]
419
599
  frequency: Optional[Coordof[FrequencyArray]] = None
420
600
  polarization: Optional[Coordof[PolarizationArray]] = None
@@ -437,7 +617,7 @@ class TimeSamplingArray:
437
617
  float,
438
618
  ]
439
619
 
440
- time: Coordof[TimeArray]
620
+ time: Coordof[TimeCoordArray]
441
621
  baseline_id: Coordof[BaselineArray]
442
622
  frequency: Optional[Coordof[FrequencyArray]] = None
443
623
  polarization: Optional[Coordof[PolarizationArray]] = None
@@ -448,7 +628,7 @@ class TimeSamplingArray:
448
628
  """ Astropy format, see :py:class:`astropy.time.Time`. Default seconds from 1970-01-01 00:00:00 UTC """
449
629
 
450
630
  long_name: Optional[Attr[str]] = "Time sampling data"
451
- units: Attr[str] = "s"
631
+ units: Attr[list[str]] = ("s",)
452
632
 
453
633
 
454
634
  @xarray_dataarray_schema
@@ -470,11 +650,11 @@ class FreqSamplingArray:
470
650
  :py:class:`VisibilityXds`.
471
651
  """
472
652
  frequency: Coordof[FrequencyArray]
473
- time: Optional[Coordof[TimeArray]] = None
653
+ time: Optional[Coordof[TimeCoordArray]] = None
474
654
  baseline_id: Optional[Coordof[BaselineArray]] = None
475
655
  polarization: Optional[Coordof[PolarizationArray]] = None
476
656
  long_name: Optional[Attr[str]] = "Frequency sampling data"
477
- units: Attr[str] = "Hz"
657
+ units: Attr[list[str]] = ("Hz",)
478
658
  frame: Attr[str] = "icrs"
479
659
  """
480
660
  Astropy velocity reference frames (see :external:ref:`astropy-spectralcoord`).
@@ -487,10 +667,26 @@ class FreqSamplingArray:
487
667
  # Data Sets
488
668
 
489
669
 
670
+ @xarray_dataset_schema
671
+ class AntennaXdsEmptyWhileRevampedTODO:
672
+ """Minimal placeholder so that it shows in the main xds
673
+ docs. TODO: update AntennaXds once review moves on
674
+ """
675
+
676
+ antenna_name: Coord[Literal["antenna_name"], str]
677
+ receptor_label: Optional[Coord[ReceptorName, str]]
678
+ cartesian_pos_label: Coord[CartesianPosLabel, str]
679
+ sky_dir_label: Optional[Coord[SkyDirLabel, str]]
680
+ gain_curve_time: Optional[Coord[Literal["gain_curve_time"], numpy.float64]]
681
+ poly_term: Optional[Coord[Literal["poly_term"], numpy.int64]]
682
+ phase_cal_time: Optional[Coord[Literal["phase_cal_time"], numpy.float64]]
683
+ tone_label: Optional[Coord[Literal["tone_label"], numpy.int64]]
684
+
685
+
490
686
  @xarray_dataset_schema
491
687
  class AntennaXds:
492
688
  # --- Coordinates ---
493
- antenna_id: Coordof[AntennaArray]
689
+ antenna_id: Coord[AntennaId, Union[int, numpy.int32]]
494
690
  """Antenna ID"""
495
691
  name: Coord[AntennaId, str]
496
692
 
@@ -513,22 +709,22 @@ class AntennaXds:
513
709
  """Support for VLBI"""
514
710
  receptor_name: Optional[Coord[ReceptorName, str]]
515
711
  """Names of receptors"""
516
- xyz_label: Coord[XyzLabel, str]
712
+ cartesian_pos_label: Coord[CartesianPosLabel, str]
517
713
  """Coordinate dimension of earth location data (typically shape 3 and 'x', 'y', 'z')"""
518
- sky_coord_label: Optional[Coord[SkyCoordLabel, str]]
714
+ sky_dir_label: Optional[Coord[SkyDirLabel, str]]
519
715
  """Coordinate dimension of sky coordinate data (possibly shape 2 and 'RA', "Dec")"""
520
716
 
521
717
  # --- Data variables ---
522
- POSITION: Data[AntennaId, EarthLocationArray]
718
+ ANTENNA_POSITION: Data[AntennaId, EarthLocationArray]
523
719
  """
524
720
  In a right-handed frame, X towards the intersection of the equator and
525
721
  the Greenwich meridian, Z towards the pole.
526
722
  """
527
- FEED_OFFSET: Data[tuple[AntennaId, XyzLabel], QuantityArray]
723
+ ANTENNA_FEED_OFFSET: Data[tuple[AntennaId, CartesianPosLabel], QuantityArray]
528
724
  """
529
725
  Offset of feed relative to position (``Antenna_Table.offset + Feed_Table.position``).
530
726
  """
531
- DISH_DIAMETER: Data[AntennaId, QuantityArray]
727
+ ANTENNA_DISH_DIAMETER: Data[AntennaId, QuantityArray]
532
728
  """
533
729
  Nominal diameter of dish, as opposed to the effective diameter.
534
730
  """
@@ -559,18 +755,28 @@ class AntennaXds:
559
755
  """
560
756
 
561
757
 
758
+ @xarray_dataset_schema
759
+ class WeatherXds:
760
+ """TODO: largely incomplete"""
761
+
762
+ station_id: Coord[StationId, numpy.int64]
763
+ """ Station identifier """
764
+ time: Coord[Time, numpy.float64]
765
+ """ Mid-point of the time interval """
766
+
767
+
562
768
  @xarray_dataset_schema
563
769
  class PointingXds:
564
- time: Coordof[TimeArray]
770
+ time: Coordof[TimeCoordArray]
565
771
  """
566
772
  Mid-point of the time interval for which the information in this row is
567
773
  valid. Required to use the same time measure reference as in visibility dataset
568
774
  """
569
- antenna_id: Coordof[AntennaArray]
775
+ antenna_id: Coord[AntennaId, Union[int, numpy.int32]]
570
776
  """
571
777
  Antenna identifier, as specified by baseline_antenna1/2_id in visibility dataset
572
778
  """
573
- sky_coord_label: Coord[SkyCoordLabel, str]
779
+ sky_dir_label: Coord[SkyDirLabel, str]
574
780
  """
575
781
  Direction labels.
576
782
  """
@@ -597,15 +803,21 @@ class SpectralCoordXds:
597
803
 
598
804
 
599
805
  @xarray_dataset_schema
600
- class SourceXds:
806
+ class PhasedArrayXds:
601
807
  # TODO
602
808
  pass
603
809
 
604
810
 
605
811
  @xarray_dataset_schema
606
- class PhasedArrayXds:
607
- # TODO
608
- pass
812
+ class SystemCalibrationXds:
813
+ """TODO: largely incomplete"""
814
+
815
+ antenna_id: Coord[AntennaId, Union[int, numpy.int32]]
816
+ """ Antenna identifier """
817
+ time: Coord[Time, numpy.float64]
818
+ """ Midpoint of time for which this set of parameters is accurate """
819
+ receptor_id: Coord[ReceptorId, numpy.float64]
820
+ """ """
609
821
 
610
822
 
611
823
  @xarray_dataset_schema
@@ -613,7 +825,7 @@ class VisibilityXds:
613
825
  """TODO: documentation"""
614
826
 
615
827
  # --- Required Coordinates ---
616
- time: Coordof[TimeArray]
828
+ time: Coordof[TimeCoordArray]
617
829
  """
618
830
  The time coordinate is the mid-point of the nominal sampling interval, as
619
831
  specified in the ``ms_v4.time.attrs['integration_time']`` (ms v2 interval).
@@ -627,11 +839,10 @@ class VisibilityXds:
627
839
  """
628
840
  uvw_label: Optional[Coordof[UvwLabelArray]]
629
841
 
630
- # --- Required data variables ---
631
- VISIBILITY: Dataof[VisibilityArray]
632
-
633
842
  # --- Required Attributes ---
634
- antenna_xds: Attr[AntennaXds]
843
+ # TODO: on hold while antenna_xds is reviewed/ updated
844
+ # antenna_xds: Attr[AntennaXds]
845
+ # antenna_xds: Attr[AntennaXdsEmptyWhileRevampedTODO]
635
846
 
636
847
  # --- Optional Coordinates ---
637
848
  baseline_antenna1_id: Optional[Coordof[BaselineAntennaArray]] = None
@@ -641,12 +852,33 @@ class VisibilityXds:
641
852
  scan_id: Optional[Coord[Time, int]] = None
642
853
  """Arbitary scan number to identify data taken in the same logical scan."""
643
854
 
855
+ # --- Required data variables ---
856
+
644
857
  # --- Optional data variables / arrays ---
858
+
859
+ # Either VISIBILITY (interferometry) or SPECTRUM (single-dish)
860
+ VISIBILITY: Optional[Dataof[VisibilityArray]] = None
645
861
  """Complex visibilities, either simulated or measured by interferometer."""
862
+ SPECTRUM: Optional[Dataof[SpectrumArray]] = None
863
+ """Single dish data, either simulated or measured by an antenna."""
864
+
865
+ VISIBILITY_CORRECTED: Optional[Dataof[VisibilityArray]] = None
866
+ VISIBILITY_MODEL: Optional[Dataof[VisibilityArray]] = None
867
+ SPECTRUM_CORRECTED: Optional[Dataof[SpectrumArray]] = None
868
+
646
869
  FLAG: Optional[Dataof[FlagArray]] = None
647
870
  WEIGHT: Optional[Dataof[WeightArray]] = None
648
871
  UVW: Optional[Dataof[UvwArray]] = None
649
- EFFECTIVE_INTEGRATION_TIME: Optional[Dataof[TimeSamplingArray]] = None
872
+ EFFECTIVE_INTEGRATION_TIME: Optional[
873
+ Data[
874
+ Union[
875
+ tuple[Time, BaselineId],
876
+ tuple[Time, BaselineId, Frequency],
877
+ tuple[Time, BaselineId, Frequency, Polarization],
878
+ ],
879
+ QuantityArray,
880
+ ]
881
+ ] = None
650
882
  """
651
883
  The integration time, including the effects of missing data, in contrast to
652
884
  ``integration_time`` attribute of the ``time`` coordinate,
@@ -665,11 +897,12 @@ class VisibilityXds:
665
897
  """Includes the effects of missing data unlike ``frequency``."""
666
898
 
667
899
  # --- Optional Attributes ---
668
- pointing_xds: Optional[Attr[PointingXds]] = None
669
- source_xds: Optional[Attr[SourceXds]] = None
670
- pased_array_xds: Optional[Attr[PhasedArrayXds]] = None
671
900
  observation_info: Optional[Attr[ObservationInfoDict]] = None
672
- observation_info: Optional[Attr[ProcessorInfoDict]] = None
901
+ processor_info: Optional[Attr[ProcessorInfoDict]] = None
902
+ weather_xds: Optional[Attr[WeatherXds]] = None
903
+ pointing_xds: Optional[Attr[PointingXds]] = None
904
+ phased_array_xds: Optional[Attr[PhasedArrayXds]] = None
905
+ system_calibration_xds: Optional[Attr[SystemCalibrationXds]] = None
673
906
 
674
907
  version: Optional[Attr[str]] = None # TODO:
675
908
  """Semantic version of xradio data format"""
@@ -685,3 +918,6 @@ class VisibilityXds:
685
918
  """
686
919
 
687
920
  type: Attr[str] = "visibility"
921
+ """
922
+ Dataset type
923
+ """