From 058271b850809494ac2d36e4b57a41c82aeac7c2 Mon Sep 17 00:00:00 2001 From: Stephanie Ribet Date: Wed, 28 Aug 2024 18:49:00 -0700 Subject: [PATCH] simplifying but still some mistake for negative tilts --- py4DSTEM/tomography/tomography.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/py4DSTEM/tomography/tomography.py b/py4DSTEM/tomography/tomography.py index 0372f7f96..bd574eb76 100644 --- a/py4DSTEM/tomography/tomography.py +++ b/py4DSTEM/tomography/tomography.py @@ -921,16 +921,21 @@ def _diffraction_space_slice( tilt = xp.deg2rad(tilt_deg) - length = s[-1] * xp.cos(tilt) - line_y_diff = xp.arange(-1 * (length-1) / 2, (length+1) / 2, length / s[-1]) - line_z_diff = line_y_diff * xp.tan(tilt) + # length = s[-1] * xp.cos(tilt) + # line_y_diff = xp.arange(-1 * (length-1) / 2, (length+1) / 2, length / s[-1]) + # line_z_diff = line_y_diff * xp.tan(tilt) - line_y_diff[line_y_diff < 0] = s[-1] + line_y_diff[line_y_diff < 0] - line_z_diff[line_z_diff < 0] = s[-1] + line_z_diff[line_z_diff < 0] + # line_y_diff[line_y_diff < 0] = s[-1] + line_y_diff[line_y_diff < 0] + # line_z_diff[line_z_diff < 0] = s[-1] + line_z_diff[line_z_diff < 0] + + # order = xp.argsort(line_y_diff) + # line_y_diff = line_y_diff[order] + # line_z_diff = line_z_diff[order] + + + line_y_diff = np.fft.fftfreq(s[-1], 1/s[-1]) * xp.cos(tilt) + line_z_diff = np.fft.fftfreq(s[-1], 1/s[-1]) * xp.sin(tilt) - order = xp.argsort(line_y_diff) - line_y_diff = line_y_diff[order] - line_z_diff = line_z_diff[order] yF_diff = xp.floor(line_y_diff).astype("int") zF_diff = xp.floor(line_z_diff).astype("int")