NSLS-II-CSX / csxtools

Useful python tools for CSX (23-ID)
http://nsls-ii-csx.github.io/csxtools
Other
4 stars 13 forks source link

Should we change default behavior get_fastccd_images to use a flatfield of (almost) all ones? #70

Closed ambarb closed 1 year ago

ambarb commented 4 years ago

In the discussion of

https://github.com/NSLS-II-CSX/csxtools/issues/68#issuecomment-585349684

I noticed that pixels without photons are different values if the flat field is not applied to get_fastccd_images(). For consistency in working with other codes/GUIs not in csxtools, should we change the behavior to match if a flatfield is not provided?

Using an array of all 1's as the flatfield will do this. We can do it manually without changing the function, but it is one more thing to explain to the user. Thoughts?

The normalized images with flatfield applied converts areas with no photons to nan. This is an issue with sk-beam's correlation functions if these pixels are included in an roi, but the problem is already present for flatfield normalized images. And in fact, this conversion to nan is better than letting someone calculate an auto-correlation function with pixels that are essentially zero.

In a way, the flatfield normalization is acting as a pixel mask for pixels that should not be used. This is kinda cool, without having to carry around a separate array for this mask.

Can anyone think of any other problems/benefits or things we should keep in mind before making a decision?

ambarb commented 4 years ago

Added "almost" because we need a mask for the bad pixels for this to work - either an old flatfield that convert all pixels to 1.00000 if it is not nan.

ambarb commented 4 years ago

https://github.com/scikit-beam/scikit-beam/issues/563 https://github.com/scikit-beam/scikit-beam/issues/431 @cmazzoli @wen-hu

It may be better to not have NaNs in the flatfield corrected images because of skbeam functions. Or at least have a bit more control on where NaNs go or prevent bad flat field images that create NaN-ed pixels in regions where we would not expect .

ambarb commented 1 year ago

stale