-
Notifications
You must be signed in to change notification settings - Fork 7
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
working on RunTimeWarning in tests #45
Conversation
and to bring it closer to pep8 compliance
@bobleesj @cadenmyers13 here is a PR which would be my first cut at addressing this warning. First I try and understand what the function is supposed to be doing. It is basically creating a big array for the reciprocal space and then setting the voxels outside the measured Q-range to nan. This is probably the desired behavior because they will always stay NaN. They may not stay zero if we set them to zero. |
I think the test is probably at fault then. It is a warning that is being thrown by numpy for some reason. We may want to try and catch that warning or handle it somehow in the test. |
we may be able to handle this by calling the test in a context manager, something like |
OK, so actually it is being thrown by another method in fourigui, For now I have to work on something else with the experiment, but maybe you guys can get the idea from what I did here and take it forward.... Let me know if you want me to merge these changes, which don't fix the problem but might be useful in your fix |
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.
see inline
sphere[mask] = np.nan | ||
i, j, k = np.meshgrid(np.arange(xdim), np.arange(ydim), np.arange(zdim)) | ||
r2 = (i - xdim // 2) ** 2 + (j - ydim // 2) ** 2 + (k - zdim // 2) ** 2 | ||
mask = (r2 <= r2_inner) | (r2 >= r2_outer) # True if voxel is out of range |
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 wonder if these should be <
and >
rather than <=
and >=
since it is tagging the unwanted regions as true. i.e., presumably Qmax is a valid value not an invalid value so we don't want to set Qmax to zero.
Since we are moving away from unittest and to pytest, maybe we want to just junk this test and replace it with a new test that tests the behavior that we want? |
ok, a bit more digging and it is |
Do you guys want to look into that? |
Will wait for @cadenmyers13 to first give his thought since it's his cookie |
@sbillinge Merging this will be fine, then I'll refer back to the comments. Thanks! |
first clean up applycutoff method to make its purpose clearer and to bring it closer to pep8 compliance.
then figure out how to work on the test warning