Skip to content

Commit

Permalink
explicit bin order
Browse files Browse the repository at this point in the history
  • Loading branch information
gvarnavi committed Dec 20, 2023
1 parent cbc5a9d commit d2c9590
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions py4DSTEM/process/phase/iterative_parallax.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,7 @@ def reconstruct(
max_alignment_bin: int = None,
min_alignment_bin: int = 1,
max_iter_at_min_bin: int = 2,
alignment_bin_values: list = None,
cross_correlation_upsample_factor: int = 8,
regularizer_matrix_size: Tuple[int, int] = (1, 1),
regularize_shifts: bool = True,
Expand All @@ -921,6 +922,8 @@ def reconstruct(
Minimum bin size for bright field alignment
max_iter_at_min_bin: int, optional
Number of iterations to run at the smallest bin size
alignment_bin_values: list, optional
If not None, explicitly sets the iteration bin values
cross_correlation_upsample_factor: int, optional
DFT upsample factor for subpixel alignment
regularizer_matrix_size: Tuple[int,int], optional
Expand Down Expand Up @@ -1012,14 +1015,17 @@ def reconstruct(
else:
max_alignment_bin = diameter_pixels

bin_min = np.ceil(np.log(min_alignment_bin) / np.log(2))
bin_max = np.ceil(np.log(max_alignment_bin) / np.log(2))
bin_vals = 2 ** np.arange(bin_min, bin_max)[::-1]
if alignment_bin_values is not None:
bin_vals = np.array(alignment_bin_values).clip(1, max_alignment_bin)
else:
bin_min = np.ceil(np.log(min_alignment_bin) / np.log(2))
bin_max = np.ceil(np.log(max_alignment_bin) / np.log(2))
bin_vals = 2 ** np.arange(bin_min, bin_max)[::-1]

if max_iter_at_min_bin > 1:
bin_vals = np.hstack(
(bin_vals, np.repeat(bin_vals[-1], max_iter_at_min_bin - 1))
)
if max_iter_at_min_bin > 1:
bin_vals = np.hstack(
(bin_vals, np.repeat(bin_vals[-1], max_iter_at_min_bin - 1))
)

if plot_aligned_bf:
num_plots = bin_vals.shape[0]
Expand Down

0 comments on commit d2c9590

Please sign in to comment.