Skip to content

Commit

Permalink
small bugfix, moving reset before object_type change
Browse files Browse the repository at this point in the history
  • Loading branch information
gvarnavi committed Mar 15, 2024
1 parent b326bca commit facf1e1
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 24 deletions.
6 changes: 3 additions & 3 deletions py4DSTEM/process/phase/magnetic_ptychographic_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,9 @@ def reconstruct(
"Magnetic ptychographic tomography is currently only implemented for gradient descent."
)

# initialization
self._reset_reconstruction(store_iterations, reset, use_projection_scheme)

if self._verbose:
self._report_reconstruction_summary(
num_iter,
Expand All @@ -1056,9 +1059,6 @@ def reconstruct(
else:
detector_fourier_mask = xp.asarray(detector_fourier_mask)

# initialization
self._reset_reconstruction(store_iterations, reset, use_projection_scheme)

if gaussian_filter_sigma_m is None:
gaussian_filter_sigma_m = gaussian_filter_sigma_e

Expand Down
12 changes: 6 additions & 6 deletions py4DSTEM/process/phase/magnetic_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,9 +1321,6 @@ def reconstruct(
]
self.copy_attributes_to_device(attrs, device)

if object_type is not None:
self._switch_object_type(object_type)

xp = self._xp
xp_storage = self._xp_storage
device = self._device
Expand Down Expand Up @@ -1357,6 +1354,12 @@ def reconstruct(
"Magnetic ptychography is currently only implemented for gradient descent."
)

# initialization
self._reset_reconstruction(store_iterations, reset, use_projection_scheme)

if object_type is not None:
self._switch_object_type(object_type)

if self._verbose:
self._report_reconstruction_summary(
num_iter,
Expand All @@ -1381,9 +1384,6 @@ def reconstruct(
else:
detector_fourier_mask = xp.asarray(detector_fourier_mask)

# initialization
self._reset_reconstruction(store_iterations, reset, use_projection_scheme)

if gaussian_filter_sigma_m is None:
gaussian_filter_sigma_m = gaussian_filter_sigma_e

Expand Down
6 changes: 3 additions & 3 deletions py4DSTEM/process/phase/mixedstate_multislice_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,9 @@ def reconstruct(
]
self.copy_attributes_to_device(attrs, device)

# initialization
self._reset_reconstruction(store_iterations, reset)

if object_type is not None:
self._switch_object_type(object_type)

Expand Down Expand Up @@ -951,9 +954,6 @@ def reconstruct(
else:
detector_fourier_mask = xp.asarray(detector_fourier_mask)

# initialization
self._reset_reconstruction(store_iterations, reset)

# main loop
for a0 in tqdmnd(
num_iter,
Expand Down
6 changes: 3 additions & 3 deletions py4DSTEM/process/phase/mixedstate_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,6 +793,9 @@ def reconstruct(
]
self.copy_attributes_to_device(attrs, device)

# initialization
self._reset_reconstruction(store_iterations, reset)

if object_type is not None:
self._switch_object_type(object_type)

Expand Down Expand Up @@ -845,9 +848,6 @@ def reconstruct(
else:
detector_fourier_mask = xp.asarray(detector_fourier_mask)

# initialization
self._reset_reconstruction(store_iterations, reset)

# main loop
for a0 in tqdmnd(
num_iter,
Expand Down
6 changes: 3 additions & 3 deletions py4DSTEM/process/phase/multislice_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -875,6 +875,9 @@ def reconstruct(
]
self.copy_attributes_to_device(attrs, device)

# initialization
self._reset_reconstruction(store_iterations, reset)

if object_type is not None:
self._switch_object_type(object_type)

Expand Down Expand Up @@ -927,9 +930,6 @@ def reconstruct(
else:
detector_fourier_mask = xp.asarray(detector_fourier_mask)

# initialization
self._reset_reconstruction(store_iterations, reset)

# main loop
for a0 in tqdmnd(
num_iter,
Expand Down
6 changes: 3 additions & 3 deletions py4DSTEM/process/phase/ptychographic_tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,9 @@ def reconstruct(
step_size,
)

# initialization
self._reset_reconstruction(store_iterations, reset, use_projection_scheme)

if self._verbose:
self._report_reconstruction_summary(
num_iter,
Expand All @@ -963,9 +966,6 @@ def reconstruct(
else:
detector_fourier_mask = xp.asarray(detector_fourier_mask)

# initialization
self._reset_reconstruction(store_iterations, reset, use_projection_scheme)

# main loop
for a0 in tqdmnd(
num_iter,
Expand Down
6 changes: 3 additions & 3 deletions py4DSTEM/process/phase/singleslice_ptychography.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,9 @@ def reconstruct(
]
self.copy_attributes_to_device(attrs, device)

# initialization
self._reset_reconstruction(store_iterations, reset)

if object_type is not None:
self._switch_object_type(object_type)

Expand Down Expand Up @@ -815,9 +818,6 @@ def reconstruct(
else:
detector_fourier_mask = xp.asarray(detector_fourier_mask)

# initialization
self._reset_reconstruction(store_iterations, reset)

# main loop
for a0 in tqdmnd(
num_iter,
Expand Down

0 comments on commit facf1e1

Please sign in to comment.