Skip to content

Commit

Permalink
clean up stokes funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
landmanbester committed Nov 30, 2023
1 parent a30d0dc commit 9467ca7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pfb/utils/stokes.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,18 @@ def single_stokes(ds=None,
jones = jones.astype(complex_type)
# qcal has chan and ant axes reversed compared to pfb implementation
jones = da.swapaxes(jones, 1, 2)
# data are not necessarily 2x2 so we need separate labels
# data are not 2x2 so we need separate labels
# for jones correlations and data/weight correlations
if jones.ndim == 5:
# reshape to dispatch with generated_jit
jones_ncorr = jones.shape[-1]
if jones_ncorr == 2:
jout = 'rafdx'
elif jones.ndim == 6:
elif jones_ncorr == 4:
jout = 'rafdxx'
jones = jones.reshape(ntime, nant, nchan, 1, 2, 2)
else:
raise ValueError("Incorrect number of correlations of "
f"{jones_ncorr} for product {opts.product}")
else:
jones = da.ones((ntime, nant, nchan, 1, 2),
chunks=(-1,)*5,
Expand All @@ -118,8 +123,6 @@ def single_stokes(ds=None,
blocker.add_input('ant2', ant2, 'r')
blocker.add_input('pol', poltype)
blocker.add_input('product', opts.product)

nrow, nchan, _ = data.shape
blocker.add_output('vis', 'rf', ((nrow,),(nchan,)), data.dtype)
blocker.add_output('wgt', 'rf', ((nrow,),(nchan,)), weight.dtype)

Expand Down

0 comments on commit 9467ca7

Please sign in to comment.