Skip to content

Commit

Permalink
use c2c and take fftshift when writing gridded residuals in restore
Browse files Browse the repository at this point in the history
  • Loading branch information
landmanbester committed Apr 17, 2024
1 parent 8e02d98 commit 4c10ec3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 0 additions & 2 deletions pfb/parser/init.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ inputs:
abbreviation: ms
info:
Path to measurement set
policies:
repeat: '[]'
scans:
dtype: List[int]
info:
Expand Down
8 changes: 5 additions & 3 deletions pfb/workers/restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _restore(**kw):
from pfb.utils.fits import (save_fits, add_beampars, set_wcs,
dds2fits, dds2fits_mfs)
from pfb.utils.misc import Gaussian2D, fitcleanbeam, convolve2gaussres, dds2cubes
from ducc0.fft import r2c
from ducc0.fft import c2c

basename = f'{opts.output_filename}_{opts.product.upper()}'
dds_name = f'{basename}_{opts.postfix}.dds'
Expand Down Expand Up @@ -156,8 +156,9 @@ def _restore(**kw):
overwrite=opts.overwrite)

if 'f' in opts.outputs:
rhat_mfs = r2c(residual_mfs, forward=True,
rhat_mfs = c2c(residual_mfs, forward=True,
nthreads=opts.nvthreads, inorm=0)
rhat_mfs = np.fft.fftshift(rhat_mfs)
save_fits(np.abs(rhat_mfs),
f'{basename}_{opts.postfix}.abs_fft_residual_mfs.fits',
hdr_mfs,
Expand All @@ -168,8 +169,9 @@ def _restore(**kw):
overwrite=opts.overwrite)

if 'F' in opts.outputs:
rhat = r2c(residual, axes=(1,2), forward=True,
rhat = c2c(residual, axes=(1,2), forward=True,
nthreads=opts.nvthreads, inorm=0)
rhat = np.fft.fftshift(rhat, axes=(1,2))
save_fits(np.abs(rhat),
f'{basename}_{opts.postfix}.abs_fft_residual.fits',
hdr,
Expand Down

0 comments on commit 4c10ec3

Please sign in to comment.