Commit 9a270581 authored by Philipp Arras's avatar Philipp Arras
Browse files

Tweak docstrings

parent 313a8c45
Pipeline #94330 failed with stages
in 6 minutes and 17 seconds
...@@ -11,33 +11,35 @@ ...@@ -11,33 +11,35 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# Copyright(C) 2019 Max-Planck-Society # Copyright(C) 2019-2021 Max-Planck-Society
# #
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik. # NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import numpy as np import numpy as np
from scipy.constants import speed_of_light from scipy.constants import speed_of_light
from ducc0.wgridder import ms2dirty, dirty2ms
from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple
from ..domains.rg_space import RGSpace from ..domains.rg_space import RGSpace
from ..domains.unstructured_domain import UnstructuredDomain from ..domains.unstructured_domain import UnstructuredDomain
from ..operators.linear_operator import LinearOperator from ..operators.linear_operator import LinearOperator
from ..sugar import makeDomain, makeField from ..sugar import makeDomain, makeField
from ..fft import nthreads
class Gridder(LinearOperator): class Gridder(LinearOperator):
""" """Compute non-uniform 2D FFT with ducc.
Operator computing non-uniform 2D FFTs using ducc0 package.
Parameters Parameters
---------- ----------
target : Domain, tuple of domains or DomainTuple. This must be a 2D RGSpace. target : Domain, tuple of domains or DomainTuple.
uv : coordinates of the data-points. This is supposed to be a 2D numpy.array Target domain, must be a single two-dimensional RGSpace.
eps : requested precision uv : np.ndarray
nthreads: @Parras, please fill this Coordinates of the data-points, shape (n, 2).
eps : float
Requested precision, defaults to 2e-10.
""" """
def __init__(self, target, uv, eps=2e-10, nthreads=1): def __init__(self, target, uv, eps=2e-10):
self._capability = self.TIMES | self.ADJOINT_TIMES self._capability = self.TIMES | self.ADJOINT_TIMES
self._target = makeDomain(target) self._target = makeDomain(target)
for ii in [0, 1]: for ii in [0, 1]:
...@@ -56,7 +58,6 @@ class Gridder(LinearOperator): ...@@ -56,7 +58,6 @@ class Gridder(LinearOperator):
self._uvw[:, 0:2] = uv self._uvw[:, 0:2] = uv
self._uvw[:, 2] = 0. self._uvw[:, 2] = 0.
self._eps = float(eps) self._eps = float(eps)
self._nthreads = int(nthreads)
def apply(self, x, mode): def apply(self, x, mode):
self._check_input(x, mode) self._check_input(x, mode)
...@@ -64,29 +65,28 @@ class Gridder(LinearOperator): ...@@ -64,29 +65,28 @@ class Gridder(LinearOperator):
x = x.val x = x.val
nxdirty, nydirty = self._target[0].shape nxdirty, nydirty = self._target[0].shape
dstx, dsty = self._target[0].distances dstx, dsty = self._target[0].distances
from ducc0.wgridder import ms2dirty, dirty2ms
if mode == self.TIMES: if mode == self.TIMES:
res = ms2dirty(self._uvw, freq, x.reshape((-1,1)), None, nxdirty, res = ms2dirty(self._uvw, freq, x.reshape((-1,1)), None, nxdirty,
nydirty, dstx, dsty, 0, 0, nydirty, dstx, dsty, 0, 0,
self._eps, False, self._nthreads, 0) self._eps, False, nthreads(), 0)
else: else:
res = dirty2ms(self._uvw, freq, x, None, dstx, dsty, 0, 0, res = dirty2ms(self._uvw, freq, x, None, dstx, dsty, 0, 0,
self._eps, False, self._nthreads, 0) self._eps, False, nthreads(), 0)
res = res.reshape((-1,)) res = res.reshape((-1,))
return makeField(self._tgt(mode), res) return makeField(self._tgt(mode), res)
class FinuFFT(LinearOperator): class FinuFFT(LinearOperator):
""" """Compute non-uniform 1D, 2D and 3D FFTs with finufft.
Operator computing non-uniform 1D,2D and 3D FFTs using finufft package.
Parameters Parameters
---------- ----------
target : Domain, tuple of domains or DomainTuple. target : Domain, tuple of domains or DomainTuple.
This must be an RGSpace with 1 to 3 dimensions. Target domain, must be an RGSpace with one to three dimensions.
pos : coordinates of the data-points pos : np.ndarray
eps: requested precision Coordinates of the data-points, shape (n, ndim).
eps: float
Requested precision, defaults to 2e-10.
""" """
def __init__(self, target, pos, eps=2e-10): def __init__(self, target, pos, eps=2e-10):
import finufft import finufft
......
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