Skip to content

Commit

Permalink
fft normalization
Browse files Browse the repository at this point in the history
  • Loading branch information
gvarnavi committed Dec 11, 2023
1 parent 167b677 commit bf99ab9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion py4DSTEM/process/phase/iterative_parallax.py
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,9 @@ def subpixel_alignment(
ky = xp.fft.fftfreq(ny, d=1)
k = xp.fft.fftshift(xp.sqrt(kx[:, None] ** 2 + ky[None, :] ** 2))

recon_fft = xp.fft.fftshift(xp.abs(xp.fft.fft2(self._recon_BF)))
recon_fft = xp.fft.fftshift(
xp.abs(xp.fft.fft2(self._recon_BF)) / np.prod(self._recon_BF.shape)
)
sx, sy = recon_fft.shape

pad_x_post = (nx - sx) // 2
Expand All @@ -1761,13 +1763,15 @@ def subpixel_alignment(
upsampled_fft_reference = asnumpy(
xp.fft.fftshift(
xp.abs(xp.fft.fft2(recon_BF_subpixel_aligned_reference))
/ (nx * ny)
)
* k
)

upsampled_fft = asnumpy(
xp.fft.fftshift(
xp.abs(xp.fft.fft2(self._recon_BF_subpixel_aligned))
/ (nx * ny)
)
* k
)
Expand All @@ -1776,6 +1780,7 @@ def subpixel_alignment(
upsampled_fft_reference = asnumpy(
xp.fft.fftshift(
xp.abs(xp.fft.fft2(self._recon_BF_subpixel_aligned))
/ (nx * ny)
)
* k
)
Expand Down

0 comments on commit bf99ab9

Please sign in to comment.