Skip to content

Commit

Permalink
simplifying but still some mistake for negative tilts
Browse files Browse the repository at this point in the history
  • Loading branch information
smribet committed Aug 29, 2024
1 parent d56b23a commit 058271b
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions py4DSTEM/tomography/tomography.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 058271b

Please sign in to comment.