Skip to content

Commit

Permalink
tweak fits output names for clean
Browse files Browse the repository at this point in the history
  • Loading branch information
landmanbester committed Feb 29, 2024
1 parent a42641f commit f50e57c
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions pfb/workers/clean.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ def _clean(ddsi=None, **kw):
ne.evaluate('sum(residual, axis=0)', out=residual_mfs,
casting='same_kind')

save_fits(residual_mfs,
basename + f'_{opts.postfix}_residual_{k+1}.fits',
hdr_mfs)

# report rms where there aren;t any model components
rmsp = rms
tmp_mask = ~np.any(model, axis=0)
Expand All @@ -232,14 +236,6 @@ def _clean(ddsi=None, **kw):
else:
threshold = opts.threshold

save_fits(residual_mfs,
f'{basename}_{opts.postfix}_premop{k}_resid_mfs.fits',
hdr_mfs)

save_fits(np.mean(model[fsel], axis=0),
f'{basename}_{opts.postfix}_premop{k}_model_mfs.fits',
hdr_mfs)

# trigger flux mop if clean has stalled, not converged or
# we have reached the final iteration/threshold
status |= k == opts.nmiter-1
Expand Down Expand Up @@ -274,7 +270,7 @@ def _clean(ddsi=None, **kw):
casting='same_kind')

save_fits(residual_mfs,
f'{basename}_{opts.postfix}_postmop{k}_resid_mfs.fits',
f'{basename}_{opts.postfix}_postmop{k}_residual_mfs.fits',
hdr_mfs)

save_fits(np.mean(model[fsel], axis=0),
Expand All @@ -297,12 +293,6 @@ def _clean(ddsi=None, **kw):
else:
threshold = opts.threshold

if rms > rmsp:
diverge_count += 1
if diverge_count > 3:
print("Algorithm is diverging. Terminating.", file=log)
break

print(f"Iter {k+1}: peak residual = {rmax:.3e}, rms = {rms:.3e}",
file=log)

Expand Down

0 comments on commit f50e57c

Please sign in to comment.