Update peak finding, still buggy

This commit is contained in:
linarphy 2023-05-25 16:57:37 +02:00
parent 216325ebf4
commit 0ef0b9079b
No known key found for this signature in database
GPG key ID: 3D4AAAC3AD16E79C

View file

@ -29,11 +29,8 @@ def get_extremities( signal , peaks ):
it. The same goes for the area at the end. it. The same goes for the area at the end.
ONLY TRUE FOR THE CURRENT CALIBRATION (Hg) ONLY TRUE FOR THE CURRENT CALIBRATION (Hg)
""" """
peaks_inside , i = [] , 0 peaks_inside , i = [ 0 , 0 ] , 0
argmin = len( signal ) // 2 argmin = len( signal ) // 2
while len( peaks_inside ) != 1:
if i > 50 or len( signal[ : argmin ] ) == 0:
raise Exception( 'unknown plage, cannot autocalibrate' )
argmin = np.argmin( argmin = np.argmin(
signal[ : argmin ] signal[ : argmin ]
) )
@ -44,7 +41,8 @@ def get_extremities( signal , peaks ):
argmin > peaks, argmin > peaks,
) )
)[0] )[0]
i += 1 if len( peaks_inside ) == 0:
raise Exception( 'unknown plage, cannot autocalibrate' )
first_peak = peaks_inside[0] first_peak = peaks_inside[0]
""" """