Commit 9fb21e4b authored by Martin Reinecke's avatar Martin Reinecke

use new helper functions

parent b31bc4eb
Pipeline #46795 passed with stages
in 16 minutes and 21 seconds
...@@ -114,16 +114,15 @@ class RadioGridder(LinearOperator): ...@@ -114,16 +114,15 @@ class RadioGridder(LinearOperator):
self._uv = uv # FIXME: should we write-protect this? self._uv = uv # FIXME: should we write-protect this?
def apply(self, x, mode): def apply(self, x, mode):
from nifty_gridder import to_grid, from_grid from nifty_gridder import (to_grid, to_grid_post,
from_grid, from_grid_pre)
self._check_input(x, mode) self._check_input(x, mode)
nu2, nv2 = self._target.shape nu2, nv2 = self._target.shape
x = x.to_global_data() x = x.to_global_data()
if mode == self.TIMES: if mode == self.TIMES:
res = to_grid(self._uv, x, nu2, nv2, self._nspread, self._r2lamb) res = to_grid(self._uv, x, nu2, nv2, self._nspread, self._r2lamb)
res += np.conj(np.roll(res[::-1, ::-1], (1, 1), axis=(0, 1))) res = to_grid_post(res)
res = 0.5*(res.real+res.imag)
else: else:
mirr = np.roll(x[::-1, ::-1], (1, 1), axis=(0, 1)) x = from_grid_pre(x)
x = 0.5*(x+mirr + 1j*(x-mirr))
res = from_grid(self._uv, x, nu2, nv2, self._nspread, self._r2lamb) res = from_grid(self._uv, x, nu2, nv2, self._nspread, self._r2lamb)
return from_global_data(self._tgt(mode), res) return from_global_data(self._tgt(mode), res)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment