diff --git a/ETA.py b/ETA.py index 71be064..de06ba3 100644 --- a/ETA.py +++ b/ETA.py @@ -605,24 +605,27 @@ fall = np.array( [ ) for consecutive in fall if len( consecutive ) > 20 # the value might change ] ).astype( int ) -stairs = np.zeros( ( size_y , size_x ) ) +stairs = np.zeros( ( len( fall ) - 1 , size_x ) ) for x in range( size_x ): stairs[ : fall[0] , x ] = 0 # TODO: put the mean for i in range( len( fall ) - 1 ): - stairs[ fall[ i ] : fall[ i + 1 ] , x ] = np.mean( data[ + stairs[ i , x ] = np.mean( data[ calibrations[ 'top' ][ 'y' ][ 'max' ] + fall[ i ] : calibrations[ 'top' ][ 'y' ][ 'max' ] + fall[ i + 1 ], border[ 'x' ][ 'min' ] + x ] ) - stairs[ fall[ -1 ] : , x ] = 0 if verbose: print( 'ETA flattened' ) print( 'outputting data' ) if output == None: - print( stairs ) + print( stairs , wavelength ) else: - np.savetxt( output , stairs ) + + output_file = pathlib.Path( output ) + with shelve.open( str( output_file ) ) as output: + output[ 'data' ] = data + output[ 'wavelength' ] = wavelength if verbose: print( 'output sent' )