Update find_point

- Update default theshold
- Update how it works
This commit is contained in:
linarphy 2023-08-25 17:25:33 +02:00
parent 8b604d8ae2
commit e75bdddab3
No known key found for this signature in database
GPG key ID: 3D4AAAC3AD16E79C

View file

@ -65,7 +65,7 @@ def point( index_1 , index_2 , axis = 'x' ):
return [ index_2 , index_1 ] return [ index_2 , index_1 ]
return [ index_1 , index_2 ] return [ index_1 , index_2 ]
def find_point( list_ , index , axis = 'x' , threshold = 0.5 ): def find_point( list_ , index , axis = 'x' , threshold = 0.95 ):
""" """
find the index where to fill in a side find the index where to fill in a side
""" """
@ -80,15 +80,14 @@ def find_point( list_ , index , axis = 'x' , threshold = 0.5 ):
if not isinstance( threshold , float ): if not isinstance( threshold , float ):
raise ValueError( 'threshold must be a float, ' + type( threshold ) + ' given' ) raise ValueError( 'threshold must be a float, ' + type( threshold ) + ' given' )
mean = np.mean( list_ )
ampl = np.max( list_ ) - np.min( list_ ) ampl = np.max( list_ ) - np.min( list_ )
if ampl < mean / 2: if ampl < np.mean( list_ ) / 2:
return [ point( index , 0 , axis ) ] return [ point( index , 0 , axis ) ]
else: else:
points = [] points = []
list_ = np.convolve( list_ , np.ones( 100 ) , 'same' ) list_ = list_.copy()
list_ -= np.min( list_ ) list_ -= np.min( list_ )
list_ /= np.max( list_ ) list_ /= np.max( list_ )