From 5dc16bbe0909ed3ac29eeebfd39a191ceca83e90 Mon Sep 17 00:00:00 2001 From: linarphy Date: Mon, 26 Jun 2023 11:37:38 +0200 Subject: [PATCH] Add bias substraction --- ETA.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/ETA.py b/ETA.py index 230365d..e392b93 100644 --- a/ETA.py +++ b/ETA.py @@ -580,6 +580,33 @@ else: wavelength = np.arange( size_y ) if verbose: + print( 'starting bias substraction' ) + +bias = { + 'top': np.mean( + data[ + calibrations[ 'top' ][ 'y' ][ 'min' ] - 100 : + calibrations[ 'top' ][ 'y' ][ 'min' ] , + calibrations[ 'top' ][ 'x' ][ 'min' ] : + calibrations[ 'top' ][ 'x' ][ 'max' ] + ] , + axis = 0, + ), + 'down': np.mean( + data[ + calibrations[ 'down' ][ 'y' ][ 'max' ] : + calibrations[ 'down' ][ 'y' ][ 'max' ] + 100, + calibrations[ 'down' ][ 'x' ][ 'min' ] : + calibrations[ 'down' ][ 'x' ][ 'max' ] + ] , + axis = 0, + ), +} + +mean_bias = np.mean( [ bias[ 'top' ] , bias[ 'down' ] ] , axis = 0 ) + +if verbose: + print( 'bias substraction finished' ) print( 'starting to flatten the ETA' ) list_ = np.convolve( @@ -590,7 +617,7 @@ list_ = np.convolve( border[ 'x' ][ 'min' ] : border[ 'x' ][ 'max' ] ] , axis = 1, - ), + ) - mean_bias, ) , np.ones( 50 ), 'same' ,