ess.imaging.normalize.average_sample_pixel_counts#

ess.imaging.normalize.average_sample_pixel_counts(sample_images)[source]#

Calculate the average sample pixel counts.

Return type:

normalize.AverageSamplePixelCounts (scipp.Variable)

Notes

For performance reason, we tried calculating the mean of sample images and dark current images first and subtract them afterwards, instead of using the subtracted image stack directly. It was to utilize that the integer operation is faster than the floating point operation.

However, we are ceiling negative values to zero after cleansing the sample images with dark current images.

Therefore we need to calculate the mean of the cleansed sample images to avoid negative values in the average calculation.

We don’t calculate mean(cleansed_sample_images) at once since it is a large array and it may cause memory issues.

There was an example of 361 images of 2048x2048 pixels with 32-bit integer data exceeded the limit of the maximum integer so the average calculation failed and returned negative values.