Skip to content

Commit

Permalink
remove fmap in hci
Browse files Browse the repository at this point in the history
  • Loading branch information
landmanbester committed Aug 22, 2024
1 parent 083027e commit c4169cb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
7 changes: 3 additions & 4 deletions pfb/utils/stokes2im.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def single_stokes_image(
dc2=None,
operator=None,
ds=None,
mds=None,
jones=None,
opts=None,
nx=None,
Expand Down Expand Up @@ -57,8 +56,8 @@ def single_stokes_image(
complex_type = np.complex128

with worker_client() as client:
(ds, jones) = client.compute([clone(ds),
clone(jones)],
(ds, jones) = client.compute([ds,
jones],
sync=True,
workers=wid,
key='read-'+uuid4().hex)
Expand Down Expand Up @@ -116,7 +115,7 @@ def single_stokes_image(
dtype=real_type)

if opts.model_column is not None:
model_vis = getattr(ds.model_column).values
model_vis = getattr(ds, opts.model_column).values
ds = ds.drop(opts.model_column)

# this seems to help with memory consumption
Expand Down
15 changes: 6 additions & 9 deletions pfb/workers/hci.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ def _hci(**kw):
if opts.gain_table is not None:
tmpf = lambda x: '::'.join(x.rsplit('/', 1))
gain_names = list(map(tmpf, opts.gain_table))
gain_name = gain_names[0]
else:
gain_names = None

Expand All @@ -155,7 +156,6 @@ def _hci(**kw):

# only a single MS for now
ms = opts.ms[0]
gain_name = gain_names[0]
group_by = ['FIELD_ID', 'DATA_DESC_ID', 'SCAN_NUMBER']

# write model to tmp ds
Expand Down Expand Up @@ -324,11 +324,10 @@ def _hci(**kw):
datasets.append([subds,
jones,
freqs[ms][idt][Inu],
chan_widths[ms][idt][Inu],
utimes[ms][idt][It],
ridx, rcnts,
radecs[ms][idt],
fi, ti, ims, ms])
fi, ti, ms])

futures = []
associated_workers = {}
Expand All @@ -337,16 +336,15 @@ def _hci(**kw):

while idle_workers: # Seed each worker with a task.

(subds, jones, freqsi, utimesi, ridx, rcnts, fidx, fcnts,
(subds, jones, freqsi, utimesi, ridx, rcnts,
radeci, fi, ti, ms) = datasets[n_launched]

worker = idle_workers.pop()
future = client.submit(single_stokes_image,
dc1=dc1,
dc2=data2,
dc2=dc2,
operator=operator,
ds=subds,
mds=mds,
jones=jones,
opts=opts,
nx=nx,
Expand Down Expand Up @@ -377,7 +375,7 @@ def _hci(**kw):
if n_launched == nds: # Stop once all jobs have been launched.
continue

(subds, jones, freqsi, utimesi, ridx, rcnts, fidx, fcnts,
(subds, jones, freqsi, utimesi, ridx, rcnts,
radeci, fi, ti, ms) = datasets[n_launched]

worker = associated_workers.pop(completed_future)
Expand All @@ -392,7 +390,6 @@ def _hci(**kw):
dc2=dc2,
operator=operator,
ds=subds,
mds=mds,
jones=jones,
opts=opts,
nx=nx,
Expand All @@ -418,7 +415,7 @@ def _hci(**kw):

if opts.progressbar:
print(f"\rProcessing: {n_launched}/{nds}", end='', flush=True)

print("\n") # after progressbar above
wait(futures)

return

0 comments on commit c4169cb

Please sign in to comment.