From ceaeccde3ae8de39989ba78c6c276c175e58a416 Mon Sep 17 00:00:00 2001 From: linarphy Date: Wed, 24 May 2023 15:11:05 +0200 Subject: [PATCH] Fix consecutive, Update default of retrieve_peaks --- utils.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils.py b/utils.py index acc5192..fc2fe6d 100644 --- a/utils.py +++ b/utils.py @@ -180,6 +180,8 @@ def consecutive( list_ ): """ if not isinstance( list_ , list ) and not isinstance( list_ , np.ndarray ): raise ValueError( 'list_ must be a list, ' + type( list_ ) + ' given' ) + if len( list_ ) == 0: + return list_ index = last_consecutive( list_ ) if index == len( list_ ) - 1: return [ list_ ] @@ -212,7 +214,7 @@ def rotate( image , angle ): cX , cY = ( width // 2 , height // 2 ) matrix = cv2.getRotationMatrix2D( ( cX , cY ) , angle , 1 ) 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 """