Fix consecutive, Update default of retrieve_peaks

This commit is contained in:
linarphy 2023-05-24 15:11:05 +02:00
parent 4e54a1b433
commit ceaeccde3a
No known key found for this signature in database
GPG key ID: 3D4AAAC3AD16E79C

View file

@ -180,6 +180,8 @@ def consecutive( list_ ):
""" """
if not isinstance( list_ , list ) and not isinstance( list_ , np.ndarray ): if not isinstance( list_ , list ) and not isinstance( list_ , np.ndarray ):
raise ValueError( 'list_ must be a list, ' + type( list_ ) + ' given' ) raise ValueError( 'list_ must be a list, ' + type( list_ ) + ' given' )
if len( list_ ) == 0:
return list_
index = last_consecutive( list_ ) index = last_consecutive( list_ )
if index == len( list_ ) - 1: if index == len( list_ ) - 1:
return [ list_ ] return [ list_ ]
@ -212,7 +214,7 @@ def rotate( image , angle ):
cX , cY = ( width // 2 , height // 2 ) cX , cY = ( width // 2 , height // 2 )
matrix = cv2.getRotationMatrix2D( ( cX , cY ) , angle , 1 ) matrix = cv2.getRotationMatrix2D( ( cX , cY ) , angle , 1 )
return cv2.warpAffine( image , matrix , ( width , height ) , flags = cv2.INTER_NEAREST ) return cv2.warpAffine( image , matrix , ( width , height ) , flags = cv2.INTER_NEAREST )
def retrieve_peaks( data , window_size = 5 , error_coef = 1.05 , max_window_size = 30 , min_successive = 3 ): def retrieve_peaks( data , window_size = 5 , error_coef = 1.05 , max_window_size = 30 , min_successive = 2 ):
""" """
get peak position from a 1D data get peak position from a 1D data
""" """