Update result format

This commit is contained in:
linarphy 2023-05-30 10:41:30 +02:00
parent 6eaf141f1f
commit 893a5268c3
No known key found for this signature in database
GPG key ID: 3D4AAAC3AD16E79C

13
ETA.py
View file

@ -605,24 +605,27 @@ fall = np.array( [
) for consecutive in fall if len( consecutive ) > 20 # the value might change ) for consecutive in fall if len( consecutive ) > 20 # the value might change
] ).astype( int ) ] ).astype( int )
stairs = np.zeros( ( size_y , size_x ) ) stairs = np.zeros( ( len( fall ) - 1 , size_x ) )
for x in range( size_x ): for x in range( size_x ):
stairs[ : fall[0] , x ] = 0 # TODO: put the mean stairs[ : fall[0] , x ] = 0 # TODO: put the mean
for i in range( len( fall ) - 1 ): 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 ], calibrations[ 'top' ][ 'y' ][ 'max' ] + fall[ i ] : calibrations[ 'top' ][ 'y' ][ 'max' ] + fall[ i + 1 ],
border[ 'x' ][ 'min' ] + x border[ 'x' ][ 'min' ] + x
] ) ] )
stairs[ fall[ -1 ] : , x ] = 0
if verbose: if verbose:
print( 'ETA flattened' ) print( 'ETA flattened' )
print( 'outputting data' ) print( 'outputting data' )
if output == None: if output == None:
print( stairs ) print( stairs , wavelength )
else: 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: if verbose:
print( 'output sent' ) print( 'output sent' )