Skip to content

Commit 717e19d

Browse files
authored
Merge pull request #561 from ComputationalCryoEM/polar_2d_560
`PolarBasis2D` bug.
2 parents ce200cc + ef91777 commit 717e19d

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

src/aspire/basis/polar_2d.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,16 @@ def __init__(self, size, nrad=None, ntheta=None, dtype=np.float32):
2121
2222
:param size: The shape of the vectors for which to define the grid.
2323
Currently only square images are supported.
24-
:param nrad: The number of points in the radial dimension.
25-
:param ntheta: The number of points in the angular dimension.
24+
:param nrad: The number of points in the radial dimension. Default is resoltuion // 2.
25+
:param ntheta: The number of points in the angular dimension. Default is 8 * nrad.
2626
"""
2727

2828
ndim = len(size)
2929
ensure(ndim == 2, "Only two-dimensional grids are supported.")
3030
ensure(len(set(size)) == 1, "Only square domains are supported.")
3131

3232
self.nrad = nrad
33-
if nrad is None:
34-
self.nrad = self.nres // 2
35-
3633
self.ntheta = ntheta
37-
if ntheta is None:
38-
# try to use the same number as Fast FB basis
39-
self.ntheta = 8 * self.nrad
4034

4135
super().__init__(size, dtype=dtype)
4236

@@ -46,6 +40,13 @@ def _build(self):
4640
"""
4741
logger.info("Represent 2D image in a polar Fourier grid")
4842

43+
if self.nrad is None:
44+
self.nrad = self.nres // 2
45+
46+
if self.ntheta is None:
47+
# try to use the same number as Fast FB basis
48+
self.ntheta = 8 * self.nrad
49+
4950
self.count = self.nrad * self.ntheta
5051
self._sz_prod = self.sz[0] * self.sz[1]
5152

0 commit comments

Comments
 (0)