better negative power peak detection
This commit is contained in:
@@ -6,6 +6,7 @@ import rowingdata.tcxtools as tcxtools
|
|||||||
from rowers.utils import totaltime_sec_to_string
|
from rowers.utils import totaltime_sec_to_string
|
||||||
from rowers.datautils import p0
|
from rowers.datautils import p0
|
||||||
from scipy import optimize
|
from scipy import optimize
|
||||||
|
from scipy.signal import find_peaks
|
||||||
from rowers.utils import calculate_age
|
from rowers.utils import calculate_age
|
||||||
import datetime
|
import datetime
|
||||||
import gzip
|
import gzip
|
||||||
@@ -1207,8 +1208,15 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
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:
|
if dosmooth:
|
||||||
# auto smoothing
|
# auto smoothing
|
||||||
|
|||||||
Reference in New Issue
Block a user