Skip to content

Commit

Permalink
shuffle order during reconstruct
Browse files Browse the repository at this point in the history
  • Loading branch information
smribet committed Sep 1, 2024
1 parent acf3970 commit 032cc42
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions py4DSTEM/tomography/tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,23 +250,26 @@ def reconstruct(
disable=not progress_bar,
):
error_iteration = 0
random_tilt_order = np.random.shuffle(np.arange(self._num_datacubes))

for a1 in range(self._num_datacubes):
a1_shuffle = random_tilt_order[a1]
diffraction_patterns_projected = copy_to_device(
self._diffraction_patterns_projected[a1], device
self._diffraction_patterns_projected[a1_shuffle], device
)

for a2 in range(self._object_shape_6D[0]):
object_sliced = self._forward(
x_index=a2,
tilt_deg=self._tilt_deg[a1],
tilt_deg=self._tilt_deg[a1_shuffle],
num_points=num_points,
)

update, error = self._calculate_update(
object_sliced=object_sliced,
diffraction_patterns_projected=diffraction_patterns_projected,
x_index=a2,
datacube_number=a1,
datacube_number=a1_shuffle,
)

error_iteration += error
Expand Down

0 comments on commit 032cc42

Please sign in to comment.