-
Notifications
You must be signed in to change notification settings - Fork 26
Downsample Bug #1162
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
Downsample Bug #1162
Conversation
garrettwrong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tracking this down. Couple cleanup items, but overall very good thanks!
29e04b1 to
6503a17
Compare
garrettwrong
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you regarding the method overload vs hiding option from user. Either should work well.
I think this can move forward as it is obviously an improvement that we want.
However, I have a nagging concern about both our 2d and 3d downsamples. They don't seem to agree very well (IMO) with an idealized real space downsample. Consider this function. (It's easily extended to more dimensions).
def ds2(x, bs=2):
x = x.reshape(L//bs, bs, L//bs, bs)
x = np.mean(x, (1,3)) # traditionally I think would be a sum here, but... regardless...
return x
I looked at it as a sanity reference when we were chatting about the shifting/centering yesterday, and then decided not to look anymore 😇 🙈 .
src/aspire/volume/volume.py
Outdated
|
|
||
| # take 3D Fourier transform of each volume in the stack | ||
| fx = fft.fftshift(fft.fftn(xp.asarray(v._data), axes=(1, 2, 3))) | ||
| fx = fft.centered_fftn(xp.asarray(v._data), axes=(1, 2, 3)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think you need to specify axes here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you need the axes after all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Thought I removed those. They are now removed :)
src/aspire/source/simulation.py
Outdated
| return self._projections_accessor | ||
|
|
||
| def _projections(self, indices): | ||
| def _projections(self, indices, legacy=False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are ways to avoid this extra argument; mentioned one in other remark.
If you keep the flag, Joakim can let you know if he prefers to continue using the other var name (zero_nyquist).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought about using zero_nyquist too, but went with legacy so it would be more apparent that it would need to be removed if we eventually do away with _LegacySimulation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured, might not need. No worries.
|
@janden, I made the changes that we discussed during our last dev meeting. Namely, that we default to zeroing out the Nyquist frequencies in These changes maintain our centering convention and also have the property that However, there are definitely artifacts introduced by removing the Nyquist frequencies in where We can see these artifacts in the Ultimately, I think we just need to decide what we want our defaults to be. |
janden
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Just one small question.
Regarding the artifacts, I think this is fine for now. Recall that the one-hot volumes and images are actually quite different from the type of images we expect to see (i.e., they are not smooth, but “discontinuous”).

This resolves the issues found in #1155. See issue for results of the changes in this PR.
The main changes in this PR are:
centered_fftnforVolume.downsample:Image.projectandImage.backproject. Set to not zero out by default.projectwith nyquist frequencies zero'd out.