Private
Public Access
1
0

Merge branch 'release/v22.1.34'

This commit is contained in:
2024-09-25 21:24:17 +02:00
4 changed files with 21 additions and 11 deletions

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

View File

@@ -160,7 +160,7 @@ class ForceUnits(TestCase):
df = dataprep.read_data(['averageforce'],ids=[13])
df = dataprep.remove_nulls_pl(df)
average_N = int(df['averageforce'].mean())
self.assertEqual(average_N,119)
self.assertEqual(average_N,120)
@override_settings(TESTING=True)
class TestForceUnit(TestCase):

Binary file not shown.

View File

@@ -433,14 +433,16 @@ def trendflexdata(workouts, options, userid=0):
yerror = []
groupsize = []
groupval = []
for key, item in groups:
xvalues.append(groups.get_group(key)[xparam].mean())
yvalues.append(groups.get_group(key)[yparam].mean())
xerror.append(groups.get_group(key)[xparam].std())
yerror.append(groups.get_group(key)[yparam].std())
groupsize.append(len(groups.get_group(key)[xparam]))
groupval.append(groups.get_group(key)[groupby].mean())
try:
for key, item in groups:
xvalues.append(groups.get_group(key)[xparam].mean())
yvalues.append(groups.get_group(key)[yparam].mean())
xerror.append(groups.get_group(key)[xparam].std())
yerror.append(groups.get_group(key)[yparam].std())
groupsize.append(len(groups.get_group(key)[xparam]))
groupval.append(groups.get_group(key)[groupby].mean())
except TypeError:
return('','Error: Unable to compute data')
xvalues = pd.Series(xvalues)
yvalues = pd.Series(yvalues)