From 2840f866469ec99396b1d3fd7881ec48c1d84c80 Mon Sep 17 00:00:00 2001 From: linarphy Date: Thu, 11 May 2023 16:57:48 +0200 Subject: [PATCH] Add first deformation --- ETA.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/ETA.py b/ETA.py index 20eb316..5823bc6 100644 --- a/ETA.py +++ b/ETA.py @@ -261,22 +261,28 @@ list_ = data[ calibrations[ 'top' ][ 'y' ][ 'max' ] : calibrations[ 'down' ][ 'y' ][ 'min' ], border[ 'x' ][ 'min' ] : border[ 'x' ][ 'max' ] ].copy() -list_ -= np.min( list_ ) -list_ /= np.max( list_ ) +list_ -= np.min( list_ , axis = 0 ) +list_ /= np.max( list_ , axis = 0 ) size = border[ 'x' ][ 'max' ] - border[ 'x' ][ 'min' ] -x_stripe = np.arange( border[ 'x' ][ 'min' ] + 1 * size / 4 , border[ 'x' ][ 'min' ] + 3 * size / 4 , 1 ).astype( int ) +x_stripe = np.arange( border[ 'x' ][ 'min' ] + 1 * size // 4 , border[ 'x' ][ 'min' ] + 3 * size // 4 , 1 ).astype( int ) y_stripe = np.array( [ np.where( list_[ : , x ] > 0.8 - )[0][0] for x in x_stripe + )[0][0] for x in x_stripe ] ) stripes = [ # list of polyval result for each stripe - np.polyfit( x_strip , y_stripe , 2 ) + np.polyfit( x_stripe , y_stripe , 2 ) ] +# First deformation +y_diff = np.polyval( stripes[0] , np.arange( 0 , size , 1 ) ).astype( int ) +results = np.zeros( ( list_.shape[1] , list_.shape[0] - np.max( y_diff ) ) ) +for i in range( list_.shape[1] ): + results[i] = list_[ y_diff[ i ] : list_.shape[0] + y_diff[ i ] - np.max( y_diff ) , i ] +results = results.transpose() + import matplotlib.pyplot as plt -plt.plot( x_stripe , y_stripe ) -plt.plot( x_stripe , np.polyval( stripes[0] , x_stripe ) ) -plt.savefig( 'asset/stripe.png' ) +plt.imshow( results ) +plt.savefig( 'asset/deformation.png' )