usnistgov / PyHyperScattering

Tools for hyperspectral x-ray and neutron scattering data loading, reduction, slicing, and visualization.
Other
7 stars 9 forks source link

SST1RSoXSDB and SST1RSoXSLoader: warn on saturation and warn on underexposure #72

Closed pbeaucage closed 1 month ago

pbeaucage commented 1 year ago

This came up in discussions with @delongchamp and @EliotGann today.

The SST1 loading suite (for that matter, ALS11012 too) should warn if any pixel is saturated, or if the total image is underexposed. This warning should be extremely loud, perhaps as far as causing a load to fail unless an override flag is set.

@EliotGann can you remind us of the saturation limit and dark/readout noise floor of the GreatEyes CCD's?

EliotGann commented 1 year ago

this is a difficult number to say for sure, I think looking at old data might be the best. It will depend on the binning (which is usually 4x4 but do we hard code that?) and when it's really over saturated the signal starts going down. Then if there is a lot of light in the chamber, both the dark and image might be saturated, but look like there is no signal because it's on both.

pdudenas commented 1 year ago

Scans 48677 and 48678 from 2022-3 both contain saturated data and can be used to test this functionality.

EliotGann commented 6 months ago

There are now ophyd level booleans which can be monitored that indicate saturation or low signal level now, which can be read directly. I'm not sure that this is a pyhyperscattering job, but warning when they are True might be worth it. in the primary stream you should see Wide_Angle_CCD_Detector_under_exposed and Wide_Angle_CCD_Detector_saturated as booleans accompanying any image. the math for determining these are here: https://github.com/NSLS-II-SST/rsoxs/blob/10c2c41b695c1db552f62decdde571472b71d981/rsoxs/Base/detectors.py#L110-L119

delongchamp commented 1 month ago

@PriyankaKetkarBNL and @EliotGann, be aware that although this makes PyHyper aware of the flagged underexposure and saturation warnings, it's still dependent on the logic in these lines of the beamline code.

For example, one of my test scans (67522) shows several energies as saturated and simultaneously shows ALL energies underexposed. I checked and this is indeed what is in the databroker record.