Commit d05c02bb authored by Martin Reinecke's avatar Martin Reinecke
Browse files

adjust

parent a9b8d316
...@@ -35,7 +35,9 @@ class GridderMaker(object): ...@@ -35,7 +35,9 @@ class GridderMaker(object):
raise ValueError("need dirty_domain with exactly one 2D RGSpace") raise ValueError("need dirty_domain with exactly one 2D RGSpace")
if channel_fact.ndim != 1: if channel_fact.ndim != 1:
raise ValueError("channel_fact must be a 1D array") raise ValueError("channel_fact must be a 1D array")
bl = nifty_gridder.Baselines(uvw, channel_fact); bl = nifty_gridder.Baselines(
uvw, channel_fact,
np.zeros((uvw.shape[0], channel_fact.shape[0]), dtype=np.bool))
nxdirty, nydirty = dirty_domain.shape nxdirty, nydirty = dirty_domain.shape
gconf = nifty_gridder.GridderConfig(nxdirty, nydirty, eps, 1., 1.) gconf = nifty_gridder.GridderConfig(nxdirty, nydirty, eps, 1., 1.)
nu = gconf.Nu() nu = gconf.Nu()
...@@ -59,14 +61,12 @@ class GridderMaker(object): ...@@ -59,14 +61,12 @@ class GridderMaker(object):
class _RestOperator(LinearOperator): class _RestOperator(LinearOperator):
def __init__(self, dirty_domain, grid_domain, gconf): def __init__(self, dirty_domain, grid_domain, gconf):
import nifty_gridder
self._domain = makeDomain(grid_domain) self._domain = makeDomain(grid_domain)
self._target = makeDomain(dirty_domain) self._target = makeDomain(dirty_domain)
self._gconf = gconf self._gconf = gconf
self._capability = self.TIMES | self.ADJOINT_TIMES self._capability = self.TIMES | self.ADJOINT_TIMES
def apply(self, x, mode): def apply(self, x, mode):
import nifty_gridder
self._check_input(x, mode) self._check_input(x, mode)
res = x.to_global_data() res = x.to_global_data()
if mode == self.TIMES: if mode == self.TIMES:
...@@ -90,7 +90,7 @@ class RadioGridder(LinearOperator): ...@@ -90,7 +90,7 @@ class RadioGridder(LinearOperator):
import nifty_gridder import nifty_gridder
self._check_input(x, mode) self._check_input(x, mode)
if mode == self.TIMES: if mode == self.TIMES:
x = x.to_global_data().reshape((-1,1)) x = x.to_global_data().reshape((-1, 1))
x = self._bl.ms2vis(x, self._idx) x = self._bl.ms2vis(x, self._idx)
res = nifty_gridder.vis2grid( res = nifty_gridder.vis2grid(
self._bl, self._gconf, self._idx, x) self._bl, self._gconf, self._idx, x)
......
...@@ -39,7 +39,8 @@ def test_gridding(nu, nv, N, eps): ...@@ -39,7 +39,8 @@ def test_gridding(nu, nv, N, eps):
vis = (np.random.randn(N) + 1j*np.random.randn(N)) vis = (np.random.randn(N) + 1j*np.random.randn(N))
# Nifty # Nifty
GM = ift.GridderMaker(ift.RGSpace((nu, nv)), uvw=uvw, channel_fact=np.array([1.]), eps=eps) GM = ift.GridderMaker(ift.RGSpace((nu, nv)), uvw=uvw,
channel_fact=np.array([1.]), eps=eps)
vis2 = ift.from_global_data(ift.UnstructuredDomain(vis.shape), vis) vis2 = ift.from_global_data(ift.UnstructuredDomain(vis.shape), vis)
Op = GM.getFull() Op = GM.getFull()
......
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