Skip to content

Commit e719454

Browse files
committed
fix parameter names and ordering in hci and stokes2im
1 parent 625b05d commit e719454

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

src/pfb_imaging/core/hci.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,25 +90,27 @@ def hci(
9090
# start timer
9191
time_start = time.time()
9292

93-
if "://" in output_dataset:
94-
protocol = output_dataset.split("://")[0]
93+
if "://" in str(output_dataset):
94+
protocol = str(output_dataset).split("://")[0]
9595
prefix = f"{protocol}://"
9696
else:
9797
protocol = "file"
9898
prefix = ""
9999

100100
fs = fsspec.filesystem(protocol)
101-
basedir = fs.expand_path("/".join(output_dataset.split("/")[:-1]))[0]
101+
basedir = fs.expand_path("/".join(str(output_dataset).split("/")[:-1]))[0]
102102
if not fs.exists(basedir):
103103
fs.makedirs(basedir)
104104

105-
oname = output_dataset.split("/")[-1]
105+
oname = str(output_dataset).split("/")[-1]
106106

107107
output_dataset = f"{prefix}{basedir}/{oname}"
108108

109109
# this should be a file system
110110
if log_directory is None:
111111
log_directory = Path(basedir) / "pfb_logs"
112+
else:
113+
log_directory = Path(log_directory)
112114
log_directory.mkdir(parents=True, exist_ok=True)
113115
timestamp = time.strftime("%Y%m%d-%H%M%S")
114116
logname = f"{str(log_directory)}/hci_{timestamp}.log"
@@ -384,6 +386,7 @@ def tmpf(x):
384386
cell_deg,
385387
integrations_per_image=integrations_per_image,
386388
)
389+
387390
log.info("Scaffolding complete")
388391

389392
n_stokes = len(remprod)
@@ -477,8 +480,8 @@ def tmpf(x):
477480
ny=ny,
478481
freq=freqs[ms_name][idt][freq_slice],
479482
utime=utimes[ms_name][idt][time_slice],
480-
tbin_idx=row_index,
481-
tbin_counts=row_counts,
483+
rbin_idx=row_index,
484+
rbin_counts=row_counts,
482485
cell_rad=cell_rad,
483486
radec=radecs[ms_name][idt],
484487
antpos=antpos[ms_name],
@@ -488,7 +491,7 @@ def tmpf(x):
488491
timeid=ti,
489492
msid=ims,
490493
attrs=attrs,
491-
# Parameters previously from opts:
494+
integrations_per_image=integrations_per_image,
492495
nthreads=nthreads,
493496
precision=precision,
494497
sigma_column=sigma_column,
@@ -602,7 +605,6 @@ def make_dummy_dataset(
602605
nx,
603606
ny,
604607
cell_deg,
605-
time_chunk,
606608
spatial_chunk=128,
607609
integrations_per_image=1,
608610
):
@@ -638,7 +640,7 @@ def make_dummy_dataset(
638640
fitr = enumerate(zip(freq_mapping[ms_name][idt]["start_indices"], freq_mapping[ms_name][idt]["counts"]))
639641
for fi, (flow, fcounts) in fitr:
640642
freq_slice = slice(flow, flow + fcounts)
641-
out_freqs.append(np.mean(freqs[ms][idt][freq_slice]))
643+
out_freqs.append(np.mean(freqs[ms_name][idt][freq_slice]))
642644
ntasks += 1
643645

644646
for t0 in range(tlow, tlow + tcounts, integrations_per_image):
@@ -823,4 +825,4 @@ def make_dummy_dataset(
823825
# Write scaffold and metadata to disk.
824826
cds = f"{output_dataset}"
825827
dummy_ds.to_zarr(cds, mode="w", compute=False)
826-
return cds, attrs
828+
return attrs, ntasks, n_times, n_freqs

src/pfb_imaging/utils/stokes2im.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ def batch_stokes_image(
3535
nx=None,
3636
ny=None,
3737
freq=None,
38-
cell_rad=None,
3938
utime=None,
4039
rbin_idx=None,
4140
rbin_counts=None,
41+
cell_rad=None,
4242
radec=None,
4343
antpos=None,
4444
poltype=None,
@@ -48,8 +48,6 @@ def batch_stokes_image(
4848
msid=None,
4949
attrs=None,
5050
integrations_per_image=None,
51-
synchronizer=None,
52-
# Parameters previously from opts:
5351
nthreads=None,
5452
precision="double",
5553
sigma_column=None,
@@ -75,6 +73,7 @@ def batch_stokes_image(
7573
psf_out=False,
7674
weight_grid_out=False,
7775
l2_reweight_dof=None,
76+
synchronizer=None,
7877
):
7978
# load chunk
8079
ds.load(scheduler="sync")

0 commit comments

Comments
 (0)