From e1c9f98a376ae07c0b707e1dabb91f91a2dc55f6 Mon Sep 17 00:00:00 2001 From: Vincent Eberle <VE@Vincents-MBP-2.fritz.box> Date: Thu, 25 Feb 2021 15:34:12 +0100 Subject: [PATCH] docstrings and cosmetics --- src/library/nft.py | 24 ++++++++++++++++++++---- src/library/special_distributions.py | 1 - src/operators/simple_linear_operators.py | 2 +- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/library/nft.py b/src/library/nft.py index b84b88cc6..b918c8ba8 100644 --- a/src/library/nft.py +++ b/src/library/nft.py @@ -26,6 +26,17 @@ from ..sugar import makeDomain, makeField class Gridder(LinearOperator): + """ + Operator computing non-uniform 2D FFTs using ducc0 package. + + Parameters + ---------- + target : Domain, tuple of domains or DomainTuple. This must be a 2D RGSpace. + uv : coordinates of the data-points. This is supposed to be a 2D numpy.array + eps : requested precision + nthreads: @Parras, please fill this + + """ def __init__(self, target, uv, eps=2e-10, nthreads=1): self._capability = self.TIMES | self.ADJOINT_TIMES self._target = makeDomain(target) @@ -67,19 +78,24 @@ class Gridder(LinearOperator): class FinuFFT(LinearOperator): """ - Operator computing non-uniform FFTs using finufft package + Operator computing non-uniform 1D,2D and 3D FFTs using finufft package. Parameters ---------- - target: must be RGSpace? - pos: - eps: + target : Domain, tuple of domains or DomainTuple. + This must be an RGSpace with 1 to 3 dimensions. + pos : coordinates of the data-points + eps: requested precision """ def __init__(self, target, pos, eps=2e-10): import finufft self._capability = self.TIMES | self.ADJOINT_TIMES self._target = makeDomain(target) + if not isinstance(self._target[0], RGSpace): + raise TypeError("target needs to be an RGSpace") + if len(self._target.shape) > 3: + raise ValueError("Only 1D, 2D and 3D FFTs are supported by finufft") self._domain = DomainTuple.make(UnstructuredDomain((pos.shape[0]))) self._eps = float(eps) dst = np.array(self._target[0].distances) diff --git a/src/library/special_distributions.py b/src/library/special_distributions.py index 49b37ca61..ee3936489 100644 --- a/src/library/special_distributions.py +++ b/src/library/special_distributions.py @@ -136,7 +136,6 @@ class UniformOperator(Operator): The domain on which the field shall be defined. This is at the same time the domain and the target of the operator. loc: float - scale: float """ diff --git a/src/operators/simple_linear_operators.py b/src/operators/simple_linear_operators.py index 307d5d9a4..445b035d4 100644 --- a/src/operators/simple_linear_operators.py +++ b/src/operators/simple_linear_operators.py @@ -141,7 +141,7 @@ class FieldAdapter(LinearOperator): Parameters ---------- - tgt : Domain, tuple of Domain, DomainTuple, dict or MultiDomain: + tgt : Domain, tuple of domains, DomainTuple, dict or MultiDomain: If this is a Domain, tuple of Domain or DomainTuple, this will be the operator's target, and its domain will be a MultiDomain consisting of its domain with the supplied `name` -- GitLab