Would you please review these changes ?
The warning producing bug was to perform the sqrt first then filter for positive values after that.
Besides, the behavior was so far that both pixelBased and imageBased returned 1. if no unmasked pixels remained (based on mask bits & variance > 0.) but if there remained a single nan unmasked in the image plane that caused the correction factor to be nan.(Both np.percentile and np.median give nan for any nan inputs.) Similarly, if there were too many inf-s that could result in the interquartile region to be inf - inf == nan.
I expect that this was unintentional behavior and I changed it to ignore these pixels as well.
Would you please review these changes ?
The warning producing bug was to perform the sqrt first then filter for positive values after that.
Besides, the behavior was so far that both pixelBased and imageBased returned 1. if no unmasked pixels remained (based on mask bits & variance > 0.) but if there remained a single nan unmasked in the image plane that caused the correction factor to be nan.(Both np.percentile and np.median give nan for any nan inputs.) Similarly, if there were too many inf-s that could result in the interquartile region to be inf - inf == nan.
I expect that this was unintentional behavior and I changed it to ignore these pixels as well.