From c182fb20d074406a7aa03261b3952151a2a103f4 Mon Sep 17 00:00:00 2001 From: smribet Date: Mon, 9 Dec 2024 09:50:00 -0800 Subject: [PATCH] diffraction bug --- py4DSTEM/tomography/tomography.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/py4DSTEM/tomography/tomography.py b/py4DSTEM/tomography/tomography.py index a0e428327..14f046d6a 100644 --- a/py4DSTEM/tomography/tomography.py +++ b/py4DSTEM/tomography/tomography.py @@ -1182,9 +1182,6 @@ def _forward( line_z_diff = line_y_diff * xp.tan(tilt) + (s[-1] - 1) / 2 line_y_diff += (s[-1] - 1) / 2 - # line_y_diff = np.fft.fftfreq(s[-1], 1 / s[-1]) * xp.cos(tilt) + (s[-1]-1)/2 - # line_z_diff = np.fft.fftfreq(s[-1], 1 / s[-1]) * xp.sin(tilt) + (s[-1]-1)/2 - yF_diff = xp.floor(line_y_diff).astype("int") zF_diff = xp.floor(line_z_diff).astype("int") dy_diff = line_y_diff - yF_diff @@ -1214,23 +1211,27 @@ def _forward( weights_diff = np.hstack( ( - xp.repeat(((1 - dy_diff) * (1 - dz_diff)), s[-1]), - xp.repeat(((dy_diff) * (1 - dz_diff)), s[-1]), - xp.repeat(((1 - dy_diff) * (dz_diff)), s[-1]), - xp.repeat(((dy_diff) * (dz_diff)), s[-1]), + xp.tile(((1 - dy_diff) * (1 - dz_diff)), s[-1]), + xp.tile(((dy_diff) * (1 - dz_diff)), s[-1]), + xp.tile(((1 - dy_diff) * (dz_diff)), s[-1]), + xp.tile(((dy_diff) * (dz_diff)), s[-1]), ) ) + print('hello') + ind_diff = xp.ravel_multi_index( ( + ind1_diff.ravel(), xp.tile(qxx.ravel(), 4), ind0_diff.ravel(), - ind1_diff.ravel(), ), (s[-1], s[-1], s[-1]), "clip", ) + self._qxx = xp.tile(qxx.ravel(), 4) + bincount_x = ( xp.tile( (xp.tile(self._ind_diffraction_ravel, 4)), @@ -1576,7 +1577,7 @@ def set_device(self, device, clear_fft_cache): Returns -------- - self: PhaseReconstruction + self: TomoReconstruction Self to enable chaining """