Skip to content

Commit

Permalink
rotation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
smribet committed Dec 5, 2024
1 parent 786e5ce commit cb79f0e
Showing 1 changed file with 29 additions and 11 deletions.
40 changes: 29 additions & 11 deletions py4DSTEM/tomography/tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,24 @@ def _prepare_datacube(
)
)

from pdb import set_trace

set_trace()

if self._force_q_to_r_rotation_deg is not None:
for a0 in range(datacube.shape[0]):
for a1 in range(datacube.shape[1]):
datacube.data[a0, a1] = np.clip(
rotate(
datacube.data[a0, a1],
-self._force_q_to_r_rotation_deg,
reshape=False,
order=0,
),
0,
np.inf,
)

# resize diffraction space
if diffraction_intensities_shape is not None:
Q = datacube.shape[-1]
Expand Down Expand Up @@ -785,17 +803,17 @@ def _make_diffraction_masks(self, q_max_inv_A):
ind_diffraction_rotate_transpose = (
ind_diffraction_rotate_transpose.swapaxes(-1, -2)
)
if self._force_q_to_r_rotation_deg is not None:
ind_diffraction_rotate_transpose = np.clip(
rotate(
ind_diffraction_rotate_transpose,
-self._force_q_to_r_rotation_deg, # negative makes this rotation consistant with phase contrast module rotation
reshape=False,
order=0,
),
0,
np.max(ind_diffraction),
)
# if self._force_q_to_r_rotation_deg is not None:
# ind_diffraction_rotate_transpose = np.clip(
# rotate(
# ind_diffraction_rotate_transpose,
# -self._force_q_to_r_rotation_deg, # negative makes this rotation consistant with phase contrast module rotation
# reshape=False,
# order=0,
# ),
# 0,
# np.max(ind_diffraction),
# )

self._ind_diffraction = ind_diffraction
self._ind_diffraction_ravel = ind_diffraction.ravel()
Expand Down

0 comments on commit cb79f0e

Please sign in to comment.