Skip to content

Commit 756e93e

Browse files
committed
Only use half of freqs in PolarBasis2D.evaluate
We can do this since images are real and their FT has Hermitian symmetry.
1 parent 07946b8 commit 756e93e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/aspire/basis/polar_2d.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,22 @@ def evaluate(self, v):
8181
v, sz_roll = unroll_dim(v, 2)
8282
nimgs = v.shape[1]
8383

84+
half_size = self.nrad * self.ntheta // 2
85+
86+
v = m_reshape(v, (self.nrad, self.ntheta, nimgs))
87+
88+
v = (v[:, :self.ntheta // 2, :]
89+
+ v[:, self.ntheta // 2:, :].conj())
90+
91+
v = m_reshape(v, (half_size, nimgs))
92+
8493
# finufftpy require it to be aligned in fortran order
8594
x = np.empty((self._sz_prod, nimgs), dtype='complex128', order='F')
86-
finufftpy.nufft2d1many(self.freqs[0], self.freqs[1], v, 1, 1e-15,
87-
self.sz[0], self.sz[1], x)
95+
finufftpy.nufft2d1many(self.freqs[0, :half_size],
96+
self.freqs[1, :half_size],
97+
v, 1, 1e-15, self.sz[0], self.sz[1], x)
8898
x = m_reshape(x, (self.sz[0], self.sz[1], nimgs))
99+
x = x.real
89100
# return coefficients whose first two dimensions equal to self.sz
90101
x = roll_dim(x, sz_roll)
91102

0 commit comments

Comments
 (0)