Conversation
| cropped_fft_shifted_back = torch.fft.ifftshift(cropped_fft, dim=(-3, -2)) | ||
|
|
||
| return cropped_fft_shifted_back | ||
| if isinstance(upsampled_pixel_size, int | float | numbers.Real): |
There was a problem hiding this comment.
What is the logic behind including the number.Real class here? Was there an unhandled edge case before?
There was a problem hiding this comment.
Good catch
It was a copy from torch-fourier-rescale (https://github.com/teamtomo/torch-fourier-rescale/blob/main/src/torch_fourier_rescale/fourier_rescale_3d.py)
It's definitely redundant , just numbers.Real and no int | float will catch everything
There was a problem hiding this comment.
yeah can't remember what that was catching but it caught something
the fftshift sets the phase origin of the DFT to the center of the map, it is redundant for fourier rescale but necessary for fourier-slice - when I originally wrote fourier-rescale it had an output_dft kwarg and I wanted those transforms to work with fourier-slice
| # place image center at array indices [0, 0, 0] and compute centered rfft3 | ||
| upsampled_volume = torch.fft.fftshift(upsampled_volume, dim=(-3, -2, -1)) |
There was a problem hiding this comment.
Is this a requirement for the Fourier rescaling operations? Centering is not happening in Fourier space so [0, 0, 0] corresponds to the DC component.
There was a problem hiding this comment.
This is again a copy from torch-fourier-rescale. I don't get it either.
@alisterburt, why do you do the fftshift/ifftshift in real space as well as Fourier space here? https://github.com/teamtomo/torch-fourier-rescale/blob/main/src/torch_fourier_rescale/fourier_rescale_3d.py
Is the real space shift not pointless?
There was a problem hiding this comment.
the fftshift sets the phase origin of the DFT to the center of the map, it is redundant for fourier rescale but necessary for fourier-slice - when I originally wrote fourier-rescale it had an output_dft kwarg and I wanted those transforms to work with fourier-slice
There was a problem hiding this comment.
Ah okay makes sense.
Update to use torch-structure-manipulation to load pdb/cif model with the bonding environment.
Update to include bonded scattering factors.
Draft PR since will not merge until torch-structure-manipulation is on pypi