Update find_point
- Update default theshold - Update how it works
This commit is contained in:
parent
8b604d8ae2
commit
e75bdddab3
1 changed files with 4 additions and 5 deletions
|
@ -65,7 +65,7 @@ def point( index_1 , index_2 , axis = 'x' ):
|
|||
return [ index_2 , index_1 ]
|
||||
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
|
||||
"""
|
||||
|
@ -80,22 +80,21 @@ def find_point( list_ , index , axis = 'x' , threshold = 0.5 ):
|
|||
if not isinstance( threshold , float ):
|
||||
raise ValueError( 'threshold must be a float, ' + type( threshold ) + ' given' )
|
||||
|
||||
mean = np.mean( list_ )
|
||||
ampl = np.max( list_ ) - np.min( list_ )
|
||||
|
||||
if ampl < mean / 2:
|
||||
if ampl < np.mean( list_ ) / 2:
|
||||
return [ point( index , 0 , axis ) ]
|
||||
else:
|
||||
points = []
|
||||
|
||||
list_ = np.convolve( list_ , np.ones( 100 ) , 'same' )
|
||||
list_ = list_.copy()
|
||||
list_ -= np.min( list_ )
|
||||
list_ /= np.max( list_ )
|
||||
|
||||
i , inside , size = 0 , False , 0
|
||||
while i < len( list_ ):
|
||||
if list_[ i ] > threshold and not inside:
|
||||
points.append( point( index , i , axis ) )
|
||||
points.append( point( index , i, axis ) )
|
||||
inside = True
|
||||
size = 0
|
||||
elif list_[ i ] < threshold and inside:
|
||||
|
|
Loading…
Reference in a new issue