xradio 0.0.56__py3-none-any.whl → 0.0.59__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 (63) hide show
  1. xradio/__init__.py +2 -2
  2. xradio/_utils/_casacore/casacore_from_casatools.py +12 -2
  3. xradio/_utils/_casacore/tables.py +1 -0
  4. xradio/_utils/coord_math.py +22 -23
  5. xradio/_utils/dict_helpers.py +76 -11
  6. xradio/_utils/schema.py +5 -2
  7. xradio/_utils/zarr/common.py +1 -73
  8. xradio/image/_util/_casacore/xds_from_casacore.py +49 -33
  9. xradio/image/_util/_casacore/xds_to_casacore.py +41 -14
  10. xradio/image/_util/_fits/xds_from_fits.py +146 -35
  11. xradio/image/_util/casacore.py +4 -3
  12. xradio/image/_util/common.py +4 -4
  13. xradio/image/_util/image_factory.py +8 -8
  14. xradio/image/image.py +45 -5
  15. xradio/measurement_set/__init__.py +19 -9
  16. xradio/measurement_set/_utils/__init__.py +1 -3
  17. xradio/measurement_set/_utils/_msv2/__init__.py +0 -0
  18. xradio/measurement_set/_utils/_msv2/_tables/read.py +17 -76
  19. xradio/measurement_set/_utils/_msv2/_tables/read_main_table.py +2 -685
  20. xradio/measurement_set/_utils/_msv2/conversion.py +174 -156
  21. xradio/measurement_set/_utils/_msv2/create_antenna_xds.py +9 -16
  22. xradio/measurement_set/_utils/_msv2/create_field_and_source_xds.py +128 -222
  23. xradio/measurement_set/_utils/_msv2/msv2_to_msv4_meta.py +1 -2
  24. xradio/measurement_set/_utils/_msv2/msv4_info_dicts.py +8 -7
  25. xradio/measurement_set/_utils/_msv2/msv4_sub_xdss.py +31 -74
  26. xradio/measurement_set/_utils/_msv2/partition_queries.py +1 -261
  27. xradio/measurement_set/_utils/_msv2/subtables.py +0 -107
  28. xradio/measurement_set/_utils/_utils/interpolate.py +60 -0
  29. xradio/measurement_set/_utils/_zarr/encoding.py +2 -7
  30. xradio/measurement_set/convert_msv2_to_processing_set.py +0 -2
  31. xradio/measurement_set/load_processing_set.py +2 -2
  32. xradio/measurement_set/measurement_set_xdt.py +20 -16
  33. xradio/measurement_set/open_processing_set.py +1 -3
  34. xradio/measurement_set/processing_set_xdt.py +54 -841
  35. xradio/measurement_set/schema.py +122 -132
  36. xradio/schema/check.py +95 -101
  37. xradio/schema/dataclass.py +159 -22
  38. xradio/schema/export.py +99 -0
  39. xradio/schema/metamodel.py +51 -16
  40. xradio/schema/typing.py +5 -5
  41. xradio/sphinx/schema_table.py +41 -77
  42. {xradio-0.0.56.dist-info → xradio-0.0.59.dist-info}/METADATA +20 -5
  43. xradio-0.0.59.dist-info/RECORD +65 -0
  44. {xradio-0.0.56.dist-info → xradio-0.0.59.dist-info}/WHEEL +1 -1
  45. xradio/image/_util/fits.py +0 -13
  46. xradio/measurement_set/_utils/_msv2/_tables/load.py +0 -66
  47. xradio/measurement_set/_utils/_msv2/_tables/load_main_table.py +0 -490
  48. xradio/measurement_set/_utils/_msv2/_tables/read_subtables.py +0 -398
  49. xradio/measurement_set/_utils/_msv2/_tables/write.py +0 -323
  50. xradio/measurement_set/_utils/_msv2/_tables/write_exp_api.py +0 -388
  51. xradio/measurement_set/_utils/_msv2/chunks.py +0 -115
  52. xradio/measurement_set/_utils/_msv2/descr.py +0 -165
  53. xradio/measurement_set/_utils/_msv2/msv2_msv3.py +0 -7
  54. xradio/measurement_set/_utils/_msv2/partitions.py +0 -392
  55. xradio/measurement_set/_utils/_utils/cds.py +0 -40
  56. xradio/measurement_set/_utils/_utils/xds_helper.py +0 -404
  57. xradio/measurement_set/_utils/_zarr/read.py +0 -263
  58. xradio/measurement_set/_utils/_zarr/write.py +0 -329
  59. xradio/measurement_set/_utils/msv2.py +0 -106
  60. xradio/measurement_set/_utils/zarr.py +0 -133
  61. xradio-0.0.56.dist-info/RECORD +0 -78
  62. {xradio-0.0.56.dist-info → xradio-0.0.59.dist-info}/licenses/LICENSE.txt +0 -0
  63. {xradio-0.0.56.dist-info → xradio-0.0.59.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  from __future__ import annotations
2
2
 
3
- from typing import Literal, Optional, Union, List
3
+ from typing import Literal, Optional, Union
4
4
  from xradio.schema.bases import (
5
5
  xarray_dataset_schema,
6
6
  xarray_dataarray_schema,
7
7
  dict_schema,
8
8
  )
9
- from xradio.schema.typing import Attr, Coord, Coordof, Data, Dataof, Name
9
+ from xradio.schema.typing import Attr, Coord, Coordof, Data, Dataof
10
10
  import numpy
11
11
 
12
- MSV4_SCHEMA_VERSION = "4.0.-9988"
12
+ MSV4_SCHEMA_VERSION = "4.0.-9987"
13
13
 
14
14
  # Dimensions
15
15
  Time = Literal["time"]
@@ -46,16 +46,16 @@ UvwLabel = Literal["uvw_label"]
46
46
  """ Coordinate dimension of UVW data (typically shape 3 for 'u', 'v', 'w') """
47
47
  SkyDirLabel = Literal["sky_dir_label"]
48
48
  """ Coordinate labels of sky directions (typically shape 2 and 'ra', 'dec') """
49
+ SkyDisLabel = Literal["sky_dis_label"]
50
+ """ Coordinate labels of sky distance (typically shape 1 and 'dist') """
49
51
  LocalSkyDirLabel = Literal["local_sky_dir_label"]
50
52
  """ Coordinate labels of local sky directions (typically shape 2 and 'az', 'alt') """
51
- SphericalDirLabel = Literal["spherical_dir_label"]
52
- """ Coordinate labels of spherical directions (shape 2 and 'lon', 'lat1' """
53
- SkyPosLabel = Literal["sky_pos_label"]
54
- """ Coordinate labels of sky positions (typically shape 3 and 'ra', 'dec', 'dist') """
55
- SphericalPosLabel = Literal["spherical_pos_label"]
56
- """ Coordinate labels of spherical positions (shape shape 3 and 'lon', 'lat1', 'dist2') """
57
- EllipsoidPosLabel = Literal["ellipsoid_pos_label"]
53
+ LocalSkyDisLabel = Literal["local_sky_dis_label"]
54
+ """ Coordinate labels of local sky distance (typically shape 1 and 'dist') """
55
+ EllipsoidDirLabel = Literal["ellipsoid_dir_label"]
58
56
  """ Coordinate labels of geodetic earth location data (typically shape 3 and 'lon', 'lat', 'height')"""
57
+ EllipsoidDisLabel = Literal["ellipsoid_dis_label"]
58
+ """ Coordinate label of geodetic earth height (typically shape 1 and 'dist')"""
59
59
  CartesianPosLabel = Literal["cartesian_pos_label"]
60
60
  """ Coordinate labels of geocentric earth location data (typically shape 3 and 'x', 'y', 'z')"""
61
61
  CartesianPosLabelLocal = Literal["cartesian_pos_label_local"]
@@ -83,29 +83,27 @@ Doppler = Literal["doppler"]
83
83
  RotationMatrix = Literal["rotation_matrix"]
84
84
 
85
85
  # Units of quantities and measures
86
- UnitsDimensionless = list[
87
- Literal["dimensionless"]
88
- ] # name consistent with casacore measures
89
- UnitsSeconds = list[Literal["s"]]
90
- UnitsHertz = list[Literal["Hz"]]
91
- UnitsMeters = list[Literal["m"]]
92
-
93
- UnitsOfSkyCoordInRadians = list[Literal["rad"], Literal["rad"]]
94
- UnitsOfLocationInMetersOrRadians = Union[
95
- list[Literal["m"], Literal["m"], Literal["m"]],
96
- list[Literal["rad"], Literal["rad"], Literal["m"]],
97
- ]
98
- UnitsOfPositionInRadians = list[Literal["rad"], Literal["rad"], Literal["m"]]
99
- UnitsOfDopplerShift = Union[list[Literal["ratio"]], list[Literal["m/s"]]]
100
-
101
- UnitsRadians = list[Literal["rad"]]
102
- UnitsKelvin = list[Literal["K"]]
103
- UnitsKelvinPerJansky = list[Literal["K/Jy"]]
104
- UnitsMetersPerSecond = list[Literal["m/s"]]
105
- UnitsPascal = list[Literal["Pa"]] # hPa? (in MSv2)
106
- UnitsPerSquareMeters = list[Literal["/m^2"]]
86
+ UnitsDimensionless = Literal["dimensionless"] # name consistent with casacore measures
107
87
 
88
+ UnitsSeconds = Literal["s"]
89
+ UnitsHertz = Literal["Hz"]
90
+ UnitsMeters = Literal["m"]
108
91
 
92
+ # UnitsOfSkyCoordInRadians = Literal["rad"]
93
+ UnitsOfSkyCoordInMetersOrRadians = Literal["m", "rad"]
94
+ UnitsOfLocationInMetersOrRadians = Literal[
95
+ "m",
96
+ "rad",
97
+ ]
98
+ UnitsOfPositionInRadians = Literal["rad"]
99
+ UnitsOfDopplerShift = Literal["ratio", "m/s"]
100
+
101
+ UnitsRadians = Literal["rad"]
102
+ UnitsKelvin = Literal["K"]
103
+ UnitsKelvinPerJansky = Literal["K/Jy"]
104
+ UnitsMetersPerSecond = Literal["m/s"]
105
+ UnitsPascal = Literal["Pa"] # hPa? (in MSv2)
106
+ UnitsPerSquareMeters = Literal["/m^2"]
109
107
  # Quantities
110
108
 
111
109
 
@@ -250,7 +248,7 @@ class TimeArray:
250
248
 
251
249
  type: Attr[Time] = "time"
252
250
  """ Array type. Should be ``"time"``. """
253
- units: Attr[UnitsSeconds] = ("s",)
251
+ units: Attr[UnitsSeconds] = "s"
254
252
  """ Units to associate with axis"""
255
253
  scale: Attr[AllowedTimeScales] = "utc"
256
254
  """
@@ -298,10 +296,9 @@ AllowedSkyCoordFrames = Literal[
298
296
  class SkyCoordArray:
299
297
  """Measures array for data variables that are sky coordinates, used in :py:class:`FieldSourceXds`"""
300
298
 
301
- data: Data[Union[SkyDirLabel, SkyPosLabel], float]
302
-
299
+ data: Data[Union[SkyDirLabel, SkyDisLabel], float]
300
+ units: Attr[UnitsOfSkyCoordInMetersOrRadians]
303
301
  type: Attr[SkyCoord] = "sky_coord"
304
- units: Attr[UnitsOfSkyCoordInRadians] = ("rad", "rad")
305
302
  frame: Attr[AllowedSkyCoordFrames] = "icrs"
306
303
  """
307
304
  Possible values are astropy SkyCoord frames.
@@ -330,7 +327,7 @@ class PointingBeamArray:
330
327
  ]
331
328
 
332
329
  type: Attr[SkyCoord] = "sky_coord"
333
- units: Attr[UnitsOfSkyCoordInRadians] = ("rad", "rad")
330
+ units: Attr[UnitsOfSkyCoordInMetersOrRadians] = "rad"
334
331
  frame: Attr[AllowedSkyCoordFrames] = "icrs"
335
332
  """
336
333
  From fixvis docs: clean and the im tool ignore the reference frame claimed by the UVW column (it is often mislabelled
@@ -347,7 +344,7 @@ class LocalSkyCoordArray:
347
344
  data: Data[LocalSkyDirLabel, float]
348
345
 
349
346
  type: Attr[SkyCoord] = "sky_coord"
350
- units: Attr[UnitsOfSkyCoordInRadians] = ("rad", "rad")
347
+ units: Attr[UnitsOfSkyCoordInMetersOrRadians] = "rad"
351
348
  frame: Attr[AllowedSkyCoordFrames] = "icrs"
352
349
  """
353
350
  From fixvis docs: clean and the im tool ignore the reference frame claimed by the UVW column (it is often mislabelled
@@ -371,7 +368,7 @@ class TimeCoordArray:
371
368
  type: Attr[Time] = "time"
372
369
  """ Coordinate type. Should be ``"time"``. """
373
370
 
374
- units: Attr[UnitsSeconds] = ("s",)
371
+ units: Attr[UnitsSeconds] = "s"
375
372
  """ Units to associate with axis"""
376
373
 
377
374
  scale: Attr[AllowedTimeScales] = "utc"
@@ -407,7 +404,7 @@ class TimeInterpolatedCoordArray:
407
404
  type: Attr[Time] = "time"
408
405
  """ Coordinate type. Should be ``"time"``. """
409
406
 
410
- units: Attr[UnitsSeconds] = ("s",)
407
+ units: Attr[UnitsSeconds] = "s"
411
408
  """ Units to associate with axis"""
412
409
 
413
410
  scale: Attr[AllowedTimeScales] = "utc"
@@ -432,7 +429,7 @@ class TimeSystemCalCoordArray:
432
429
  type: Attr[Time] = "time_system_cal"
433
430
  """ Coordinate type. Should be ``"time_system_cal"``. """
434
431
 
435
- units: Attr[UnitsSeconds] = ("s",)
432
+ units: Attr[UnitsSeconds] = "s"
436
433
  """ Units to associate with axis"""
437
434
 
438
435
  scale: Attr[AllowedTimeScales] = "utc"
@@ -457,7 +454,7 @@ class TimePointingCoordArray:
457
454
  type: Attr[TimePointing] = "time_pointing"
458
455
  """ Coordinate type. Should be ``"time_pointing"``. """
459
456
 
460
- units: Attr[UnitsSeconds] = ("s",)
457
+ units: Attr[UnitsSeconds] = "s"
461
458
  """ Units to associate with axis"""
462
459
 
463
460
  scale: Attr[AllowedTimeScales] = "utc"
@@ -482,7 +479,7 @@ class TimeEphemerisCoordArray:
482
479
  type: Attr[TimeEphemeris] = "time_ephemeris"
483
480
  """ Coordinate type. Should be ``"time_ephemeris"``. """
484
481
 
485
- units: Attr[UnitsSeconds] = ("s",)
482
+ units: Attr[UnitsSeconds] = "s"
486
483
  """ Units to associate with axis"""
487
484
 
488
485
  scale: Attr[AllowedTimeScales] = "utc"
@@ -504,10 +501,10 @@ class TimeWeatherCoordArray:
504
501
  ``format``).
505
502
  """
506
503
 
507
- type: Attr[Time] = "time_weather"
504
+ type: Attr[TimeWeather] = "time_weather"
508
505
  """ Coordinate type. Should be ``"time_weather"``. """
509
506
 
510
- units: Attr[UnitsSeconds] = ("s",)
507
+ units: Attr[UnitsSeconds] = "s"
511
508
  """ Units to associate with axis"""
512
509
 
513
510
  scale: Attr[AllowedTimeScales] = "utc"
@@ -545,7 +542,7 @@ class SpectralCoordArray:
545
542
 
546
543
  data: Data[ZD, float]
547
544
 
548
- units: Attr[UnitsHertz] = ("Hz",)
545
+ units: Attr[UnitsHertz] = "Hz"
549
546
 
550
547
  observer: Attr[AllowedSpectralCoordFrames] = "icrs"
551
548
  """
@@ -582,17 +579,14 @@ class LocationArray:
582
579
  Measure type used for example in antenna_xds/ANTENNA_POSITION, weather_xds/STATION_POSITION,
583
580
  field_and_source_xds(ephemeris)/OBSERVER_POSITION.
584
581
 
585
- Data dimensions can be CartesianPosLabel or EllipsoidPosLabel
582
+ Data dimensions can be CartesianPosLabel or EllipsoidDirLabel or EllipsoidDisLabel
586
583
  """
587
584
 
588
- data: Data[Union[EllipsoidPosLabel, CartesianPosLabel], float]
585
+ data: Data[Union[EllipsoidDirLabel, EllipsoidDisLabel, CartesianPosLabel], float]
589
586
 
590
587
  units: Attr[UnitsOfLocationInMetersOrRadians]
591
588
  """
592
- If the units are a list of strings then it must be the same length as
593
- the last dimension of the data array. This allows for having different
594
- units in the same data array, for example geodetic coordinates could use
595
- ``['rad','rad','m']``.
589
+ Units of the location coordinates (typically 'm' or 'rad').
596
590
  """
597
591
 
598
592
  frame: Attr[AllowedLocationFrames]
@@ -610,46 +604,13 @@ class LocationArray:
610
604
 
611
605
  ellipsoid: Optional[Attr[AllowedEllipsoid]]
612
606
  """
613
- Ellipsoid used in geodetic Earth locations (with EllipsoidPosLabel coordinate)
607
+ Ellipsoid used in geodetic Earth locations (with EllipsoidDirLabel and EllipsoidDirLabel coordinate)
614
608
  """
615
609
 
616
610
  type: Attr[Location] = "location"
617
611
  """ Measure type. Should be ``"location"``."""
618
612
 
619
613
 
620
- @xarray_dataarray_schema
621
- class EllipsoidPosLocationArray:
622
- """
623
- Measure type used for example in field_and_source_xds(ephemeris) / SUB_OBSERVER_DIRECTION, SUB_SOLAR_POSITION
624
- """
625
-
626
- data: Data[EllipsoidPosLabel, float]
627
-
628
- frame: Attr[AllowedLocationFrames]
629
- """
630
- Reference frame. Can be ITRS (assumed for all Earth locations) or Undefined (used in non-Earth locations).
631
- """
632
-
633
- coordinate_system: Attr[AllowedLocationCoordinateSystems]
634
- """ Can be ``geocentric/planetcentric, geodetic/planetodetic, orbital`` """
635
-
636
- origin_object_name: Attr[str]
637
- """
638
- earth/sun/moon/etc
639
- """
640
-
641
- type: Attr[Location] = "location"
642
- """ Measure type. Should be ``"location"``."""
643
-
644
- units: Attr[UnitsOfPositionInRadians] = ("rad", "rad", "m")
645
- """
646
- If the units are a list of strings then it must be the same length as
647
- the last dimension of the data array. This allows for having different
648
- units in the same data array,for example geodetic coordinates could use
649
- ``['rad','rad','m']``.
650
- """
651
-
652
-
653
614
  @xarray_dataarray_schema
654
615
  class BaselineArray:
655
616
  """Model of the baseline_id coordinate in the main dataset (interferometric data, :py:class:`VisibilityXds`)"""
@@ -695,7 +656,7 @@ class DopplerArray:
695
656
  type: Attr[Doppler] = "doppler"
696
657
  """ Coordinate type. Should be ``"doppler"``. """
697
658
 
698
- units: Attr[UnitsOfDopplerShift] = ("m/s",)
659
+ units: Attr[UnitsOfDopplerShift] = "m/s"
699
660
  """ Units to associate with axis, [ratio]/[m/s]"""
700
661
 
701
662
  doppler_type: Attr[AllowedDopplerTypes] = "radio"
@@ -713,6 +674,9 @@ class FrequencyArray:
713
674
  """ Center frequencies for each channel. """
714
675
  spectral_window_name: Attr[str]
715
676
  """ Name associated with spectral window. """
677
+ spectral_window_intent: Attr[str]
678
+ """ An intent string that identifies the intention of the spectral window, for example
679
+ continuum, spectral line, etc. See :ref:`spw intents` for possible values. """
716
680
  frequency_group_name: Optional[Attr[str]]
717
681
  """ Name associated with frequency group - needed for multi-band VLBI fringe-fitting."""
718
682
  reference_frequency: Attr[SpectralCoordArray]
@@ -731,7 +695,7 @@ class FrequencyArray:
731
695
  """ Coordinate type. Should be ``"spectral_coord"``. """
732
696
  long_name: Optional[Attr[str]] = "Frequency"
733
697
  """ Long-form name to use for axis"""
734
- units: Attr[UnitsHertz] = ("Hz",)
698
+ units: Attr[UnitsHertz] = "Hz"
735
699
  """ Units to associate with axis"""
736
700
  observer: Attr[AllowedSpectralCoordFrames] = "icrs"
737
701
  """
@@ -751,7 +715,7 @@ class FrequencySystemCalArray:
751
715
  """ Center frequencies for each channel. """
752
716
 
753
717
  type: Attr[SpectralCoord] = "spectral_coord"
754
- units: Attr[UnitsHertz] = ("Hz",)
718
+ units: Attr[UnitsHertz] = "Hz"
755
719
  """ Units to associate with axis"""
756
720
 
757
721
  observer: Attr[AllowedSpectralCoordFrames] = "icrs"
@@ -834,7 +798,7 @@ class FlagArray:
834
798
  polarization: Optional[Coordof[PolarizationArray]] = None
835
799
  long_name: Optional[Attr[str]] = "Visibility flags"
836
800
 
837
- allow_mutiple_versions: Optional[Attr[bool]] = True
801
+ allow_multiple_versions: Optional[Attr[bool]] = True
838
802
 
839
803
 
840
804
  @xarray_dataarray_schema
@@ -872,7 +836,7 @@ class WeightArray:
872
836
  polarization: Optional[Coordof[PolarizationArray]] = None
873
837
  long_name: Optional[Attr[str]] = "Visibility weights"
874
838
 
875
- allow_mutiple_versions: Optional[Attr[bool]] = True
839
+ allow_multiple_versions: Optional[Attr[bool]] = True
876
840
 
877
841
 
878
842
  # J2000=>fk5 is used most often. icrs is used less often. Both fk5 and icrs are also borrowed from the field center (to fix
@@ -933,9 +897,9 @@ class UvwArray:
933
897
  type: Attr[Literal["uvw"]] = "uvw"
934
898
  frame: Attr[AllowedUvwFrames] = "icrs"
935
899
  """ To be defined in astropy (see for example https://github.com/astropy/astropy/issues/7766) """
936
- units: Attr[UnitsMeters] = ("m",)
900
+ units: Attr[UnitsMeters] = "m"
937
901
 
938
- allow_mutiple_versions: Optional[Attr[bool]] = True
902
+ allow_multiple_versions: Optional[Attr[bool]] = True
939
903
 
940
904
 
941
905
  @xarray_dataarray_schema
@@ -963,7 +927,7 @@ class TimeSamplingArray:
963
927
  """ Astropy format, see :py:class:`astropy.time.Time`. Default seconds from 1970-01-01 00:00:00 UTC """
964
928
 
965
929
  long_name: Optional[Attr[str]] = "Time sampling data"
966
- units: Attr[UnitsSeconds] = ("s",)
930
+ units: Attr[UnitsSeconds] = "s"
967
931
 
968
932
 
969
933
  # @xarray_dataarray_schema
@@ -991,7 +955,7 @@ class TimeSamplingArray:
991
955
  # baseline_id: Optional[Coordof[BaselineArray]] = None
992
956
  # polarization: Optional[Coordof[PolarizationArray]] = None
993
957
  # long_name: Optional[Attr[str]] = "Frequency sampling data"
994
- # units: Attr[UnitsHertz] = ("Hz",)
958
+ # units: Attr[UnitsHertz] = "Hz"
995
959
  # observer: Attr[AllowedSpectralCoordFrames] = "icrs"
996
960
  # """
997
961
  # Astropy velocity reference frames (see :external:ref:`astropy-spectralcoord`).
@@ -1018,7 +982,7 @@ class FrequencyCentroidArray:
1018
982
  """
1019
983
  frequency: Coordof[FrequencyArray]
1020
984
  long_name: Optional[Attr[str]] = "Frequency sampling data"
1021
- units: Attr[UnitsHertz] = ("Hz",)
985
+ units: Attr[UnitsHertz] = "Hz"
1022
986
  observer: Attr[AllowedSpectralCoordFrames] = "icrs"
1023
987
  """
1024
988
  Astropy velocity reference frames (see :external:ref:`astropy-spectralcoord`).
@@ -1031,7 +995,7 @@ class FrequencyCentroidArray:
1031
995
  @xarray_dataarray_schema
1032
996
  class EffectiveChannelWidthArray:
1033
997
  """
1034
- Model of frequency related data variables of the main dataset, such as EFFECTIV_CHANNEL_WIDTH.
998
+ Model of frequency related data variables of the main dataset, such as EFFECTIVE_CHANNEL_WIDTH.
1035
999
  """
1036
1000
 
1037
1001
  data: Data[
@@ -1051,7 +1015,7 @@ class EffectiveChannelWidthArray:
1051
1015
  baseline_id: Optional[Coordof[BaselineArray]] = None
1052
1016
  polarization: Optional[Coordof[PolarizationArray]] = None
1053
1017
  long_name: Optional[Attr[str]] = "Frequency sampling data"
1054
- units: Attr[UnitsHertz] = ("Hz",)
1018
+ units: Attr[UnitsHertz] = "Hz"
1055
1019
  observer: Attr[AllowedSpectralCoordFrames] = "icrs"
1056
1020
  """
1057
1021
  Astropy velocity reference frames (see :external:ref:`astropy-spectralcoord`).
@@ -1081,7 +1045,7 @@ class FieldSourceXds:
1081
1045
  sky_dir_label: Coord[SkyDirLabel, str]
1082
1046
  """ Coordinate labels of sky directions (typically shape 2 and 'ra', 'dec') """
1083
1047
 
1084
- FIELD_PHASE_CENTER: Optional[Data[FieldName, SkyCoordArray]]
1048
+ FIELD_PHASE_CENTER_DIRECTION: Optional[Data[FieldName, SkyCoordArray]]
1085
1049
  """
1086
1050
  Offset from the SOURCE_DIRECTION that gives the direction of phase
1087
1051
  center for which the fringes have been stopped-that is a point source in
@@ -1091,14 +1055,14 @@ class FieldSourceXds:
1091
1055
  varies with field, it refers DelayDir_Ref column instead.
1092
1056
  """
1093
1057
 
1094
- FIELD_REFERENCE_CENTER: Optional[Data[FieldName, SkyCoordArray]]
1058
+ FIELD_REFERENCE_CENTER_DIRECTION: Optional[Data[FieldName, SkyCoordArray]]
1095
1059
  """
1096
1060
  Used in single-dish to record the associated reference direction if positionswitching
1097
1061
  been applied. For conversion from MSv2, frame refers column keywords by default. If
1098
1062
  frame varies with field, it refers DelayDir_Ref column instead.
1099
1063
  """
1100
1064
 
1101
- SOURCE_LOCATION: Optional[Data[FieldName, SkyCoordArray]]
1065
+ SOURCE_DIRECTION: Optional[Data[FieldName, SkyCoordArray]]
1102
1066
  """
1103
1067
  CASA Table Cols: RA,DEC,Rho."Astrometric RA and Dec and Geocentric
1104
1068
  distance with respect to the observer’s location (Geocentric). "Adjusted
@@ -1169,7 +1133,7 @@ class FieldSourceEphemerisXds:
1169
1133
  time: Coordof[TimeInterpolatedCoordArray]
1170
1134
  """Midpoint of time for which this set of parameters is accurate. Labeled 'time' when interpolated to main time """
1171
1135
 
1172
- FIELD_PHASE_CENTER: Optional[Data[tuple[Time], SkyCoordArray]]
1136
+ FIELD_PHASE_CENTER_DIRECTION: Optional[Data[tuple[Time], SkyCoordArray]]
1173
1137
  """
1174
1138
  Offset from the SOURCE_DIRECTION that gives the direction of phase
1175
1139
  center for which the fringes have been stopped-that is a point source in
@@ -1179,7 +1143,24 @@ class FieldSourceEphemerisXds:
1179
1143
  varies with field, it refers DelayDir_Ref column instead.
1180
1144
  """
1181
1145
 
1182
- FIELD_REFERENCE_CENTER: Optional[Data[tuple[Time], SkyCoordArray]]
1146
+ FIELD_PHASE_CENTER_DISTANCE: Optional[Data[tuple[Time], SkyCoordArray]]
1147
+ """
1148
+ Offset from the SOURCE_DIRECTION that gives the direction of phase
1149
+ center for which the fringes have been stopped-that is a point source in
1150
+ this direction will produce a constant measured phase (page 2 of
1151
+ https://articles.adsabs.harvard.edu/pdf/1999ASPC..180...79F). For
1152
+ conversion from MSv2, frame refers column keywords by default. If frame
1153
+ varies with field, it refers DelayDir_Ref column instead.
1154
+ """
1155
+
1156
+ FIELD_REFERENCE_CENTER_DIRECTION: Optional[Data[tuple[Time], SkyCoordArray]]
1157
+ """
1158
+ Used in single-dish to record the associated reference direction if positionswitching
1159
+ been applied. For conversion from MSv2, frame refers column keywords by default. If
1160
+ frame varies with field, it refers DelayDir_Ref column instead.
1161
+ """
1162
+
1163
+ FIELD_REFERENCE_CENTER_DISTANCE: Optional[Data[tuple[Time], SkyCoordArray]]
1183
1164
  """
1184
1165
  Used in single-dish to record the associated reference direction if positionswitching
1185
1166
  been applied. For conversion from MSv2, frame refers column keywords by default. If
@@ -1234,7 +1215,7 @@ class FieldSourceEphemerisXds:
1234
1215
  tuple[Time],
1235
1216
  tuple[TimeEphemeris],
1236
1217
  ],
1237
- EllipsoidPosLocationArray,
1218
+ LocationArray,
1238
1219
  ]
1239
1220
  ]
1240
1221
  """ 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 """
@@ -1245,7 +1226,7 @@ class FieldSourceEphemerisXds:
1245
1226
  tuple[Time],
1246
1227
  tuple[TimeEphemeris],
1247
1228
  ],
1248
- EllipsoidPosLocationArray,
1229
+ LocationArray,
1249
1230
  ]
1250
1231
  ]
1251
1232
  """ 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 """
@@ -1285,13 +1266,14 @@ class FieldSourceEphemerisXds:
1285
1266
  # --- Optional coordinates ---
1286
1267
  sky_dir_label: Optional[Coord[SkyDirLabel, str]] = ("ra", "dec")
1287
1268
  """ Coordinate labels of sky directions (typically shape 2 and 'ra', 'dec') """
1288
- sky_pos_label: Optional[Coord[SkyPosLabel, str]] = ("ra", "dec", "dist")
1289
- """ Coordinate lables of sky positions (typically shape 3 and 'ra', 'dec', 'dist') """
1290
- ellipsoid_pos_label: Optional[Coord[EllipsoidPosLabel, str]] = (
1269
+ sky_dis_label: Optional[Coord[SkyDisLabel, str]] = "dist"
1270
+ """ Coordinate lables of sky distance (typically shape 1 and 'dist') """
1271
+ ellipsoid_dir_label: Optional[Coord[EllipsoidDirLabel, str]] = (
1291
1272
  "lon",
1292
1273
  "lat",
1293
- "height",
1294
1274
  )
1275
+ ellipsoid_dis_label: Optional[Coord[EllipsoidDisLabel, str]] = "height"
1276
+
1295
1277
  """ Coordinate labels of geodetic earth location data (typically shape 3 and 'lon', 'lat', 'height')"""
1296
1278
  cartesian_pos_label: Optional[Coord[CartesianPosLabel, str]] = ("x", "y", "z")
1297
1279
  """ Coordinate labels of geocentric earth location data (typically shape 3 and 'x', 'y', 'z')"""
@@ -1322,7 +1304,7 @@ class SpectrumArray:
1322
1304
 
1323
1305
  long_name: Optional[Attr[str]] = "Spectrum values"
1324
1306
  """ Long-form name to use for axis. Should be ``"Spectrum values"``"""
1325
- units: Attr[list[str]] = ("Jy",)
1307
+ units: Attr[str] = "Jy"
1326
1308
 
1327
1309
 
1328
1310
  @xarray_dataarray_schema
@@ -1341,9 +1323,8 @@ class VisibilityArray:
1341
1323
 
1342
1324
  long_name: Optional[Attr[str]] = "Visibility values"
1343
1325
  """ Long-form name to use for axis. Should be ``"Visibility values"``"""
1344
- units: Attr[list[str]] = ("Jy",)
1345
-
1346
- allow_mutiple_versions: Optional[Attr[bool]] = True
1326
+ units: Attr[str] = "Jy"
1327
+ allow_multiple_versions: Optional[Attr[bool]] = True
1347
1328
 
1348
1329
 
1349
1330
  # Info dicts
@@ -1379,7 +1360,7 @@ class VisibilityArray:
1379
1360
 
1380
1361
  @dict_schema
1381
1362
  class ObservationInfoDict:
1382
- observer: list
1363
+ observer: list[str]
1383
1364
  """List of observer names."""
1384
1365
  project: str
1385
1366
  """Project Code/Project_UID"""
@@ -1404,9 +1385,22 @@ class ObservationInfoDict:
1404
1385
  """ASDM: Logs of the observation during this execu- tion block."""
1405
1386
  intents: list[str]
1406
1387
  """ An intent string identifies one intention of the scan, such as to calibrate or observe a
1407
- target. See :ref:`scan intents` for possible values. When converting from MSv2, the list of
1408
- intents is derived from the OBS_MODE column of MSv2 state table (every comma separated value
1409
- is taken as an intent). """
1388
+ target. See :ref:`scan intents` for possible intent/subintent values. When converting from MSv2,
1389
+ the list of intents is derived from the OBS_MODE column of MSv2 state table (every comma
1390
+ separated value is taken as an intent).
1391
+ A common convention used in the MSv2 OBS_MODE column is to specify multiple intents separated
1392
+ by commas, each of them giving a main intent and a subintent separated by a '#' character. This
1393
+ is represented in this attribute as a list of "intent#subintent" strings. These are a few
1394
+ example lists:
1395
+ ["CALIBRATE_DELAY#ON_SOURCE" , "CALIBRATE_PHASE#ON_SOURCE", "CALIBRATE_WVR#ON_SOURCE"],
1396
+ ["CALIBRATE_FLUX#ON_SOURCE" , "CALIBRATE_WVR#ON_SOURCE"],
1397
+ ["CALIBRATE_POINTING#ON_SOURCE", "CALIBRATE_WVR#ON_SOURCE", "CALIBRATE_DELAY#ON_SOURCE"],
1398
+ ["CALIBRATE_ATMOSPHERE#AMBIENT", "CALIBRATE_WVR#AMBIENT"],
1399
+ ["CALIBRATE_FOCUS#ON_SOURCE" , "CALIBRATE_WVR#ON_SOURCE"],
1400
+ ["OBSERVE_TARGET#ON_SOURCE"], or ["OBSERVE_TARGE#UNSPECIFIED"].
1401
+ The list of possible intent and subintent names (see :ref:`scan intents`) is derived from the
1402
+ respective ASDM enumerations.
1403
+ """
1410
1404
 
1411
1405
 
1412
1406
  @dict_schema
@@ -1432,7 +1426,7 @@ class DataGroupDict:
1432
1426
  uvw: Optional[str]
1433
1427
  """ Name of the UVW variable of the group, for example 'UVW'. """
1434
1428
  field_and_source: str
1435
- """ Name of the field_and_source_xds, for example field_and_source_xds_base. """
1429
+ """ Name of the field_and_source_xds, for example field_and_source_base_xds. """
1436
1430
  description: str
1437
1431
  """ More details about the data group. """
1438
1432
  date: str
@@ -1441,7 +1435,8 @@ class DataGroupDict:
1441
1435
 
1442
1436
  @dict_schema
1443
1437
  class DataGroupsDict:
1444
- """Dictionary of data group dictionaries."""
1438
+ """Dictionary of data group dictionaries. A 'base' data group is mandatory.
1439
+ Additional data groups can be added with different names."""
1445
1440
 
1446
1441
  base: DataGroupDict
1447
1442
 
@@ -1488,7 +1483,9 @@ class AntennaXds:
1488
1483
  as measured after all polarization combiners. ['X','Y'], ['R','L'] """
1489
1484
  cartesian_pos_label: Optional[Coord[CartesianPosLabel, str]]
1490
1485
  """ (x,y,z) - either cartesian or ellipsoid """
1491
- ellipsoid_pos_label: Optional[Coord[EllipsoidPosLabel, str]]
1486
+ ellipsoid_dir_label: Optional[Coord[EllipsoidDirLabel, str]]
1487
+ """ (lon, lat, dist) - either cartesian or ellipsoid"""
1488
+ ellipsoid_dis_label: Optional[Coord[EllipsoidDisLabel, str]]
1492
1489
  """ (lon, lat, dist) - either cartesian or ellipsoid"""
1493
1490
 
1494
1491
  # Data variables
@@ -1644,7 +1641,7 @@ class PhaseCalibrationXds:
1644
1641
  tuple[AntennaName, Time, ReceptorLabel, ToneLabel],
1645
1642
  tuple[AntennaName, TimePhaseCal, ReceptorLabel, ToneLabel],
1646
1643
  ],
1647
- numpy.complex64,
1644
+ Union[numpy.complex64, numpy.complex128],
1648
1645
  ]
1649
1646
  """
1650
1647
  Phase calibration measurements. These are provided as complex values that represent both the phase
@@ -1698,12 +1695,13 @@ class WeatherXds:
1698
1695
  """ Mid-point of the time interval. Labeled 'time' when interpolated to main time axis """
1699
1696
  time_weather: Optional[Coordof[TimeWeatherCoordArray]]
1700
1697
  """ Mid-point of the time interval. Labeled 'time_weather' when not interpolated to main time axis """
1701
- ellipsoid_pos_label: Optional[Coord[EllipsoidPosLabel, str]] = (
1698
+ ellipsoid_dir_label: Optional[Coord[EllipsoidDirLabel, str]] = (
1702
1699
  "lon",
1703
1700
  "lat",
1704
- "height",
1705
1701
  )
1706
- """ Coordinate labels of geodetic earth location data (typically shape 3 and 'lon', 'lat', 'height')"""
1702
+ """ Coordinate labels of geodetic earth location data (typically shape 2 and 'lon', 'lat')"""
1703
+ ellipsoid_dis_label: Optional[Coord[EllipsoidDisLabel, str]] = ("height",)
1704
+ """ Coordinate labels of geodetic earth height data (typically shape 1 and 'height')"""
1707
1705
  cartesian_pos_label: Optional[Coord[CartesianPosLabel, str]] = ("x", "y", "z")
1708
1706
  """ Coordinate labels of geocentric earth location data (typically shape 3 and 'x', 'y', 'z')"""
1709
1707
 
@@ -2023,13 +2021,6 @@ class SystemCalibrationXds:
2023
2021
  """
2024
2022
 
2025
2023
 
2026
- @xarray_dataset_schema
2027
- class PhasedArrayXds:
2028
- """Not specified. Not implemented."""
2029
-
2030
- pass
2031
-
2032
-
2033
2024
  @xarray_dataset_schema
2034
2025
  class DopplerXds:
2035
2026
  """Not specified. Not implemented."""
@@ -2237,8 +2228,7 @@ class PhasedArrayElementOffsetArray:
2237
2228
  tuple[AntennaName, CartesianPosLabelLocal, ElementId],
2238
2229
  float,
2239
2230
  ]
2240
-
2241
- units: Attr[list[Literal["m"]]]
2231
+ units: Attr[Literal["m"]]
2242
2232
 
2243
2233
  type: Attr[Location]
2244
2234
  """ Measure type. Should be ``"location"``."""