diff --git a/pyramid/analytic.py b/pyramid/analytic.py index 28b8abd717ccb43d00cda0b4ffe71391662f4db2..8cfde7ea3385d1d8dd9ab24dd26f8dd4889c7f43 100644 --- a/pyramid/analytic.py +++ b/pyramid/analytic.py @@ -164,8 +164,7 @@ def phase_mag_sphere(dim, a, phi, center, radius, b_0=1): r = np.hypot(x - x0, y - y0) result = coeff * R ** 3 / (r + 1E-30) ** 2 * ( (y - y0) * np.cos(phi) - (x - x0) * np.sin(phi)) - # TODO: During testing: "RuntimeWarning: invalid value encountered in power": - result *= np.where(r > R, 1, (1 - (1 - (r / R) ** 2) ** (3. / 2.))) + result *= 1 - np.clip(1 - (r / R) ** 2, 0, 1) ** (3. / 2.) return result # Process input parameters: diff --git a/pyramid/kernel.py b/pyramid/kernel.py index 946b6896a28ba628f22ce17468e8b70407265633..062cb01392b2e210c199bb62430ed35ed1f0d383 100644 --- a/pyramid/kernel.py +++ b/pyramid/kernel.py @@ -111,6 +111,7 @@ class Kernel(object): uu += prw_vec[1] vv += prw_vec[0] self.u[...] -= coeff * self._get_elementary_phase(geometry, uu, vv, a) + # TODO: The minus sign belongs into the phasemapper (debatable)! self.v[...] -= coeff * -self._get_elementary_phase(geometry, vv, uu, a) # Calculate Fourier trafo of kernel components: self.u_fft = fft.rfftn(self.u, self.dim_pad) @@ -129,6 +130,7 @@ class Kernel(object): def _get_elementary_phase(self, geometry, n, m, a): self._log.debug('Calling _get_elementary_phase') + # TODO: Rename n m to p q ? if geometry == 'disc': in_or_out = ~ np.logical_and(n == 0, m == 0) return m / (n ** 2 + m ** 2 + 1E-30) * in_or_out