Add first deformation
This commit is contained in:
parent
3c2c30b0fb
commit
2840f86646
1 changed files with 14 additions and 8 deletions
20
ETA.py
20
ETA.py
|
@ -261,11 +261,11 @@ list_ = data[
|
||||||
calibrations[ 'top' ][ 'y' ][ 'max' ] : calibrations[ 'down' ][ 'y' ][ 'min' ],
|
calibrations[ 'top' ][ 'y' ][ 'max' ] : calibrations[ 'down' ][ 'y' ][ 'min' ],
|
||||||
border[ 'x' ][ 'min' ] : border[ 'x' ][ 'max' ]
|
border[ 'x' ][ 'min' ] : border[ 'x' ][ 'max' ]
|
||||||
].copy()
|
].copy()
|
||||||
list_ -= np.min( list_ )
|
list_ -= np.min( list_ , axis = 0 )
|
||||||
list_ /= np.max( list_ )
|
list_ /= np.max( list_ , axis = 0 )
|
||||||
|
|
||||||
size = border[ 'x' ][ 'max' ] - border[ 'x' ][ 'min' ]
|
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( [
|
y_stripe = np.array( [
|
||||||
np.where(
|
np.where(
|
||||||
list_[ : , x ] > 0.8
|
list_[ : , x ] > 0.8
|
||||||
|
@ -273,10 +273,16 @@ y_stripe = np.array( [
|
||||||
] )
|
] )
|
||||||
|
|
||||||
stripes = [ # list of polyval result for each 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
|
import matplotlib.pyplot as plt
|
||||||
plt.plot( x_stripe , y_stripe )
|
plt.imshow( results )
|
||||||
plt.plot( x_stripe , np.polyval( stripes[0] , x_stripe ) )
|
plt.savefig( 'asset/deformation.png' )
|
||||||
plt.savefig( 'asset/stripe.png' )
|
|
||||||
|
|
Loading…
Reference in a new issue