cubevis 0.5.14__py3-none-any.whl → 0.5.15__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.

Potentially problematic release.


This version of cubevis might be problematic. Click here for more details.

cubevis/__version__.py CHANGED
@@ -1 +1 @@
1
- __version__ = '0.5.14'
1
+ __version__ = '0.5.15'
@@ -32,6 +32,11 @@ from cubevis.utils import copydoc, ImportProtectedModule
32
32
  from cubevis.bokeh.state import initialize_session
33
33
  initialize_session()
34
34
 
35
+ ###
36
+ ### This import roundabout was introduced when astroviper and casa6 apps were in the same
37
+ ### package to avoid forcing the user to install BOTH astroviper and casa6 even if they
38
+ ### were only going to use one of the applications. Now it could be removed...
39
+ ###
35
40
  sys.modules[__name__].__class__ = ImportProtectedModule( __name__, { 'plotants': '._plotants',
36
41
  'plotbandpass': '._plotbandpass',
37
42
  'CreateMask': '._createmask',
@@ -40,5 +45,4 @@ sys.modules[__name__].__class__ = ImportProtectedModule( __name__, { 'plotants':
40
45
  'iclean': '..casatasks.iclean',
41
46
  'createmask': '..casatasks.createmask',
42
47
  'createregion': '..casatasks.createregion',
43
- 'MsRaster': '._ms_raster',
44
48
  } )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cubevis
3
- Version: 0.5.14
3
+ Version: 0.5.15
4
4
  Summary: visualization toolkit and apps for casa
5
5
  License: LGPL
6
6
  Author-email: Darrell Schiebel <darrell@schiebel.us>,Pam Harris <pharris@nrao.edu>
@@ -69,33 +69,13 @@ cubevis/bokeh/utils/_axes_labels.py,sha256=VBeFeYIJfjxGGHPM0r82P01y1pRrXg5j0Cbk6
69
69
  cubevis/bokeh/utils/_svg_icon.py,sha256=Q46oIZCh1TzhkKVMHHRIgU1HwX624z3C_M4Ko7vY__c,23331
70
70
  cubevis/data/__init__.py,sha256=_j5cRA9l9Nl0ycL_SsbeLP1Uil_q1ldiVKJk5IeRFx8,77
71
71
  cubevis/data/casaimage/__init__.py,sha256=55ebo9hReK8DdnVDiFK25wYDGizQoRvjcKCIQCdgEck,3606
72
- cubevis/data/measurement_set/__init__.py,sha256=5J5Um4LJD956RMYhm9rc_ZkrDzXZ_ixaJtX97k9ywV0,107
73
- cubevis/data/measurement_set/_ms_data.py,sha256=y81KHxxbrPicL52ZE8B_nz7rRdiAWsHApKuVJbGAbiE,6531
74
- cubevis/data/measurement_set/processing_set/__init__.py,sha256=UXigxZV3Q8-PWDVeSDOMxXh73oSYLKLpkkN266s8taQ,464
75
- cubevis/data/measurement_set/processing_set/_ps_concat.py,sha256=ZlZ6Ygok_wnrn7h4U1OXERxr5zJRAX6jZi3_eKtwiuA,3484
76
- cubevis/data/measurement_set/processing_set/_ps_coords.py,sha256=pdmojL-_55x3CjFcMIMuIqsI4ADG-TlLxc-RTgBQZC8,3640
77
- cubevis/data/measurement_set/processing_set/_ps_data.py,sha256=bwV60t_RC5589X-TPgQ8hJ9W5UPUpQyWFVThklpzd4w,9259
78
- cubevis/data/measurement_set/processing_set/_ps_io.py,sha256=i-YkHEOPpqLLbUv6Gd29EQfJfq_Hgs0055vDwc3Hmbo,1709
79
- cubevis/data/measurement_set/processing_set/_ps_raster_data.py,sha256=WuT8uIQoqSrGHdL0YP-ps1eZfAgS9P4BF4HbIvxpT1k,6764
80
- cubevis/data/measurement_set/processing_set/_ps_select.py,sha256=limqv4la3cRd3H0z7ZAFpQSMFPQRUa81xne0c-KVLPY,3450
81
- cubevis/data/measurement_set/processing_set/_ps_stats.py,sha256=GkyR5-f4mCNaqfxZuDZYzW3x5Q7xnMQDDNmXs0cIEI0,8156
82
- cubevis/data/measurement_set/processing_set/_xds_data.py,sha256=rEHMFCQd_q8S8wlCQFk3lvQrTsF_K4LyhCcXHC-54aM,5253
83
- cubevis/plot/__init__.py,sha256=y2VbAUP-ilRul3Fk_2QepvjKLU-X_p2xNnF7weRY0Lw,87
84
- cubevis/plot/ms_plot/__init__.py,sha256=f2okSBxRB-GgdiJGUE5ZfPgKY2_dzDkGfX91GxRUE94,658
85
- cubevis/plot/ms_plot/_ms_plot.py,sha256=fwKJoi6BI6Ql0V0Xgz6PYZIQODfAU_cB-l8PXVStjBI,9585
86
- cubevis/plot/ms_plot/_ms_plot_constants.py,sha256=LHjd3X7kZmilKSM3Mqf2Ys1ui4yWKI2yx0Otbeu_L2U,744
87
- cubevis/plot/ms_plot/_ms_plot_selectors.py,sha256=bus0R6R8BNS6Y2dMxVngf6v54AIZTdY0JRZ038Rp0Sc,10048
88
- cubevis/plot/ms_plot/_raster_plot.py,sha256=OtEDX5cjNZ65Wn1vB8vTxEr1JZejyXgE9nW_liUNAwc,12958
89
- cubevis/plot/ms_plot/_raster_plot_inputs.py,sha256=yUFob7t4JMXTwHjzNWZMEMLCvQdJ55SyWj3mZBxHgos,5173
90
- cubevis/plot/ms_plot/_xds_plot_axes.py,sha256=EeWvAbiKV33nEWdI8V3M0uwLTnycq4bFYBOyVWkxCu0,4429
91
72
  cubevis/private/_gclean.py,sha256=ExdR6cRxSa6Xne2veGNKhbTtx-tXUIWr2htzEmEZ9Z4,41107
92
- cubevis/private/apps/__init__.py,sha256=-9U6o-SClwJolGDnFhlH1au4tz-w4HgRcyT4_OQ_Z7E,2510
73
+ cubevis/private/apps/__init__.py,sha256=NIC0XCfjInbAmteORFWtohMvq3Nf8EZ5bsvvUpDYSig,2679
93
74
  cubevis/private/apps/_createmask.py,sha256=bKFpME5MYhLh7HxlJZINBTwG25t0_T_d1nYrWYAWYPA,23527
94
75
  cubevis/private/apps/_createregion.py,sha256=ujLQeXl-afooRU0YLcJ43FMMDMU37SoHtuPJnwNHcEw,26667
95
76
  cubevis/private/apps/_interactiveclean.mustache,sha256=vjTBSI8BlB8CIopu4oydrgeleOAwCjqWCh3Rwr_AALA,103811
96
77
  cubevis/private/apps/_interactiveclean.py,sha256=pGywKaty1rjW5uGblY3Nj5G22lGaOBvDuOM_z560Yps,241462
97
78
  cubevis/private/apps/_interactiveclean_wrappers.py,sha256=XqyCGz33CMDhszTxnwZ_3-64GszUK1XYnGKUOxl9sas,5071
98
- cubevis/private/apps/_ms_raster.py,sha256=fAE3-qaqD4N2o6TyR_eD1r8IXDJL_tu03WpR2e4gMSM,36511
99
79
  cubevis/private/apps/_plotants.py,sha256=top6VWVd_sE48IVPH_sIg3_sQeDl5tadi5DL7r5tUEI,10823
100
80
  cubevis/private/apps/_plotbandpass.py,sha256=NwOgKSRnpLw9Pt3KIdBpoV78q1OnjCvj6lWFqeyICt8,185
101
81
  cubevis/private/casashell/createmask.py,sha256=C1eSUUsttSGghjZ5aDUVhRxnjir5MlYXVyxzEYLcI3k,14457
@@ -125,8 +105,8 @@ cubevis/utils/_pkgs.py,sha256=mu2CCzndmJZYP81UkFhxveW_CisWLUvagJVolHOEVgM,2294
125
105
  cubevis/utils/_regions.py,sha256=TdAg4ZUUyhg3nFmX9_KLboqmc0LkyOdEW8M1WDR5Udk,1669
126
106
  cubevis/utils/_static.py,sha256=rN-sqXNqQ5R2M3wmPHU1GPP5OTyyWQlUPRuimCrht-g,2347
127
107
  cubevis/utils/_tiles.py,sha256=A9W1X61VOhBMTOKXVajzOIoiV2FBdO5N2SFB9SUpDOo,7336
128
- cubevis/__version__.py,sha256=b0SXIqxAeGNbHqmEF6canIj9jyDgtVMVv8z82e2cFm0,22
129
- cubevis-0.5.14.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
130
- cubevis-0.5.14.dist-info/METADATA,sha256=tnS8xGsFgp9tzj35CfXhVLoG5qZKaL7kkrud-0Cm8ao,2629
131
- cubevis-0.5.14.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
132
- cubevis-0.5.14.dist-info/RECORD,,
108
+ cubevis/__version__.py,sha256=AY1ui0mbvXZlpcjpLjHFuQpAuauOU39eXGAyXwQEiy0,22
109
+ cubevis-0.5.15.dist-info/WHEEL,sha256=B19PGBCYhWaz2p_UjAoRVh767nYQfk14Sn4TpIZ-nfU,87
110
+ cubevis-0.5.15.dist-info/METADATA,sha256=gVDiVren7K70s3hkfcjp1zarq4_7g55-NS2XdI041FQ,2629
111
+ cubevis-0.5.15.dist-info/licenses/LICENSE,sha256=IMF9i4xIpgCADf0U-V1cuf9HBmqWQd3qtI3FSuyW4zE,26526
112
+ cubevis-0.5.15.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- '''
2
- Module to access MeasurementSet data using MsData class.
3
- '''
4
-
5
- from ._ms_data import (
6
- MsData
7
- )
@@ -1,178 +0,0 @@
1
- '''
2
- Class for accessing and selecting MeasurementSet data using a data backend.
3
- '''
4
-
5
- from cubevis.data.measurement_set.processing_set._ps_data import PsData
6
-
7
- class MsData:
8
- '''
9
- Access and select MeasurementSet data.
10
- Current backend implementation is PsData using xradio Processing Set.
11
- '''
12
-
13
- def __init__(self, ms_path, logger):
14
- self._ms_path = ms_path
15
- self._logger = logger
16
- self._data = None
17
- self._data_initialized = False
18
- self._init_data(ms_path)
19
-
20
- def is_valid(self):
21
- ''' Returns whether MS path has been set so data can be accessed. '''
22
- return self._data_initialized
23
-
24
- def is_ms_path(self, path):
25
- ''' Check if input path matches input ms path or zarr path '''
26
- return path == self.get_path() or path == self._ms_path
27
-
28
- def get_path(self):
29
- ''' Returns path of MS/zarr file or None if not set. '''
30
- if self._data_initialized:
31
- return self._data.get_path() # path to zarr file
32
- if self._ms_path:
33
- return self._ms_path # path to ms v2
34
- return None
35
-
36
- def summary(self, data_group='base', columns=None):
37
- ''' Print summary of Processing Set data.
38
- columns (None, str, list): type of metadata to list.
39
- None: Print all summary columns in ProcessingSet.
40
- 'by_msv4': Print formatted summary metadata by MSv4.
41
- str, list: Print a subset of summary columns in ProcessingSet.
42
- Options: 'name', 'intents', 'shape', 'polarization', 'scan_number', 'spw_name',
43
- 'field_name, 'source_name', 'field_coords', 'start_frequency', 'end_frequency'
44
- '''
45
- # ProcessingSet function
46
- if self._data_initialized:
47
- self._data.summary(data_group, columns)
48
- else:
49
- self._log_no_ms()
50
-
51
- def get_ps_summary(self):
52
- ''' Return Pandas DataFrame summary of ProcessingSet '''
53
- if self._data_initialized:
54
- return self._data.get_summary()
55
- self._log_no_ms()
56
- return None
57
-
58
- def data_groups(self):
59
- ''' Returns set of data group names in Processing Set data. '''
60
- # ProcessingSet function
61
- if self._data_initialized:
62
- return self._data.get_data_groups()
63
- self._log_no_ms()
64
- return None
65
-
66
- def get_antennas(self, plot_positions=False, label_antennas=False):
67
- ''' Returns list of antenna names in data.
68
- plot_positions (bool): show plot of antenna positions.
69
- label_antennas (bool): label positions with antenna names.
70
- '''
71
- # Antenna positions plot is ProcessingSet function
72
- if self._data_initialized:
73
- return self._data.get_antennas(plot_positions, label_antennas)
74
- self._log_no_ms()
75
- return None
76
-
77
- def plot_phase_centers(self, data_group='base', label_all_fields=False):
78
- ''' Plot the phase center locations of all fields in the Processing Set (original or selected) and label central field.
79
- label_all_fields (bool); label all fields on the plot
80
- data_group (str); data group to use for processing.
81
- '''
82
- # ProcessingSet function
83
- if self._data_initialized:
84
- self._data.plot_phase_centers(label_all_fields, data_group)
85
- else:
86
- self._log_no_ms()
87
-
88
- def get_num_ms(self):
89
- ''' Returns number of MeasurementSets in data. '''
90
- if self._data_initialized:
91
- return self._data.get_ps_len()
92
- self._log_no_ms()
93
- return None
94
-
95
- def get_max_data_dims(self):
96
- ''' Returns maximum length of dimensions in data. '''
97
- if self._data_initialized:
98
- return self._data.get_max_dims()
99
- self._log_no_ms()
100
- return None
101
-
102
- def get_data_dimensions(self):
103
- ''' Returns names of data dimensions. '''
104
- if self._data_initialized:
105
- return self._data.get_data_dimensions()
106
- self._log_no_ms()
107
- return None
108
-
109
- def get_dimension_values(self, dim):
110
- ''' Return values for dimension in current data.
111
- dim (str): dimension name
112
- '''
113
- if self._data_initialized:
114
- return self._data.get_dimension_values(dim)
115
- self._log_no_ms()
116
- return None
117
-
118
- def get_dimension_attrs(self, dim):
119
- ''' Return dict of data attributes for dimension.
120
- dim (str): dimension name
121
- '''
122
- if self._data_initialized:
123
- return self._data.get_dimension_attrs(dim)
124
- self._log_no_ms()
125
- return None
126
-
127
- def get_first_spw(self):
128
- ''' Returns name of first spw by id. '''
129
- if self._data_initialized:
130
- return self._data.get_first_spw()
131
- self._log_no_ms()
132
- return None
133
-
134
- def select_data(self, selection):
135
- ''' Apply selection in data.
136
- selection (dict): fields and values to select
137
- '''
138
- if self._data_initialized:
139
- self._data.select_data(selection)
140
- else:
141
- self._log_no_ms()
142
-
143
- def clear_selection(self):
144
- ''' Clears selection dict and selected data. '''
145
- if self._data_initialized:
146
- self._data.clear_selection()
147
-
148
- def get_vis_stats(self, selection, vis_axis):
149
- ''' Returns statistics (min, max, mean, std) for data selected by selection.
150
- selection (dict): fields and values to select
151
- '''
152
- if self._data_initialized:
153
- return self._data.get_vis_stats(selection, vis_axis)
154
- self._log_no_ms()
155
- return None
156
-
157
- def get_correlated_data(self, data_group):
158
- ''' Returns name of correlated data variable in Processing Set data group '''
159
- if self._data_initialized:
160
- return self._data.get_correlated_data(data_group)
161
- self._log_no_ms()
162
- return None
163
-
164
- def get_raster_data(self, plot_inputs):
165
- ''' Returns xarray Dataset after applying plot inputs and raster plane selection '''
166
- if self._data_initialized:
167
- return self._data.get_raster_data(plot_inputs)
168
- self._log_no_ms()
169
- return None
170
-
171
- def _log_no_ms(self):
172
- self._logger.info("No MS path set, cannot access data")
173
-
174
- def _init_data(self, ms_path):
175
- ''' Data backend for MeasurementSet; currently xradio ProcessingSet '''
176
- if ms_path:
177
- self._data = PsData(ms_path, self._logger)
178
- self._data_initialized = True
@@ -1,30 +0,0 @@
1
- '''
2
- Module to access MeasurementSet data using xradio ProcessingSetXdt and Xarray objects.
3
- '''
4
-
5
- from ._ps_concat import (
6
- concat_ps_xdt,
7
- )
8
-
9
- from ._ps_coords import (
10
- set_coordinates,
11
- set_datetime_coordinate,
12
- set_index_coordinates,
13
- )
14
-
15
- from ._ps_data import (
16
- PsData,
17
- )
18
-
19
- from ._ps_io import (
20
- get_processing_set,
21
- )
22
-
23
- from ._ps_raster_data import (
24
- raster_data,
25
- )
26
-
27
- from ._xds_data import (
28
- get_axis_data,
29
- get_correlated_data,
30
- )
@@ -1,98 +0,0 @@
1
- '''
2
- Concat ProcessingSet xarray DataSets into single xds by time dimension (in order)
3
- '''
4
-
5
- import xarray as xr
6
-
7
- from cubevis.data.measurement_set.processing_set._ps_coords import set_coordinates
8
-
9
- def concat_ps_xdt(ps_xdt, logger):
10
- ''' Concatenate xarray Datasets in ProcessingSet by time dimension.
11
- Return concat xds. '''
12
- if len(ps_xdt) == 0:
13
- raise RuntimeError("Processing set empty after selection.")
14
-
15
- ps = {}
16
- for name, ms_xdt in ps_xdt.items():
17
- # Set units to str not list and set baseline coordinate. Returns xarray.Dataset
18
- ps[name] = set_coordinates(ms_xdt)
19
-
20
- if len(ps) == 1:
21
- logger.debug("Processing set contains one dataset, nothing to concat.")
22
- return list(ps.values())[0]
23
-
24
- # Split xds by time gaps
25
- sorted_times = _get_sorted_times(ps)
26
- xds_list = []
27
- time_list = []
28
- for xds in ps.values():
29
- xdss, times = _split_xds_by_time_gap(xds, sorted_times)
30
- xds_list.extend(xdss)
31
- time_list.extend(times)
32
-
33
- if len(xds_list) > len(ps_xdt):
34
- logger.debug(f"Split {len(ps_xdt)} datasets by time gap into {len(xds_list)} datasets.")
35
-
36
- # Create sorted xds list using sorted times
37
- time_list.sort()
38
- sorted_xds = [None] * len(time_list)
39
-
40
- for xds in xds_list:
41
- try:
42
- first_xds_time = xds.time.values[0]
43
- except IndexError: # only one value
44
- first_xds_time = xds.time.values
45
-
46
- for idx, value in enumerate(time_list):
47
- if value == first_xds_time and sorted_xds[idx] is None:
48
- if "baseline" in xds.coords:
49
- # Cannot concat with non-dim string coord
50
- xds = xds.drop("baseline_antenna1_name")
51
- xds = xds.drop("baseline_antenna2_name")
52
- # Convert MeasurementSetXds to xr Dataset for concat
53
- # (TypeError: MeasurementSetXds.__init__() got an unexpected keyword argument 'coords')
54
- sorted_xds[idx] = xr.Dataset(xds.data_vars, xds.coords, xds.attrs)
55
- break
56
- return xr.concat(sorted_xds, dim='time')
57
-
58
- def _get_sorted_times(ps):
59
- values = []
60
- for key in ps:
61
- time_values = ps[key].time.values
62
- if time_values.size > 1:
63
- values.extend(time_values.tolist())
64
- else:
65
- values.append(time_values)
66
- return sorted(values)
67
-
68
- def _split_xds_by_time_gap(xds, sorted_times):
69
- ''' Split xds where there is a gap in sorted times.
70
- Return list of xds and first time in each one. '''
71
- times = xds.time.values.ravel()
72
- xds_list = []
73
- first_times = [times[0]]
74
-
75
- if len(times) == 1:
76
- xds_list.append(xds)
77
- else:
78
- sorted_time_idx = sorted_times.index(times[0])
79
- idx = xds_start_idx = 0 # start for iselection
80
-
81
- for idx, time in enumerate(times):
82
- if time == sorted_times[sorted_time_idx]:
83
- # No time gap, go to next time
84
- sorted_time_idx += 1
85
- continue
86
-
87
- # Found time gap, select xds
88
- xds_list.append(xds.isel(time=slice(xds_start_idx, idx)))
89
-
90
- # start next xds with new first time, find idx in sorted times (skip ahead)
91
- xds_start_idx = idx
92
- first_times.append(times[idx])
93
- sorted_time_idx = sorted_times.index(time) + 1 # for next time
94
-
95
- # add last time range xds
96
- xds_list.append(xds.isel(time=slice(xds_start_idx, idx + 1)))
97
-
98
- return xds_list, first_times
@@ -1,78 +0,0 @@
1
- '''
2
- Modify/add xarray Dataset coordinates for plotting.
3
- '''
4
-
5
- import numpy as np
6
- from pandas import to_datetime
7
-
8
- def set_coordinates(ms_xdt):
9
- ''' Convert coordinate units and add baseline coordinate for plotting.
10
- Returns xarray.Dataset
11
- '''
12
- _set_coordinate_unit(ms_xdt)
13
- _set_frequency_unit(ms_xdt)
14
- return _add_baseline_coordinate(ms_xdt)
15
-
16
- def set_datetime_coordinate(ms_xds):
17
- ''' Convert float time to datetime for plotting. '''
18
- time_attrs = ms_xds.time.attrs
19
- try:
20
- ms_xds.coords['time'] = to_datetime(ms_xds.time, unit=time_attrs['units'], origin=time_attrs['format'])
21
- except TypeError:
22
- ms_xds.coords['time'] = to_datetime(ms_xds.time, unit=time_attrs['units'][0], origin=time_attrs['format'])
23
- ms_xds.time.attrs = time_attrs
24
-
25
- def _set_coordinate_unit(ms_xdt):
26
- ''' Set coordinate units attribute as string not list for plotting. '''
27
- for coord in ms_xdt.coords:
28
- # Plots need unit to be string not list
29
- if 'units' in ms_xdt.coords[coord].attrs:
30
- units = ms_xdt.coords[coord].units
31
- if isinstance(units, list) and len(units) == 1:
32
- ms_xdt.coords[coord].attrs['units'] = units[0]
33
-
34
- def set_index_coordinates(ms_xds, coordinates):
35
- ''' Return ms_xds with new coordinate for string values (name) then replace coordinate with numerical index. '''
36
- for coordinate in coordinates:
37
- if coordinate == "polarization":
38
- ms_xds = ms_xds.assign_coords({"polarization_name": (ms_xds.polarization.dims, ms_xds.polarization.values)})
39
- ms_xds["polarization"] = np.array(range(ms_xds.polarization.size))
40
- elif coordinate == "baseline":
41
- ms_xds = ms_xds.assign_coords({"baseline_name": (ms_xds.baseline.dims, ms_xds.baseline.values)})
42
- ms_xds["baseline"] = np.array(range(ms_xds.baseline.size))
43
- elif coordinate == "antenna_name":
44
- ms_xds = ms_xds.assign_coords({"antenna": (ms_xds.antenna_name.dims, ms_xds.antenna_name.values)})
45
- ms_xds["antenna_name"] = np.array(range(ms_xds.antenna_name.size))
46
- return ms_xds
47
-
48
- def _set_frequency_unit(ms_xdt):
49
- ''' Convert frequency to GHz. Note attrs (channel_width, reference_frequency) still have Hz units in dict '''
50
- if ms_xdt.frequency.attrs['units'] == "Hz":
51
- frequency_xda = ms_xdt.frequency / 1e9
52
- frequency_attrs = ms_xdt.frequency.attrs
53
- frequency_attrs['units'] = "GHz"
54
- frequency_xda = frequency_xda.assign_attrs(frequency_attrs)
55
- ms_xdt.coords['frequency'] = frequency_xda
56
-
57
- def _add_baseline_coordinate(ms_xdt):
58
- '''
59
- Replace "baseline_id" (int) with "baseline" (string) coordinate "ant1 & ant2".
60
- Baseline ids are not consistent across ms_xdts.
61
- '''
62
- # Cannot assign coords to DataTree.
63
- baseline_ms_xdt = ms_xdt.to_dataset() # mutable Dataset
64
-
65
- if 'baseline_id' not in baseline_ms_xdt.coords:
66
- return baseline_ms_xdt
67
-
68
- ant1_names = ms_xdt.baseline_antenna1_name.values
69
- ant2_names = ms_xdt.baseline_antenna2_name.values
70
- if ant1_names.size == 1:
71
- baseline_names = f"{ant1_names.item()} & {ant2_names.item()}"
72
- baseline_ms_xdt = baseline_ms_xdt.assign_coords({"baseline": np.array(baseline_names)})
73
- else:
74
- baseline_names = [f"{ant1_names[idx]} & {ant2_names[idx]}" for idx in range(len(ant1_names))]
75
- baseline_ms_xdt = baseline_ms_xdt.assign_coords({"baseline": ("baseline_id", np.array(baseline_names))})
76
- baseline_ms_xdt = baseline_ms_xdt.swap_dims({"baseline_id": "baseline"})
77
- baseline_ms_xdt = baseline_ms_xdt.drop("baseline_id")
78
- return baseline_ms_xdt