Skip to content

Commit

Permalink
fixes broken channel slicing, and adds ugly AF workaround for #80
Browse files Browse the repository at this point in the history
  • Loading branch information
o-smirnov committed Dec 8, 2022
1 parent 4026ff4 commit ab37020
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions shade_ms/data_mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,10 @@ def get_value(self, group, corr, extras, flag, flag_row, chanslice):
flag = None
else:
# apply channel slicing, if there's a channel axis in the array (and the array is a DataArray)
if type(coldata) is xarray.DataArray and 'chan' in coldata.dims:
coldata = coldata[dict(chan=chanslice)]
if coldata.ndim == 2:
coldata = coldata[:, chanslice]
# if type(coldata) is xarray.DataArray and 'chan' in coldata.dims:
# coldata = coldata[dict(chan=chanslice)]
# determine flags -- start with original flags
if flag is not None:
if coldata.ndim == 2:
Expand Down
4 changes: 3 additions & 1 deletion shade_ms/data_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def get_plot_data(msinfo, group_cols, mytaql, chan_freqs,
freqs=freqs,
wavel=wavel,
rows=group.row,
baselines=baselines if baselines else np.array([baseline]))
baselines=baselines if baselines is not None else np.array([baseline]))

nchan = len(group.chan)
if flag is not None:
Expand Down Expand Up @@ -201,6 +201,8 @@ def get_plot_data(msinfo, group_cols, mytaql, chan_freqs,
shapes[axis.label] = ()
elif value.ndim == 1:
timefreq_axis = axis.mapper.axis or 0
if axis.mapper.axis == 1 and chanslice is not None:
value = value[chanslice]
assert value.shape[0] == shape[timefreq_axis], \
f"{axis.mapper.fullname}: size {value.shape[0]}, expected {shape[timefreq_axis]}"
shapes[axis.label] = ("row",) if timefreq_axis == 0 else ("chan",)
Expand Down

0 comments on commit ab37020

Please sign in to comment.