Skip to content

Commit 427c111

Browse files
committed
make apodization strength user-settable
1 parent e66a088 commit 427c111

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

mcsim/analysis/tomography.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def __init__(self,
121121
fit_phase_profile: bool = False,
122122
phase_profile_l1: float = 1e3,
123123
apodization: Optional[np.ndarray] = None,
124+
alpha: float = 0.1,
124125
save_auxiliary_fields: bool = False,
125126
compressor: Codec = Zlib(),
126127
save_float32: bool = False,
@@ -165,7 +166,8 @@ def __init__(self,
165166
:param fit_phases: whether to fit phase differences between image and background holograms
166167
:param fit_translations: whether to fit the spatial translation between the data and reference images
167168
:param translation_thresh:
168-
:param apodization: if None use tukey apodization with alpha = 0.1. To use no apodization set equal to 1
169+
:param apodization: if None use tukey apodization. To use no apodization set equal to 1
170+
:param alpha: if apodization is None, use tukey apodization with this alpha
169171
:param save_auxiliary_fields:
170172
:param compressor: by default use Zlib(), which is a good combination of fast/reasonable compression ratio.
171173
For better compression, use bz2.BZ2(), although this is much slower.
@@ -344,9 +346,10 @@ def __init__(self,
344346
# other arrays
345347
# ########################
346348
self.realspace_mask = realspace_mask
349+
self.alpha = alpha
347350
if apodization is None:
348-
apodization = np.outer(tukey(self.ny, alpha=0.1),
349-
tukey(self.nx, alpha=0.1))
351+
apodization = np.outer(tukey(self.ny, alpha=self.alpha),
352+
tukey(self.nx, alpha=self.alpha))
350353
self.apodization = apodization
351354

352355
self.ctf = (np.sqrt(self.fxs[None, :] ** 2 + self.fys[:, None] ** 2) <= self.fmax).astype(complex)
@@ -1606,8 +1609,8 @@ def reconstruct_n(self,
16061609
atf = (xp.sqrt(fx_atf[None, :] ** 2 +
16071610
fy_atf[:, None] ** 2) <= self.fmax).astype(complex)
16081611

1609-
apodization_n = xp.outer(xp.asarray(tukey(self.n_shape[-2], alpha=0.1)),
1610-
xp.asarray(tukey(self.n_shape[-1], alpha=0.1)))
1612+
apodization_n = xp.outer(xp.asarray(tukey(self.n_shape[-2], alpha=self.alpha)),
1613+
xp.asarray(tukey(self.n_shape[-1], alpha=self.alpha)))
16111614

16121615
if self.model == "born" or self.model == "rytov":
16131616
optimizer = self.model

0 commit comments

Comments
 (0)