-
Notifications
You must be signed in to change notification settings - Fork 22
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
Resomat clipping produces warnings #881
Comments
I'm not sure if this would help, currently we're not using these rough resolution estimates within the analysis anyway. Note that if we're ever actually impacted by these estimates becoming nan/inf (i.e. if we have the reso matrix diagonal match the first/second off-diagonal in a pixel after clipping resulting in division by zero ) we should be getting a nan/inf mean_reso in the outputs as well (we're using mean there and not nanmean), so if we don't get those (I didn't check for this on the whole dataset) I'd think we have the zero-divisions only for pixels that are removed later on. But agreed that if matrix values close to zero are causing this, your solution should work better than the simple clipping. |
There are also surprising amounts of negative elements in resolution matrix, so this is probably quite common. |
I did search the codebase for isnan, isfinite, nanmean etc, and none of those appears in combination with resolution. So I think we are currently fine. Nevertheless could be good to fix this... |
Branch |
While running picca_delta_extraction, the following warning pops up:
/global/u1/n/naimgk/picca/py/picca/delta_extraction/utils_pk1d.py:248: RuntimeWarning: divide by zero encountered in true_divide
np.sqrt(4.0 / 2.0 / np.log(
/global/u1/n/naimgk/picca/py/picca/delta_extraction/utils_pk1d.py:242: RuntimeWarning: invalid value encountered in sqrt
(np.sqrt(1.0 / 2.0 / np.log(
which is here:
picca/py/picca/delta_extraction/utils_pk1d.py
Lines 236 to 250 in 54a94a8
I think this is because two clipped values coincide, so the log becomes 0. I have been using an additive shift instead of clipping in my oversampling method. Here's how I do it:
shift = reso_matrix.min() - np.abs(reso_matrix[reso_matrix.nonzero()]).min()
reso = reso_matrix - shift
This works better then an arbitrary epsilon in my case. reso_matrix may have to be ravelled first.
Would this work here and yield the correct average rms in the end? Thoughts?
The text was updated successfully, but these errors were encountered: