-
Notifications
You must be signed in to change notification settings - Fork 14
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
Support clipping Sigma to avoid negative values in French-Wilson method #237
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #237 +/- ##
==========================================
- Coverage 92.39% 92.36% -0.04%
==========================================
Files 37 37
Lines 2434 2436 +2
==========================================
+ Hits 2249 2250 +1
- Misses 185 186 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Wouldn't it make more sense to clip the returned values rather than the input intensities? This version of the code adds small errors to all miller indices rather than just the ones which would be assigned negative average intensities. |
are you proposing clipping Sigma or the FW'ed intensities? |
Sigma |
cool. makes sense. |
for more information, see https://pre-commit.ci
…eship into fw_fix this commit is caused by git pull, merging from remote. DH
OK, this seems to do the trick. Clipping sigma to a user-specified small positive value (too small results in numerical warnings). |
produces
ds_out=rs.algorithms.scale_merged_intensities(
print(np.sum(np.isnan(ds_out["FP"].to_numpy())))
|
I think it's better to just have a single new parameter, minimum_sigma=-np.inf |
for more information, see https://pre-commit.ci
Let me know how this looks. I switched to using a single flag |
I am happy with this change. There might be a better parameter name (mea culpa), but otherwise this is the least invasive patch I can think of. Let's ask @JBGreisman for comments before merging, but I'm plenty satisfied. |
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.
This looks fine to me -- I agree that it makes sense to have the default behavior as unchanged relative to before, and the proposed call to np.clip
seems fine for getting this functionality.
I added a flag permitting clipping of Iobs to positive values for the purpose of calculating Sigma during anisotropic FW calculation. The option is off by default.