xradio 0.0.47__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.
Files changed (38) hide show
  1. xradio/__init__.py +1 -0
  2. xradio/_utils/dict_helpers.py +69 -2
  3. xradio/_utils/list_and_array.py +3 -1
  4. xradio/_utils/schema.py +3 -1
  5. xradio/image/_util/__init__.py +0 -3
  6. xradio/image/_util/_casacore/common.py +0 -13
  7. xradio/image/_util/_casacore/xds_from_casacore.py +102 -97
  8. xradio/image/_util/_casacore/xds_to_casacore.py +36 -24
  9. xradio/image/_util/_fits/xds_from_fits.py +81 -36
  10. xradio/image/_util/_zarr/zarr_low_level.py +3 -3
  11. xradio/image/_util/casacore.py +7 -5
  12. xradio/image/_util/common.py +13 -26
  13. xradio/image/_util/image_factory.py +143 -191
  14. xradio/image/image.py +10 -59
  15. xradio/measurement_set/__init__.py +11 -6
  16. xradio/measurement_set/_utils/_msv2/_tables/read.py +187 -46
  17. xradio/measurement_set/_utils/_msv2/_tables/table_query.py +22 -0
  18. xradio/measurement_set/_utils/_msv2/conversion.py +347 -299
  19. xradio/measurement_set/_utils/_msv2/create_field_and_source_xds.py +233 -150
  20. xradio/measurement_set/_utils/_msv2/descr.py +1 -1
  21. xradio/measurement_set/_utils/_msv2/msv4_info_dicts.py +20 -13
  22. xradio/measurement_set/_utils/_msv2/msv4_sub_xdss.py +21 -22
  23. xradio/measurement_set/convert_msv2_to_processing_set.py +46 -6
  24. xradio/measurement_set/load_processing_set.py +100 -52
  25. xradio/measurement_set/measurement_set_xdt.py +197 -0
  26. xradio/measurement_set/open_processing_set.py +122 -86
  27. xradio/measurement_set/processing_set_xdt.py +1552 -0
  28. xradio/measurement_set/schema.py +375 -197
  29. xradio/schema/bases.py +5 -1
  30. xradio/schema/check.py +97 -5
  31. xradio/sphinx/schema_table.py +12 -0
  32. {xradio-0.0.47.dist-info → xradio-0.0.49.dist-info}/METADATA +4 -4
  33. {xradio-0.0.47.dist-info → xradio-0.0.49.dist-info}/RECORD +36 -36
  34. {xradio-0.0.47.dist-info → xradio-0.0.49.dist-info}/WHEEL +1 -1
  35. xradio/measurement_set/measurement_set_xds.py +0 -117
  36. xradio/measurement_set/processing_set.py +0 -777
  37. {xradio-0.0.47.dist-info → xradio-0.0.49.dist-info/licenses}/LICENSE.txt +0 -0
  38. {xradio-0.0.47.dist-info → xradio-0.0.49.dist-info}/top_level.txt +0 -0
@@ -9,10 +9,12 @@ from xradio.schema.bases import (
9
9
  from xradio.schema.typing import Attr, Coord, Coordof, Data, Dataof, Name
10
10
  import numpy
11
11
 
12
+ MSV4_SCHEMA_VERSION = "4.0.-9988"
13
+
12
14
  # Dimensions
13
15
  Time = Literal["time"]
14
16
  """ Observation time dimension """
15
- TimeCal = Literal["time_cal"]
17
+ TimeSystemCal = Literal["time_system_cal"]
16
18
  """ time dimension of system calibration (when not interpolated to main time)"""
17
19
  TimeEphemeris = Literal["time_ephemeris"]
18
20
  """ time dimension of ephemeris data (when not interpolated to main time) """
@@ -34,7 +36,7 @@ BaselineId = Literal["baseline_id"]
34
36
  """ Baseline ID dimension """
35
37
  Frequency = Literal["frequency"]
36
38
  """ Frequency dimension """
37
- FrequencyCal = Literal["frequency_cal"]
39
+ FrequencySystemCal = Literal["frequency_system_cal"]
38
40
  """ Frequency dimension in the system calibration dataset """
39
41
  Polarization = Literal["polarization"]
40
42
  """ Polarization dimension """
@@ -60,6 +62,8 @@ PolyTerm = Literal["poly_term"]
60
62
  """ Polynomial term used in VLBI GAIN_CURVE """
61
63
  LineLabel = Literal["line_label"]
62
64
  """ Line labels (for line names and variables). """
65
+ FieldName = Literal["field_name"]
66
+ """ Field names dimension. """
63
67
 
64
68
  # Represents "no dimension", i.e. used for coordinates and data variables with
65
69
  # zero dimensions.
@@ -379,7 +383,7 @@ class TimeInterpolatedCoordArray:
379
383
  Data model of a time axis when it is interpolated to match the time
380
384
  axis of the main dataset. This can be used in the system_calibration_xds,
381
385
  pointing_xds, weather_xds, field_and_source_info_xds, and phase_cal_xds
382
- when their respective time_cal, time_pointing, time_weather,
386
+ when their respective time_system_cal, time_pointing, time_weather,
383
387
  time_ephemeris or time_phase_cal are interpolated to the main dataset
384
388
  time. See also :py:class:`TimeArray`.
385
389
 
@@ -407,19 +411,19 @@ class TimeInterpolatedCoordArray:
407
411
 
408
412
 
409
413
  @xarray_dataarray_schema
410
- class TimeCalCoordArray:
411
- """Data model of 'time_cal' axis (time axis in system_calibration_xds
414
+ class TimeSystemCalCoordArray:
415
+ """Data model of 'time_system_cal' axis (time axis in system_calibration_xds
412
416
  subdataset when not interpolated to the main time axis. See also
413
417
  :py:class:`TimeCoordArray`."""
414
418
 
415
- data: Data[TimeCal, float]
419
+ data: Data[TimeSystemCal, float]
416
420
  """
417
421
  Time, expressed in seconds since the epoch (see ``scale`` &
418
422
  ``format``).
419
423
  """
420
424
 
421
- type: Attr[Time] = "time_cal"
422
- """ Coordinate type. Should be ``"time_cal"``. """
425
+ type: Attr[Time] = "time_system_cal"
426
+ """ Coordinate type. Should be ``"time_system_cal"``. """
423
427
 
424
428
  units: Attr[UnitsSeconds] = ("s",)
425
429
  """ Units to associate with axis"""
@@ -627,7 +631,7 @@ class EllipsoidPosLocationArray:
627
631
 
628
632
  @xarray_dataarray_schema
629
633
  class BaselineArray:
630
- """Model of the baseline_id coordinate in the main dataset (interferometric data, :py:class:`VisibiiltyXds`)"""
634
+ """Model of the baseline_id coordinate in the main dataset (interferometric data, :py:class:`VisibilityXds`)"""
631
635
 
632
636
  data: Data[BaselineId, Union[numpy.int64, numpy.int32]]
633
637
  """Unique id for each baseline."""
@@ -668,7 +672,7 @@ class DopplerArray:
668
672
  data: Data[ZD, numpy.float64]
669
673
 
670
674
  type: Attr[Doppler] = "doppler"
671
- """ Coordinate type. Should be ``"spectral_coord"``. """
675
+ """ Coordinate type. Should be ``"doppler"``. """
672
676
 
673
677
  units: Attr[UnitsOfDopplerShift] = ("m/s",)
674
678
  """ Units to associate with axis, [ratio]/[m/s]"""
@@ -718,11 +722,11 @@ class FrequencyArray:
718
722
 
719
723
 
720
724
  @xarray_dataarray_schema
721
- class FrequencyCalArray:
722
- """The frequency_cal coordinate of the system calibration dataset. It has
725
+ class FrequencySystemCalArray:
726
+ """The frequency_system_cal coordinate of the system calibration dataset. It has
723
727
  only measures data, as opposed to the frequency array of the main dataset."""
724
728
 
725
- data: Data[FrequencyCal, float]
729
+ data: Data[FrequencySystemCal, float]
726
730
  """ Center frequencies for each channel. """
727
731
 
728
732
  type: Attr[SpectralCoord] = "spectral_coord"
@@ -786,11 +790,18 @@ class FlagArray:
786
790
  flagged bad if the ``FLAG`` array element is ``True``.
787
791
  """
788
792
 
793
+ # data: Data[
794
+ # Union[
795
+ # tuple[Time, BaselineId, Frequency, Polarization],
796
+ # tuple[Time, BaselineId, Frequency],
797
+ # tuple[Time, BaselineId],
798
+ # tuple[Time, AntennaName, Frequency, Polarization], # SD
799
+ # ],
800
+ # bool,
801
+ # ]
789
802
  data: Data[
790
803
  Union[
791
804
  tuple[Time, BaselineId, Frequency, Polarization],
792
- tuple[Time, BaselineId, Frequency],
793
- tuple[Time, BaselineId],
794
805
  tuple[Time, AntennaName, Frequency, Polarization], # SD
795
806
  ],
796
807
  bool,
@@ -818,12 +829,20 @@ class WeightArray:
818
829
  data: Data[
819
830
  Union[
820
831
  tuple[Time, BaselineId, Frequency, Polarization],
821
- tuple[Time, BaselineId, Frequency],
822
- tuple[Time, BaselineId],
823
832
  tuple[Time, AntennaName, Frequency, Polarization], # SD
824
833
  ],
825
834
  Union[numpy.float16, numpy.float32, numpy.float64],
826
835
  ]
836
+
837
+ # data: Data[
838
+ # Union[
839
+ # tuple[Time, BaselineId, Frequency, Polarization],
840
+ # tuple[Time, BaselineId, Frequency],
841
+ # tuple[Time, BaselineId],
842
+ # tuple[Time, AntennaName, Frequency, Polarization], # SD
843
+ # ],
844
+ # Union[numpy.float16, numpy.float32, numpy.float64],
845
+ # ]
827
846
  """Visibility weights"""
828
847
  time: Coordof[TimeCoordArray]
829
848
  baseline_id: Optional[Coordof[BaselineArray]] # Only IF
@@ -926,19 +945,79 @@ class TimeSamplingArray:
926
945
  units: Attr[UnitsSeconds] = ("s",)
927
946
 
928
947
 
948
+ # @xarray_dataarray_schema
949
+ # class FreqSamplingArray:
950
+ # """
951
+ # Model of frequency related data variables of the main dataset, such as EFFECTIV_CHANNEL_WIDTH and FREQUENCY_CENTROID.
952
+ # """
953
+
954
+ # data: Data[
955
+ # Union[
956
+ # tuple[Time, BaselineId, Frequency, Polarization],
957
+ # tuple[Time, BaselineId, Frequency],
958
+ # tuple[Time, Frequency],
959
+ # tuple[Frequency],
960
+ # ],
961
+ # float,
962
+ # ]
963
+ # """
964
+ # Data about frequency sampling, such as centroid or integration
965
+ # time. Concrete function depends on concrete data array within
966
+ # :py:class:`VisibilityXds` or :py:class:`SpectrumXds`.
967
+ # """
968
+ # frequency: Coordof[FrequencyArray]
969
+ # time: Optional[Coordof[TimeCoordArray]] = None
970
+ # baseline_id: Optional[Coordof[BaselineArray]] = None
971
+ # polarization: Optional[Coordof[PolarizationArray]] = None
972
+ # long_name: Optional[Attr[str]] = "Frequency sampling data"
973
+ # units: Attr[UnitsHertz] = ("Hz",)
974
+ # observer: Attr[AllowedSpectralCoordFrames] = "icrs"
975
+ # """
976
+ # Astropy velocity reference frames (see :external:ref:`astropy-spectralcoord`).
977
+ # Note that Astropy does not use the name
978
+ # 'topo' (telescope centric) velocity frame, rather it assumes if no velocity
979
+ # frame is given that this is the default.
980
+ # """
981
+
982
+
983
+ @xarray_dataarray_schema
984
+ class FrequencyCentroidArray:
985
+ """
986
+ Model of frequency related data variables of the main dataset, such as FREQUENCY_CENTROID.
987
+ """
988
+
989
+ data: Data[
990
+ tuple[Frequency],
991
+ float,
992
+ ]
993
+ """
994
+ Data about frequency sampling, such as centroid or integration
995
+ time. Concrete function depends on concrete data array within
996
+ :py:class:`VisibilityXds` or :py:class:`SpectrumXds`.
997
+ """
998
+ frequency: Coordof[FrequencyArray]
999
+ long_name: Optional[Attr[str]] = "Frequency sampling data"
1000
+ units: Attr[UnitsHertz] = ("Hz",)
1001
+ observer: Attr[AllowedSpectralCoordFrames] = "icrs"
1002
+ """
1003
+ Astropy velocity reference frames (see :external:ref:`astropy-spectralcoord`).
1004
+ Note that Astropy does not use the name
1005
+ 'topo' (telescope centric) velocity frame, rather it assumes if no velocity
1006
+ frame is given that this is the default.
1007
+ """
1008
+
1009
+
929
1010
  @xarray_dataarray_schema
930
- class FreqSamplingArray:
1011
+ class EffectiveChannelWidthArray:
931
1012
  """
932
- Model of frequency related data variables of the main dataset, such as EFFECTIV_CHANNEL_WIDTH and FREQUENCY_CENTROID.
1013
+ Model of frequency related data variables of the main dataset, such as EFFECTIV_CHANNEL_WIDTH.
933
1014
  """
934
1015
 
935
1016
  data: Data[
936
1017
  Union[
937
1018
  tuple[Time, BaselineId, Frequency, Polarization],
938
- tuple[Time, BaselineId, Frequency],
939
- tuple[Time, Frequency],
940
- tuple[Frequency],
941
- ],
1019
+ tuple[Time, AntennaName, Frequency, Polarization],
1020
+ ], # SD
942
1021
  float,
943
1022
  ]
944
1023
  """
@@ -961,7 +1040,7 @@ class FreqSamplingArray:
961
1040
  """
962
1041
 
963
1042
 
964
- # Define FieldAndSourceXds dataset already here, as it is needed in the
1043
+ # Define FieldSourceXds and FieldSourceEphemerisXds already here, as they are needed in the
965
1044
  # definition of VisibilityArray
966
1045
  @xarray_dataset_schema
967
1046
  class FieldSourceXds:
@@ -972,34 +1051,16 @@ class FieldSourceXds:
972
1051
  For single dishes, this is the nominal pointing direction.
973
1052
  """
974
1053
 
975
- source_name: Optional[Coord[Union[ZD, Time], str]]
1054
+ source_name: Coord[FieldName, str]
976
1055
  """ Source name. """
977
- field_name: Optional[Coord[Union[ZD, Time], str]]
978
- """Field name."""
979
1056
 
980
- time: Optional[Coordof[TimeInterpolatedCoordArray]]
981
- """Midpoint of time for which this set of parameters is accurate. Labeled 'time' when interpolated to main time """
982
- time_ephemeris: Optional[Coordof[TimeEphemerisCoordArray]]
983
- """Midpoint of time for which this set of parameters is accurate. Labeled 'time_ephemeris' when not interpolating to main time """
984
-
985
- line_label: Optional[Coord[LineLabel, str]]
986
- """ Line labels (for line names and variables). """
1057
+ field_name: Coord[FieldName, str]
1058
+ """Field name."""
987
1059
 
988
- line_names: Optional[
989
- Coord[
990
- Union[
991
- tuple[LineLabel],
992
- tuple[Time, LineLabel],
993
- tuple[TimeEphemeris, LineLabel],
994
- ],
995
- str,
996
- ]
997
- ]
998
- """ Line names (e.g. v=1, J=1-0, SiO). """
1060
+ sky_dir_label: Coord[SkyDirLabel, str]
1061
+ """ Coordinate labels of sky directions (typically shape 2 and 'ra', 'dec') """
999
1062
 
1000
- FIELD_PHASE_CENTER: Optional[
1001
- Data[Union[ZD, tuple[Time], tuple[TimeEphemeris]], SkyCoordArray]
1002
- ]
1063
+ FIELD_PHASE_CENTER: Optional[Data[FieldName, SkyCoordArray]]
1003
1064
  """
1004
1065
  Offset from the SOURCE_DIRECTION that gives the direction of phase
1005
1066
  center for which the fringes have been stopped-that is a point source in
@@ -1009,25 +1070,14 @@ class FieldSourceXds:
1009
1070
  varies with field, it refers DelayDir_Ref column instead.
1010
1071
  """
1011
1072
 
1012
- FIELD_REFERENCE_CENTER: Optional[
1013
- Data[Union[ZD, tuple[Time], tuple[TimeEphemeris]], SkyCoordArray]
1014
- ]
1073
+ FIELD_REFERENCE_CENTER: Optional[Data[FieldName, SkyCoordArray]]
1015
1074
  """
1016
1075
  Used in single-dish to record the associated reference direction if positionswitching
1017
1076
  been applied. For conversion from MSv2, frame refers column keywords by default. If
1018
1077
  frame varies with field, it refers DelayDir_Ref column instead.
1019
1078
  """
1020
1079
 
1021
- SOURCE_LOCATION: Optional[
1022
- Data[
1023
- Union[
1024
- ZD,
1025
- tuple[Time],
1026
- tuple[TimeEphemeris],
1027
- ],
1028
- SkyCoordArray,
1029
- ]
1030
- ]
1080
+ SOURCE_LOCATION: Optional[Data[FieldName, SkyCoordArray]]
1031
1081
  """
1032
1082
  CASA Table Cols: RA,DEC,Rho."Astrometric RA and Dec and Geocentric
1033
1083
  distance with respect to the observer’s location (Geocentric). "Adjusted
@@ -1040,11 +1090,7 @@ class FieldSourceXds:
1040
1090
 
1041
1091
  LINE_REST_FREQUENCY: Optional[
1042
1092
  Data[
1043
- Union[
1044
- tuple[LineLabel],
1045
- tuple[Time, LineLabel],
1046
- tuple[TimeEphemeris, LineLabel],
1047
- ],
1093
+ tuple[FieldName, LineLabel],
1048
1094
  SpectralCoordArray,
1049
1095
  ]
1050
1096
  ]
@@ -1052,37 +1098,118 @@ class FieldSourceXds:
1052
1098
 
1053
1099
  LINE_SYSTEMIC_VELOCITY: Optional[
1054
1100
  Data[
1055
- Union[
1056
- tuple[LineLabel],
1057
- tuple[Time, LineLabel],
1058
- tuple[TimeEphemeris, LineLabel],
1059
- ],
1101
+ tuple[FieldName, LineLabel],
1060
1102
  QuantityInMetersPerSecondArray,
1061
1103
  ]
1062
1104
  ]
1063
1105
  """ Systemic velocity at reference """
1064
1106
 
1065
- SOURCE_RADIAL_VELOCITY: Optional[
1107
+ OBSERVER_POSITION: Optional[Data[ZD, LocationArray]]
1108
+ """ Observer location. """
1109
+
1110
+ # --- Attributes ---
1111
+ doppler_shift_velocity: Optional[Attr[UnitsOfDopplerShift]]
1112
+ """ Velocity definition of the Doppler shift, e.g., RADIO or OPTICAL velocity in m/s """
1113
+
1114
+ source_model_url: Optional[Attr[str]]
1115
+ """URL to access source model"""
1116
+
1117
+ type: Attr[Literal["field_and_source"]] = "field_and_source"
1118
+ """
1119
+ Type of dataset.
1120
+ """
1121
+
1122
+ # --- Optional coordinates ---
1123
+ cartesian_pos_label: Optional[Coord[CartesianPosLabel, str]] = ("x", "y", "z")
1124
+ """ Coordinate labels of geocentric earth location data (typically shape 3 and 'x', 'y', 'z')"""
1125
+
1126
+ line_label: Optional[Coord[LineLabel, str]] = ()
1127
+ """ Line labels (for line names and variables). """
1128
+
1129
+ line_names: Optional[Coord[tuple[FieldName, LineLabel], str]] = ()
1130
+ """ Line names (e.g. v=1, J=1-0, SiO). """
1131
+
1132
+
1133
+ @xarray_dataset_schema
1134
+ class FieldSourceEphemerisXds:
1135
+ """
1136
+ Field positions for each source, when the source have ephemeris information.
1137
+
1138
+ Defines a field position on the sky. For interferometers, this is the correlated field position.
1139
+ For single dishes, this is the nominal pointing direction.
1140
+ """
1141
+
1142
+ source_name: Coord[Time, str]
1143
+ """ Source name. """
1144
+
1145
+ field_name: Coord[Time, str]
1146
+ """Field name."""
1147
+
1148
+ time: Coordof[TimeInterpolatedCoordArray]
1149
+ """Midpoint of time for which this set of parameters is accurate. Labeled 'time' when interpolated to main time """
1150
+
1151
+ FIELD_PHASE_CENTER: Optional[Data[tuple[Time], SkyCoordArray]]
1152
+ """
1153
+ Offset from the SOURCE_DIRECTION that gives the direction of phase
1154
+ center for which the fringes have been stopped-that is a point source in
1155
+ this direction will produce a constant measured phase (page 2 of
1156
+ https://articles.adsabs.harvard.edu/pdf/1999ASPC..180...79F). For
1157
+ conversion from MSv2, frame refers column keywords by default. If frame
1158
+ varies with field, it refers DelayDir_Ref column instead.
1159
+ """
1160
+
1161
+ FIELD_REFERENCE_CENTER: Optional[Data[tuple[Time], SkyCoordArray]]
1162
+ """
1163
+ Used in single-dish to record the associated reference direction if positionswitching
1164
+ been applied. For conversion from MSv2, frame refers column keywords by default. If
1165
+ frame varies with field, it refers DelayDir_Ref column instead.
1166
+ """
1167
+
1168
+ LINE_REST_FREQUENCY: Optional[Data[tuple[Time, LineLabel], SpectralCoordArray]]
1169
+ """ Rest frequencies for the transitions. """
1170
+
1171
+ LINE_SYSTEMIC_VELOCITY: Optional[
1172
+ Data[tuple[Time, LineLabel], QuantityInMetersPerSecondArray]
1173
+ ]
1174
+ """ Systemic velocity at reference """
1175
+
1176
+ SOURCE_LOCATION: Optional[
1066
1177
  Data[
1067
- Union[ZD, tuple[Time], tuple[TimeEphemeris]], QuantityInMetersPerSecondArray
1178
+ Union[
1179
+ tuple[Time],
1180
+ tuple[TimeEphemeris],
1181
+ ],
1182
+ SkyCoordArray,
1068
1183
  ]
1069
1184
  ]
1185
+ """
1186
+ CASA Table Cols: RA,DEC,Rho."Astrometric RA and Dec and Geocentric
1187
+ distance with respect to the observer’s location (Geocentric). "Adjusted
1188
+ for light-time aberration only. With respect to the reference plane and
1189
+ equinox of the chosen system (ICRF or FK4/B1950). If the FK4/B1950 frame
1190
+ output is selected, elliptic aberration terms are added. Astrometric RA/DEC
1191
+ is generally used when comparing or reducing data against a star catalog."
1192
+ https://ssd.jpl.nasa.gov/horizons/manual.html : 1. Astrometric RA & DEC
1193
+ """
1194
+
1195
+ SOURCE_RADIAL_VELOCITY: Optional[
1196
+ Data[Union[tuple[Time], tuple[TimeEphemeris]], QuantityInMetersPerSecondArray]
1197
+ ]
1070
1198
  """ CASA Table Cols: RadVel. Geocentric distance rate """
1071
1199
 
1072
1200
  NORTH_POLE_POSITION_ANGLE: Optional[
1073
- Data[Union[ZD, tuple[Time], tuple[TimeEphemeris]], QuantityInRadiansArray]
1201
+ Data[Union[tuple[Time], tuple[TimeEphemeris]], QuantityInRadiansArray]
1074
1202
  ]
1075
1203
  """ 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. """
1076
1204
 
1077
1205
  NORTH_POLE_ANGULAR_DISTANCE: Optional[
1078
- Data[Union[ZD, tuple[Time], tuple[TimeEphemeris]], QuantityInRadiansArray]
1206
+ Data[Union[tuple[Time], tuple[TimeEphemeris]], QuantityInRadiansArray]
1079
1207
  ]
1080
1208
  """ 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. """
1081
1209
 
1082
1210
  SUB_OBSERVER_DIRECTION: Optional[
1083
1211
  Data[
1084
1212
  Union[
1085
- ZD,
1086
1213
  tuple[Time],
1087
1214
  tuple[TimeEphemeris],
1088
1215
  ],
@@ -1094,7 +1221,6 @@ class FieldSourceXds:
1094
1221
  SUB_SOLAR_POSITION: Optional[
1095
1222
  Data[
1096
1223
  Union[
1097
- ZD,
1098
1224
  tuple[Time],
1099
1225
  tuple[TimeEphemeris],
1100
1226
  ],
@@ -1104,14 +1230,12 @@ class FieldSourceXds:
1104
1230
  """ 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 """
1105
1231
 
1106
1232
  HELIOCENTRIC_RADIAL_VELOCITY: Optional[
1107
- Data[
1108
- Union[ZD, tuple[Time], tuple[TimeEphemeris]], QuantityInMetersPerSecondArray
1109
- ]
1233
+ Data[Union[tuple[Time], tuple[TimeEphemeris]], QuantityInMetersPerSecondArray]
1110
1234
  ]
1111
1235
  """ 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) """
1112
1236
 
1113
1237
  OBSERVER_PHASE_ANGLE: Optional[
1114
- Data[Union[ZD, tuple[Time], tuple[TimeEphemeris]], QuantityInRadiansArray]
1238
+ Data[Union[tuple[Time], tuple[TimeEphemeris]], QuantityInRadiansArray]
1115
1239
  ]
1116
1240
  """ 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 """
1117
1241
 
@@ -1124,15 +1248,15 @@ class FieldSourceXds:
1124
1248
 
1125
1249
  source_model_url: Optional[Attr[str]]
1126
1250
  """URL to access source model"""
1251
+
1127
1252
  ephemeris_name: Optional[Attr[str]]
1128
1253
  """The name of the ephemeris. For example DE430.
1129
1254
 
1130
1255
  This can be used with Astropy solar_system_ephemeris.set('DE430'), see
1131
1256
  https://docs.astropy.org/en/stable/coordinates/solarsystem.html.
1132
1257
  """
1133
- is_ephemeris: Attr[bool] = False
1134
1258
 
1135
- type: Attr[Literal["field_and_source"]] = "field_and_source"
1259
+ type: Attr[Literal["field_and_source_ephemeris"]] = "field_and_source_ephemeris"
1136
1260
  """
1137
1261
  Type of dataset.
1138
1262
  """
@@ -1151,6 +1275,15 @@ class FieldSourceXds:
1151
1275
  cartesian_pos_label: Optional[Coord[CartesianPosLabel, str]] = ("x", "y", "z")
1152
1276
  """ Coordinate labels of geocentric earth location data (typically shape 3 and 'x', 'y', 'z')"""
1153
1277
 
1278
+ line_label: Optional[Coord[LineLabel, str]] = ()
1279
+ """ Line labels (for line names and variables). """
1280
+
1281
+ line_names: Optional[Coord[tuple[FieldName, LineLabel], str]] = ()
1282
+ """ Line names (e.g. v=1, J=1-0, SiO). """
1283
+
1284
+ time_ephemeris: Optional[Coordof[TimeEphemerisCoordArray]] = ()
1285
+ """Midpoint of time for which this set of parameters is accurate. Labeled 'time_ephemeris' when not interpolating to main time """
1286
+
1154
1287
 
1155
1288
  @xarray_dataarray_schema
1156
1289
  class SpectrumArray:
@@ -1166,7 +1299,6 @@ class SpectrumArray:
1166
1299
  frequency: Coordof[FrequencyArray]
1167
1300
  polarization: Coordof[PolarizationArray]
1168
1301
 
1169
- field_and_source_xds: Attr[FieldSourceXds]
1170
1302
  long_name: Optional[Attr[str]] = "Spectrum values"
1171
1303
  """ Long-form name to use for axis. Should be ``"Spectrum values"``"""
1172
1304
  units: Attr[list[str]] = ("Jy",)
@@ -1186,7 +1318,6 @@ class VisibilityArray:
1186
1318
  polarization: Coordof[PolarizationArray]
1187
1319
  frequency: Coordof[FrequencyArray]
1188
1320
 
1189
- field_and_source_xds: Attr[FieldSourceXds]
1190
1321
  long_name: Optional[Attr[str]] = "Visibility values"
1191
1322
  """ Long-form name to use for axis. Should be ``"Visibility values"``"""
1192
1323
  units: Attr[list[str]] = ("Jy",)
@@ -1197,30 +1328,32 @@ class VisibilityArray:
1197
1328
  # Info dicts
1198
1329
 
1199
1330
 
1200
- @dict_schema
1201
- class PartitionInfoDict:
1202
- # spectral_window_id: missing / remove for good?
1203
- spectral_window_name: str
1204
- """ Spectral window Name """
1205
- # field_id: missing / probably remove for good?
1206
- field_name: list[str]
1207
- """ List of all field names """
1208
- polarization_setup: list[str]
1209
- """ List of polrization bases. """
1210
- scan_number: list[int]
1211
- """ List of scan numbers. """
1212
- source_name: list[str]
1213
- """ List of source names. """
1214
- # source_id: mising / remove for good?
1215
- intents: list[str]
1216
- """ An intent string identifies one intention of the scan, such as to calibrate or observe a
1217
- target. See :ref:`scan intents` for possible values. When converting from MSv2, the list of
1218
- intents is derived from the OBS_MODE column of MSv2 state table (every comma separated value
1219
- is taken as an intent). """
1220
- taql: Optional[str]
1221
- """ The taql query used if converted from MSv2. """
1222
- line_name: list[str]
1223
- """ Spectral line names """
1331
+ # @dict_schema
1332
+ # class PartitionInfoDict:
1333
+ # # spectral_window_id: missing / remove for good?
1334
+ # spectral_window_name: str
1335
+ # """ Spectral window Name """
1336
+ # # field_id: missing / probably remove for good?
1337
+ # field_name: list[str]
1338
+ # """ List of all field names """
1339
+ # polarization_setup: list[str]
1340
+ # """ List of polrization bases. """
1341
+ # scan_name: list[str]
1342
+ # """ List of scan names. """
1343
+ # source_name: list[str]
1344
+ # """ List of source names. """
1345
+ # # source_id: mising / remove for good?
1346
+ # intents: list[str]
1347
+ # """ An intent string identifies one intention of the scan, such as to calibrate or observe a
1348
+ # target. See :ref:`scan intents` for possible values. When converting from MSv2, the list of
1349
+ # intents is derived from the OBS_MODE column of MSv2 state table (every comma separated value
1350
+ # is taken as an intent). """
1351
+ # taql: Optional[str]
1352
+ # """ The taql query used if converted from MSv2. """
1353
+ # line_name: list[str]
1354
+ # """ Spectral line names """
1355
+ # antenna_name: Optional[str]
1356
+ # """ Name of antenna when partitioning also by antenna (single-dish). """
1224
1357
 
1225
1358
 
1226
1359
  @dict_schema
@@ -1248,6 +1381,11 @@ class ObservationInfoDict:
1248
1381
  """ASDM: A reference to the Entity which contains the observing script."""
1249
1382
  observing_log: Optional[str]
1250
1383
  """ASDM: Logs of the observation during this execu- tion block."""
1384
+ intents: list[str]
1385
+ """ An intent string identifies one intention of the scan, such as to calibrate or observe a
1386
+ target. See :ref:`scan intents` for possible values. When converting from MSv2, the list of
1387
+ intents is derived from the OBS_MODE column of MSv2 state table (every comma separated value
1388
+ is taken as an intent). """
1251
1389
 
1252
1390
 
1253
1391
  @dict_schema
@@ -1260,6 +1398,39 @@ class ProcessorInfoDict:
1260
1398
  """Processor sub-type, e.g. ”GBT” or ”JIVE”."""
1261
1399
 
1262
1400
 
1401
+ @dict_schema
1402
+ class DataGroupDict:
1403
+ """Defines a group of correlated data + flag + weight + uvw variables."""
1404
+
1405
+ correlated_data: str
1406
+ """ Name of the correlated data variable, for example 'VISIBILITY' or 'VISIBILITY_MODEL'. """
1407
+ flag: str
1408
+ """ Name of the flag variable, for example 'FLAG'. """
1409
+ weight: str
1410
+ """ Name of the weight variable of the group, for example 'WEIGHT'. """
1411
+ uvw: Optional[str]
1412
+ """ Name of the UVW variable of the group, for example 'UVW'. """
1413
+ description: str
1414
+ """ More details about the data group. """
1415
+ date: str
1416
+ """ Creation date-time, in ISO 8601 format: 'YYYY-MM-DDTHH:mm:ss.SSS'. """
1417
+
1418
+
1419
+ @dict_schema
1420
+ class DataGroupsDict:
1421
+ """Dictionary of data group dictionaries."""
1422
+
1423
+ base: DataGroupDict
1424
+
1425
+
1426
+ @dict_schema
1427
+ class CreatorDict:
1428
+ software_name: str
1429
+ """ Software that created the Measurement Set (XRadio, etc.). """
1430
+ version: str
1431
+ """ Version of the software. """
1432
+
1433
+
1263
1434
  # Data Sets
1264
1435
 
1265
1436
 
@@ -1276,11 +1447,13 @@ class AntennaXds:
1276
1447
  """ Name of the station pad (relevant to arrays with moving antennas). """
1277
1448
  mount: Coord[AntennaName, str]
1278
1449
  """ Mount type of the antenna. Reserved keywords include: ”EQUATORIAL” - equatorial mount;
1279
- ”ALT-AZ - azimuth-elevation mount;
1280
- "ALT-AZ+ROTATOR" alt-az mount with feed rotator; introduced for ASKAP dishes;
1450
+ ”ALT-AZ”: azimuth-elevation mount;
1451
+ "ALT-AZ+ROTATOR": alt-az mount with feed rotator; introduced for ASKAP dishes;
1281
1452
  "ALT-AZ+NASMYTH-R": Nasmyth mount with receivers at the right-hand side of the cabin. Many high-frequency antennas used for VLBI have such a mount typel;
1282
- "ALT-AZ+NASMYTH-L:: Nasmyth mount with receivers at the left-hand side of the cabin.
1283
- ”X-Y” - x-y mount;
1453
+ "ALT-AZ+NASMYTH-L": Nasmyth mount with receivers at the left-hand side of the cabin.
1454
+ "ALT-AZ+BWG-R": alt-az mount that uses a Beam Wave Guide to bring the focus down to the pedestal. The receivers are at the right-hand side of the cabin (-R). Compared to the Nasmyth mounts there is an extra correction term because there are now two rotating mirrors. See https://arxiv.org/abs/2210.13381 for more details.
1455
+ "ALT-AZ+BWG-L": alt-az mount that uses a Beam Wave Guide, as above, but with receivers at the left-hand side of the cabin.
1456
+ ”X-Y”: x-y mount;
1284
1457
  ”SPACE-HALCA” - specific orientation model."""
1285
1458
  telescope_name: Coord[AntennaName, str]
1286
1459
  """ Useful when data is combined from mutiple arrays for example ACA + ALMA. """
@@ -1358,17 +1531,19 @@ class GainCurveXds:
1358
1531
  """ Name of the station pad (relevant to arrays with moving antennas). """
1359
1532
  mount: Coord[AntennaName, str]
1360
1533
  """ Mount type of the antenna. Reserved keywords include: ”EQUATORIAL” - equatorial mount;
1361
- ”ALT-AZ - azimuth-elevation mount;
1362
- "ALT-AZ+ROTATOR" alt-az mount with feed rotator; introduced for ASKAP dishes;
1534
+ ”ALT-AZ”: azimuth-elevation mount;
1535
+ "ALT-AZ+ROTATOR": alt-az mount with feed rotator; introduced for ASKAP dishes;
1363
1536
  "ALT-AZ+NASMYTH-R": Nasmyth mount with receivers at the right-hand side of the cabin. Many high-frequency antennas used for VLBI have such a mount typel;
1364
- "ALT-AZ+NASMYTH-L:: Nasmyth mount with receivers at the left-hand side of the cabin.
1365
- ”X-Y” - x-y mount;
1537
+ "ALT-AZ+NASMYTH-L": Nasmyth mount with receivers at the left-hand side of the cabin.
1538
+ "ALT-AZ+BWG-R": alt-az mount that uses a Beam Wave Guide to bring the focus down to the pedestal. The receivers are at the right-hand side of the cabin (-R). Compared to the Nasmyth mounts there is an extra correction term because there are now two rotating mirrors. See https://arxiv.org/abs/2210.13381 for more details.
1539
+ "ALT-AZ+BWG-L": alt-az mount that uses a Beam Wave Guide, as above, but with receivers at the left-hand side of the cabin.
1540
+ ”X-Y”: x-y mount;
1366
1541
  ”SPACE-HALCA” - specific orientation model."""
1367
1542
  telescope_name: Coord[AntennaName, str]
1368
1543
  """ Useful when data is combined from mutiple arrays for example ACA + ALMA. """
1369
1544
  receptor_label: Coord[ReceptorLabel, str]
1370
1545
  """ Names of receptors """
1371
- polarization_type: Optional[Coord[tuple[AntennaName, ReceptorLabel], str]]
1546
+ polarization_type: Coord[tuple[AntennaName, ReceptorLabel], str]
1372
1547
  """ Polarization type to which each receptor responds (e.g. ”R”,”L”,”X” or ”Y”).
1373
1548
  This is the receptor polarization type as recorded in the final correlated data (e.g. ”RR”); i.e.
1374
1549
  as measured after all polarization combiners. ['X','Y'], ['R','L'] """
@@ -1415,17 +1590,19 @@ class PhaseCalibrationXds:
1415
1590
  """ Name of the station pad (relevant to arrays with moving antennas). """
1416
1591
  mount: Coord[AntennaName, str]
1417
1592
  """ Mount type of the antenna. Reserved keywords include: ”EQUATORIAL” - equatorial mount;
1418
- ”ALT-AZ - azimuth-elevation mount;
1419
- "ALT-AZ+ROTATOR" alt-az mount with feed rotator; introduced for ASKAP dishes;
1593
+ ”ALT-AZ”: azimuth-elevation mount;
1594
+ "ALT-AZ+ROTATOR": alt-az mount with feed rotator; introduced for ASKAP dishes;
1420
1595
  "ALT-AZ+NASMYTH-R": Nasmyth mount with receivers at the right-hand side of the cabin. Many high-frequency antennas used for VLBI have such a mount typel;
1421
- "ALT-AZ+NASMYTH-L:: Nasmyth mount with receivers at the left-hand side of the cabin.
1422
- ”X-Y” - x-y mount;
1423
- ”SPACE-HALCA” - specific orientation model."""
1596
+ "ALT-AZ+NASMYTH-L": Nasmyth mount with receivers at the left-hand side of the cabin.
1597
+ "ALT-AZ+BWG-R": alt-az mount that uses a Beam Wave Guide to bring the focus down to the pedestal. The receivers are at the right-hand side of the cabin (-R). Compared to the Nasmyth mounts there is an extra correction term because there are now two rotating mirrors. See https://arxiv.org/abs/2210.13381 for more details.
1598
+ "ALT-AZ+BWG-L": alt-az mount that uses a Beam Wave Guide, as above, but with receivers at the left-hand side of the cabin.
1599
+ ”X-Y”: x-y mount;
1600
+ ”SPACE-HALCA”: specific orientation model."""
1424
1601
  telescope_name: Coord[AntennaName, str]
1425
1602
  """ Useful when data is combined from mutiple arrays for example ACA + ALMA. """
1426
1603
  receptor_label: Coord[ReceptorLabel, str]
1427
1604
  """ Names of receptors """
1428
- polarization_type: Optional[Coord[tuple[AntennaName, ReceptorLabel], str]]
1605
+ polarization_type: Coord[tuple[AntennaName, ReceptorLabel], str]
1429
1606
  """ Polarization type to which each receptor responds (e.g. ”R”,”L”,”X” or ”Y”).
1430
1607
  This is the receptor polarization type as recorded in the final correlated data (e.g. ”RR”); i.e.
1431
1608
  as measured after all polarization combiners. ['X','Y'], ['R','L'] """
@@ -1516,7 +1693,7 @@ class WeatherXds:
1516
1693
  QuantityInPerSquareMetersArray,
1517
1694
  ]
1518
1695
  ] = None
1519
- """ Average column density of water """
1696
+ """ Average column density of water, in zenith direction (rather than line of sight) """
1520
1697
  IONOS_ELECTRON: Optional[
1521
1698
  Data[
1522
1699
  Union[
@@ -1526,7 +1703,7 @@ class WeatherXds:
1526
1703
  QuantityInPerSquareMetersArray,
1527
1704
  ]
1528
1705
  ] = None
1529
- """ Average column density of electrons """
1706
+ """ Average column density of electrons, in zenith direction (rather than line of sight) """
1530
1707
  PRESSURE: Optional[
1531
1708
  Data[
1532
1709
  Union[
@@ -1705,21 +1882,26 @@ class SystemCalibrationXds:
1705
1882
  # Coordinates
1706
1883
  antenna_name: Coordof[AntennaNameArray]
1707
1884
  """ Antenna identifier """
1708
- receptor_label: Coord[ReceptorLabel, numpy.int64]
1885
+ receptor_label: Coord[ReceptorLabel, str]
1886
+ """ Names of receptors """
1887
+ polarization_type: Coord[tuple[AntennaName, ReceptorLabel], str]
1888
+ """ Polarization type to which each receptor responds (e.g. ”R”,”L”,”X” or ”Y”).
1889
+ This is the receptor polarization type as recorded in the final correlated data (e.g. ”RR”); i.e.
1890
+ as measured after all polarization combiners. ['X','Y'], ['R','L'] """
1709
1891
  """ """
1710
1892
  time: Optional[Coordof[TimeInterpolatedCoordArray]] = None
1711
1893
  """ Midpoint of time for which this set of parameters is accurate. Labeled 'time' when interpolating to main time axis """
1712
- time_cal: Optional[Coordof[TimeCalCoordArray]] = None
1713
- """ Midpoint of time for which this set of parameters is accurate. Labeled 'time_cal' when not interpolating to main time axis """
1714
- frequency: Optional[Coordof[FrequencyCalArray]] = None
1894
+ time_system_cal: Optional[Coordof[TimeSystemCalCoordArray]] = None
1895
+ """ Midpoint of time for which this set of parameters is accurate. Labeled 'time_system_cal' when not interpolating to main time axis """
1896
+ frequency: Optional[Coordof[FrequencyArray]] = None
1715
1897
  """ """
1716
- frequency_cal: Optional[Coord[FrequencyCal, int]] = None
1898
+ frequency_system_cal: Optional[Coord[FrequencySystemCal, int]] = None
1717
1899
  """TODO: What is this?"""
1718
1900
 
1719
1901
  # Data variables (all optional)
1720
1902
  PHASE_DIFFERENCE: Optional[
1721
1903
  Data[
1722
- Union[tuple[AntennaName, TimeCal], tuple[AntennaName, Time]],
1904
+ Union[tuple[AntennaName, TimeSystemCal], tuple[AntennaName, Time]],
1723
1905
  QuantityInRadiansArray,
1724
1906
  ]
1725
1907
  ] = None
@@ -1727,10 +1909,10 @@ class SystemCalibrationXds:
1727
1909
  TCAL: Optional[
1728
1910
  Data[
1729
1911
  Union[
1730
- tuple[AntennaName, TimeCal, ReceptorLabel, FrequencyCal],
1731
- tuple[AntennaName, TimeCal, ReceptorLabel, Frequency],
1732
- tuple[AntennaName, TimeCal, ReceptorLabel],
1733
- tuple[AntennaName, Time, ReceptorLabel, FrequencyCal],
1912
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, FrequencySystemCal],
1913
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, Frequency],
1914
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel],
1915
+ tuple[AntennaName, Time, ReceptorLabel, FrequencySystemCal],
1734
1916
  tuple[AntennaName, Time, ReceptorLabel, Frequency],
1735
1917
  tuple[AntennaName, Time, ReceptorLabel],
1736
1918
  ],
@@ -1741,10 +1923,10 @@ class SystemCalibrationXds:
1741
1923
  TRX: Optional[
1742
1924
  Data[
1743
1925
  Union[
1744
- tuple[AntennaName, TimeCal, ReceptorLabel, FrequencyCal],
1745
- tuple[AntennaName, TimeCal, ReceptorLabel, Frequency],
1746
- tuple[AntennaName, TimeCal, ReceptorLabel],
1747
- tuple[AntennaName, Time, ReceptorLabel, FrequencyCal],
1926
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, FrequencySystemCal],
1927
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, Frequency],
1928
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel],
1929
+ tuple[AntennaName, Time, ReceptorLabel, FrequencySystemCal],
1748
1930
  tuple[AntennaName, Time, ReceptorLabel, Frequency],
1749
1931
  tuple[AntennaName, Time, ReceptorLabel],
1750
1932
  ],
@@ -1755,10 +1937,10 @@ class SystemCalibrationXds:
1755
1937
  TSKY: Optional[
1756
1938
  Data[
1757
1939
  Union[
1758
- tuple[AntennaName, TimeCal, ReceptorLabel, FrequencyCal],
1759
- tuple[AntennaName, TimeCal, ReceptorLabel, Frequency],
1760
- tuple[AntennaName, TimeCal, ReceptorLabel],
1761
- tuple[AntennaName, Time, ReceptorLabel, FrequencyCal],
1940
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, FrequencySystemCal],
1941
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, Frequency],
1942
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel],
1943
+ tuple[AntennaName, Time, ReceptorLabel, FrequencySystemCal],
1762
1944
  tuple[AntennaName, Time, ReceptorLabel, Frequency],
1763
1945
  tuple[AntennaName, Time, ReceptorLabel],
1764
1946
  ],
@@ -1769,10 +1951,10 @@ class SystemCalibrationXds:
1769
1951
  TSYS: Optional[
1770
1952
  Data[
1771
1953
  Union[
1772
- tuple[AntennaName, TimeCal, ReceptorLabel, FrequencyCal],
1773
- tuple[AntennaName, TimeCal, ReceptorLabel, Frequency],
1774
- tuple[AntennaName, TimeCal, ReceptorLabel],
1775
- tuple[AntennaName, Time, ReceptorLabel, FrequencyCal],
1954
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, FrequencySystemCal],
1955
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, Frequency],
1956
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel],
1957
+ tuple[AntennaName, Time, ReceptorLabel, FrequencySystemCal],
1776
1958
  tuple[AntennaName, Time, ReceptorLabel, Frequency],
1777
1959
  tuple[AntennaName, Time, ReceptorLabel],
1778
1960
  ],
@@ -1783,10 +1965,10 @@ class SystemCalibrationXds:
1783
1965
  TANT: Optional[
1784
1966
  Data[
1785
1967
  Union[
1786
- tuple[AntennaName, TimeCal, ReceptorLabel, FrequencyCal],
1787
- tuple[AntennaName, TimeCal, ReceptorLabel, Frequency],
1788
- tuple[AntennaName, TimeCal, ReceptorLabel],
1789
- tuple[AntennaName, Time, ReceptorLabel, FrequencyCal],
1968
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, FrequencySystemCal],
1969
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, Frequency],
1970
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel],
1971
+ tuple[AntennaName, Time, ReceptorLabel, FrequencySystemCal],
1790
1972
  tuple[AntennaName, Time, ReceptorLabel, Frequency],
1791
1973
  tuple[AntennaName, Time, ReceptorLabel],
1792
1974
  ],
@@ -1797,10 +1979,10 @@ class SystemCalibrationXds:
1797
1979
  TANT_SYS: Optional[
1798
1980
  Data[
1799
1981
  Union[
1800
- tuple[AntennaName, TimeCal, ReceptorLabel, FrequencyCal],
1801
- tuple[AntennaName, TimeCal, ReceptorLabel, Frequency],
1802
- tuple[AntennaName, TimeCal, ReceptorLabel],
1803
- tuple[AntennaName, Time, ReceptorLabel, FrequencyCal],
1982
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, FrequencySystemCal],
1983
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel, Frequency],
1984
+ tuple[AntennaName, TimeSystemCal, ReceptorLabel],
1985
+ tuple[AntennaName, Time, ReceptorLabel, FrequencySystemCal],
1804
1986
  tuple[AntennaName, Time, ReceptorLabel, Frequency],
1805
1987
  tuple[AntennaName, Time, ReceptorLabel],
1806
1988
  ],
@@ -1848,6 +2030,8 @@ class VisibilityXds:
1848
2030
  """
1849
2031
  Labels for polarization types, e.g. ``['XX','XY','YX','YY']``, ``['RR','RL','LR','LL']``.
1850
2032
  """
2033
+ field_name: Coordof[Coord[Time, str]]
2034
+ """Field name."""
1851
2035
 
1852
2036
  # --- Required data variables ---
1853
2037
 
@@ -1860,17 +2044,21 @@ class VisibilityXds:
1860
2044
  """Antenna name for 2nd antenna in baseline. Maps to ``attrs['antenna_xds'].antenna_name``"""
1861
2045
 
1862
2046
  # --- Required Attributes ---
1863
- partition_info: Attr[PartitionInfoDict]
2047
+ # partition_info: Attr[PartitionInfoDict]
1864
2048
  observation_info: Attr[ObservationInfoDict]
1865
2049
  processor_info: Attr[ProcessorInfoDict]
1866
- antenna_xds: Attr[AntennaXds]
2050
+
2051
+ data_groups: Attr[DataGroupsDict]
2052
+ """ Defines groups of correlated data + flag + weight + uvw variables. """
1867
2053
 
1868
2054
  schema_version: Attr[str]
1869
- """Semantic version of xradio data format"""
2055
+ """Semantic version of MSv4 data format."""
2056
+ creator: Attr[CreatorDict]
2057
+ """Creator information (software, version)."""
1870
2058
  creation_date: Attr[str]
1871
- """Date visibility dataset was created . Format: YYYY-MM-DDTHH:mm:ss.SSS (ISO 8601)"""
2059
+ """Date visibility dataset was created. Format: YYYY-MM-DDTHH:mm:ss.SSS (ISO 8601)"""
1872
2060
 
1873
- type: Attr[Literal["visibility"]] = "visibility"
2061
+ type: Attr[Literal["visibility", "radiometer"]] = "visibility"
1874
2062
  """
1875
2063
  Dataset type
1876
2064
  """
@@ -1878,12 +2066,15 @@ class VisibilityXds:
1878
2066
  # --- Optional Coordinates ---
1879
2067
  polarization_mixed: Optional[Coord[tuple[BaselineId, Polarization], str]] = None
1880
2068
  """
1881
- If the polarizations are not constant over baseline
2069
+ If the polarizations are not constant over baseline. For mixed polarizations one would
2070
+ use ['PP', 'PQ', 'QP', 'QQ'] as the polarization labels and then specify here the
2071
+ actual polarization basis for each baseline using labels from the set of all
2072
+ combinations of 'X', 'Y', 'R' and 'L'.
1882
2073
  """
1883
2074
  uvw_label: Optional[Coordof[UvwLabelArray]] = None
1884
2075
  """ u,v,w """
1885
- scan_number: Optional[Coord[Time, Union[numpy.int64, numpy.int32]]] = None
1886
- """Arbitary scan number to identify data taken in the same logical scan."""
2076
+ scan_name: Optional[Coord[Time, str]] = None
2077
+ """Scan name to identify data taken in the same logical scan."""
1887
2078
 
1888
2079
  # --- Optional data variables / arrays ---
1889
2080
 
@@ -1897,7 +2088,6 @@ class VisibilityXds:
1897
2088
  Data[
1898
2089
  Union[
1899
2090
  tuple[Time, BaselineId],
1900
- tuple[Time, BaselineId, Frequency],
1901
2091
  tuple[Time, BaselineId, Frequency, Polarization],
1902
2092
  ],
1903
2093
  QuantityInSecondsArray,
@@ -1915,21 +2105,12 @@ class VisibilityXds:
1915
2105
  """
1916
2106
  TIME_CENTROID_EXTRA_PRECISION: Optional[Dataof[TimeSamplingArray]] = None
1917
2107
  """Additional precision for ``TIME_CENTROID``"""
1918
- EFFECTIVE_CHANNEL_WIDTH: Optional[Dataof[FreqSamplingArray]] = None
2108
+ EFFECTIVE_CHANNEL_WIDTH: Optional[Dataof[EffectiveChannelWidthArray]] = None
1919
2109
  """The channel bandwidth that includes the effects of missing data."""
1920
- FREQUENCY_CENTROID: Optional[Dataof[FreqSamplingArray]] = None
2110
+ FREQUENCY_CENTROID: Optional[Dataof[FrequencyCentroidArray]] = None
1921
2111
  """Includes the effects of missing data unlike ``frequency``."""
1922
2112
 
1923
2113
  # --- Optional Attributes ---
1924
- pointing_xds: Optional[Attr[PointingXds]] = None
1925
- system_calibration_xds: Optional[Attr[SystemCalibrationXds]] = None
1926
- gain_curve_xds: Optional[Attr[GainCurveXds]] = None
1927
- phase_calibration_xds: Optional[Attr[PhaseCalibrationXds]] = None
1928
- weather_xds: Optional[Attr[WeatherXds]] = None
1929
- phased_array_xds: Optional[Attr[PhasedArrayXds]] = None
1930
-
1931
- xradio_version: Optional[Attr[str]] = None
1932
- """ Version of XRADIO used if converted from MSv2. """
1933
2114
 
1934
2115
 
1935
2116
  @xarray_dataset_schema
@@ -1950,21 +2131,27 @@ class SpectrumXds:
1950
2131
  """
1951
2132
  Labels for polarization types, e.g. ``['XX','XY','YX','YY']``, ``['RR','RL','LR','LL']``.
1952
2133
  """
2134
+ field_name: Coordof[Coord[Time, str]]
2135
+ """Field name."""
1953
2136
 
1954
2137
  # --- Required data variables ---
1955
2138
  SPECTRUM: Dataof[SpectrumArray]
1956
2139
  """Single dish data, either simulated or measured by an antenna."""
1957
2140
 
1958
2141
  # --- Required Attributes ---
1959
- partition_info: Attr[PartitionInfoDict]
2142
+ # partition_info: Attr[PartitionInfoDict]
1960
2143
  observation_info: Attr[ObservationInfoDict]
1961
2144
  processor_info: Attr[ProcessorInfoDict]
1962
- antenna_xds: Attr[AntennaXds]
2145
+
2146
+ data_groups: Attr[DataGroupsDict]
2147
+ """ Defines groups of correlated data + flag + weight variables. """
1963
2148
 
1964
2149
  schema_version: Attr[str]
1965
- """Semantic version of xradio data format"""
2150
+ """Semantic version of MSv4 data format."""
2151
+ creator: Attr[CreatorDict]
2152
+ """Creator information (software, version)."""
1966
2153
  creation_date: Attr[str]
1967
- """Date MSv4 was created . Format: YYYY-MM-DDTHH:mm:ss.SSS (ISO 8601)"""
2154
+ """Date spectrum dataset was created . Format: YYYY-MM-DDTHH:mm:ss.SSS (ISO 8601)"""
1968
2155
 
1969
2156
  type: Attr[Literal["spectrum"]] = "spectrum"
1970
2157
  """
@@ -1974,10 +2161,13 @@ class SpectrumXds:
1974
2161
  # --- Optional Coordinates ---
1975
2162
  polarization_mixed: Optional[Coord[tuple[AntennaName, Polarization], str]] = None
1976
2163
  """
1977
- If the polarizations are not constant over baseline
2164
+ If the polarizations are not constant over antennas. For mixed polarizations one would
2165
+ use ['PP', 'PQ', 'QP', 'QQ'] as the polarization labels and then specify here the
2166
+ actual polarization basis for each antenna using labels from the set of
2167
+ combinations of 'X', 'Y', 'R' and 'L'.
1978
2168
  """
1979
- scan_number: Optional[Coord[Time, Union[numpy.int64, numpy.int32]]] = None
1980
- """Arbitary scan number to identify data taken in the same logical scan."""
2169
+ scan_name: Optional[Coord[Time, str]] = None
2170
+ """Arbitary scan name to identify data taken in the same logical scan."""
1981
2171
 
1982
2172
  # SPECTRUM_CORRECTED: Optional[Dataof[SpectrumArray]] = None
1983
2173
 
@@ -1989,7 +2179,6 @@ class SpectrumXds:
1989
2179
  Data[
1990
2180
  Union[
1991
2181
  tuple[Time, AntennaName],
1992
- tuple[Time, AntennaName, Frequency],
1993
2182
  tuple[Time, AntennaName, Frequency, Polarization],
1994
2183
  ],
1995
2184
  QuantityInSecondsArray,
@@ -2007,18 +2196,7 @@ class SpectrumXds:
2007
2196
  """
2008
2197
  TIME_CENTROID_EXTRA_PRECISION: Optional[Dataof[TimeSamplingArray]] = None
2009
2198
  """Additional precision for ``TIME_CENTROID``"""
2010
- EFFECTIVE_CHANNEL_WIDTH: Optional[Dataof[FreqSamplingArray]] = None
2199
+ EFFECTIVE_CHANNEL_WIDTH: Optional[Dataof[EffectiveChannelWidthArray]] = None
2011
2200
  """The channel bandwidth that includes the effects of missing data."""
2012
- FREQUENCY_CENTROID: Optional[Dataof[FreqSamplingArray]] = None
2201
+ FREQUENCY_CENTROID: Optional[Dataof[FrequencyCentroidArray]] = None
2013
2202
  """Includes the effects of missing data unlike ``frequency``."""
2014
-
2015
- # --- Optional Attributes ---
2016
- pointing_xds: Optional[Attr[PointingXds]] = None
2017
- system_calibration_xds: Optional[Attr[SystemCalibrationXds]] = None
2018
- gain_curve_xds: Optional[Attr[GainCurveXds]] = None
2019
- phase_calibration_xds: Optional[Attr[PhaseCalibrationXds]] = None
2020
- weather_xds: Optional[Attr[WeatherXds]] = None
2021
- phased_array_xds: Optional[Attr[PhasedArrayXds]] = None
2022
-
2023
- xradio_version: Optional[Attr[str]] = None
2024
- """ Version of XRADIO used if converted from MSv2. """