Skip to content

Commit

Permalink
real bugs from real data
Browse files Browse the repository at this point in the history
  • Loading branch information
smribet committed Sep 11, 2024
1 parent 899c3de commit c9a6371
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions py4DSTEM/tomography/tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def preprocess(
self._object_shape_x_y_z[1] * self._object_shape_x_y_z[2],
diffraction_shape * diffraction_shape * diffraction_shape,
),
dtype="float32",
)
self._object_shape_6D = self._object_shape_x_y_z + (
diffraction_shape,
Expand Down Expand Up @@ -737,8 +738,8 @@ def _reshape_4D_array_to_2D(self, data, qx0_fit=None, qy0_fit=None):
index = np.ravel_multi_index((a0, a1), (s[0], s[1]))

if qx0_fit is not None:
qx0 = qx0_fit[a0, a1] - center[0]
qy0 = qy0_fit[a0, a1] - center[1]
qx0 = center[0] - qx0_fit[a0, a1]
qy0 = center[1] - qy0_fit[a0, a1]

xF = int(np.floor(qx0))
yF = int(np.floor(qy0))
Expand Down Expand Up @@ -837,8 +838,13 @@ def _reshape_2D_array_to_4D(self, data, xy_shape=None):
i[a] = xp.arange(a.size)

data_reshaped = xp.zeros((s[0] * s[1], s[2] * s[3]))
data_reshaped[:, self._circular_mask_ravel] = xp.repeat(data, 2, axis=1)[:, 1:]
data_reshaped[1:] /= 2
if s[3] % 2 > 0:
data_reshaped[:, self._circular_mask_ravel] = xp.repeat(data, 2, axis=1)[
:, 1:
]
data_reshaped[1:] /= 2
else:
data_reshaped[:, self._circular_mask_ravel] = xp.repeat(data, 2, axis=1) / 2
data_reshaped[:, self._circular_mask_ravel] = data_reshaped[
:, self._circular_mask_ravel
][:, i]
Expand Down

0 comments on commit c9a6371

Please sign in to comment.