Closed randlet closed 3 years ago
Also, somewhat related, should
background_median = np.mean([roi.pixel_value for roi in self.background_rois.values()])
be
background_mean = np.mean([roi.pixel_value for roi in self.background_rois.values()])
or
background_median = np.median([roi.pixel_value for roi in self.background_rois.values()])
?
Quantitatively, mean or median doesn't make a big difference in this context, but for consistency, let's go with mean (middle).
Describe the bug
For Catphan modules without background_roi_settings (CTP486) the
background_median/background_std
get set to nan in _setup_rois because np.mean([]) == np.std([]) == nan. This throws RuntimeWarnings and / or FloatingPointError's. This nan gets propagated through to cnr calculations for the module roisTo Reproduce