Skip to content
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

divide by zero in livedata/handle_2d.py #37

Open
prjemian opened this issue Nov 12, 2018 · 1 comment
Open

divide by zero in livedata/handle_2d.py #37

prjemian opened this issue Nov 12, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@prjemian
Copy link
Contributor

during specplots processing (related to APS-USAXS/usaxs-bluesky-ended-2023#76), this error was reported in the logs but that did not stop further processing -- should examine this rare occurrence further (in case diagnostics can be improved)

(19266) created: /share1/local_livedata/specplots/2018/08/08_13_NIST/s48.png
(19266) created: /share1/local_livedata/specplots/2018/08/08_13_NIST/s51.png
(19266) created: /s/home/beams11/USAXS/Documents/eclipse/USAXS/livedata/handle_2d.py:73: RuntimeWarning: divide by zero encountered in double_scalars
  image_data *= SCALING_FACTOR / image_data.max()
/home/beams11/USAXS/Documents/eclipse/USAXS/livedata/handle_2d.py:73: RuntimeWarning: invalid value encountered in multiply
  image_data *= SCALING_FACTOR / image_data.max()
/APSshare/anaconda/x86_64/lib/python2.7/site-packages/matplotlib/colors.py:941: UserWarning: Warning: converting a masked element to nan.
  vmin = float(vmin)
/APSshare/anaconda/x86_64/lib/python2.7/site-packages/matplotlib/colors.py:942: UserWarning: Warning: converting a masked element to nan.
  vmax = float(vmax)
hare1/local_livedata/specplots/2018/08/08_13_NIST/s54.png
(19266) created: /share1/local_livedata/specplots/2018/08/08_13_NIST/s57.png
(19266) created: /share1/local_livedata/specplots/2018/08/08_13_NIST/s60.png
@prjemian prjemian self-assigned this Nov 12, 2018
@prjemian
Copy link
Contributor Author

prjemian commented Jun 5, 2019

Seems peculiar why a divide-by-zero error happens. Here is a summary of the code:

image_data = numpy.ma.masked_less_equal(hdf5["/entry/data/data"].value, 0)
# replace masked data with min good value
image_data = image_data.filled(image_data.min())

At this point, there should be no unmasked zero values in image_data.

Q: What if image_data.max() == 0? Could that be the issue here?

Need to examine with scan 54 from 2018/08/08_13_NIST. Closing this issue does not look like a requirement for 2019-06 operations.

@prjemian prjemian transferred this issue from APS-USAXS/usaxs-bluesky-ended-2023 Aug 25, 2019
@prjemian prjemian added the bug Something isn't working label Aug 25, 2019
@prjemian prjemian added this to the 2022-10 operations at 20-ID milestone Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant