Private
Public Access
1
0

better negative power peak detection

This commit is contained in:
2024-09-25 20:52:06 +02:00
parent 20ea51b18b
commit ae52724a00

View File

@@ -6,6 +6,7 @@ import rowingdata.tcxtools as tcxtools
from rowers.utils import totaltime_sec_to_string
from rowers.datautils import p0
from scipy import optimize
from scipy.signal import find_peaks
from rowers.utils import calculate_age
import datetime
import gzip
@@ -1207,8 +1208,15 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
except KeyError:
pass
# smoothen power
row.df[' Power (watts)'].replace(to_replace=0,method='ffill', inplace=True)
# remove negative power peaks
x = row.df[' Power (watts)'].values
x = x * - 1
neg_peaks, _ = find_peaks(x, height=0) # hieght is the threshold value
row.df[' Power (watts)'][neg_peaks] = row.df[' Power (watts)'][neg_peaks-1]
#row.df[' Power (watts)'].replace(to_replace=0,method='ffill', inplace=True)
if dosmooth:
# auto smoothing