Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddid fixes #79

Merged
merged 3 commits into from
Feb 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions tricolour/apps/tricolour/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def support_tables(ms):
support = {t: xds_from_table("::".join((ms, t)), group_cols="__row__")
for t in ["FIELD", "POLARIZATION", "SPECTRAL_WINDOW"]}
# These columns have fixed shapes
support.update({t: xds_from_table("::".join((ms, t)))
support.update({t: xds_from_table("::".join((ms, t)))[0]
for t in ["ANTENNA", "DATA_DESCRIPTION"]})

# Reify all values upfront
Expand Down Expand Up @@ -305,11 +305,8 @@ def _main(args):
spw_ds = st["SPECTRAL_WINDOW"]
ant_ds = st["ANTENNA"]

assert len(ant_ds) == 1
assert len(ddid_ds) == 1

antspos = ant_ds[0].POSITION.data
antsnames = ant_ds[0].NAME.data
antspos = ant_ds.POSITION.data
antsnames = ant_ds.NAME.data
fieldnames = [fds.NAME.data[0] for fds in field_ds]

avail_scans = [ds.SCAN_NUMBER for ds in xds]
Expand Down Expand Up @@ -367,9 +364,8 @@ def _main(args):
"compute graph for processing"
.format(field_dict[ds.FIELD_ID], ds.SCAN_NUMBER))

ddid = ddid_ds[ds.attrs['DATA_DESC_ID']]
spw_info = spw_ds[ddid.SPECTRAL_WINDOW_ID.data[0]]
pol_info = pol_ds[ddid.POLARIZATION_ID.data[0]]
spw_info = spw_ds[ddid_ds.SPECTRAL_WINDOW_ID.data[ds.DATA_DESC_ID]]
pol_info = pol_ds[ddid_ds.POLARIZATION_ID.data[ds.DATA_DESC_ID]]

nrow, nchan, ncorr = getattr(ds, data_column).data.shape

Expand Down
6 changes: 3 additions & 3 deletions tricolour/window_statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,21 @@ def window_stats(flag_window, ubls, chan_freqs,
field_name, None,
ddid, None,
nchanbins, None,
dtype=np.object)
meta=np.empty((0,), dtype=np.object))

# Create an empty stats object if the user hasn't supplied one
if prev_stats is None:
def _window_stat_creator():
return WindowStatistics(nchanbins)

prev_stats = da.blockwise(_window_stat_creator, (),
dtype=np.object)
meta=np.empty((), dtype=np.object))

# Combine per-baseline stats into a single stats object
return da.blockwise(_combine_baseline_window_stats, (),
stats, ("bl",),
prev_stats, (),
dtype=np.object)
meta=np.empty((), dtype=np.object))


def _combine_window_stats(*args):
Expand Down