Fix bug when substracting background : change from mean to RMS value

This commit is contained in:
Thibault Barnouin
2021-06-07 13:56:57 +02:00
parent 2e75aaf85e
commit 5eb2446864

View File

@@ -387,10 +387,11 @@ def get_error(data_array, sub_shape=(15,15), display=False, headers=None,
rectangle[i] = minima[1], minima[0], sub_shape[0], sub_shape[1] rectangle[i] = minima[1], minima[0], sub_shape[0], sub_shape[1]
# Compute error : root mean square of the background # Compute error : root mean square of the background
sub_image = image[minima[1]:minima[1]+sub_shape[0],minima[0]:minima[0]+sub_shape[1]] sub_image = image[minima[1]:minima[1]+sub_shape[0],minima[0]:minima[0]+sub_shape[1]]
#error_array[i] *= np.std(sub_image) # Previously computed using standard deviation over the background #error = np.std(sub_image) # Previously computed using standard deviation over the background
error_array[i] *= np.sqrt(np.sum(sub_image**2)/sub_image.size) error = np.sqrt(np.sum(sub_image**2)/sub_image.size)
error_array[i] *= error
background[i] = sub_image.sum() background[i] = sub_image.sum()
data_array[i] = np.abs(data_array[i] - sub_image.mean()) data_array[i] = np.abs(data_array[i] - error)
if display: if display: