Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: if all three volume dimensions are odd, result is NaN #27

Open
mathieuboudreau opened this issue Oct 25, 2024 · 0 comments
Open

Bug: if all three volume dimensions are odd, result is NaN #27

mathieuboudreau opened this issue Oct 25, 2024 · 0 comments

Comments

@mathieuboudreau
Copy link
Member

See: shimming-toolbox/b0-fieldmap-realistic-simulation#11 (comment)

This is because there will eventually be a division by zero here,

kernel = np.fft.fftshift(1/3 - kz**2/k2)

because k2 is simply,

and for odd-numbered dimensions, kx, ky, and kz will contain zero in the middle element of their arrays due to this symmetrical linspace:

[kx, ky, kz] = np.meshgrid(np.linspace(-kmax[0], kmax[0], new_dimensions[0]),
np.linspace(-kmax[1], kmax[1], new_dimensions[1]),
np.linspace(-kmax[2], kmax[2], new_dimensions[2]), indexing='ij')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant