Merge branch 'develop' into feature/fakturoid2
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,20 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# remove zero 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]
|
||||||
|
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
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ class ForceUnits(TestCase):
|
|||||||
df = dataprep.read_data(['averageforce'],ids=[13])
|
df = dataprep.read_data(['averageforce'],ids=[13])
|
||||||
df = dataprep.remove_nulls_pl(df)
|
df = dataprep.remove_nulls_pl(df)
|
||||||
average_N = int(df['averageforce'].mean())
|
average_N = int(df['averageforce'].mean())
|
||||||
self.assertEqual(average_N,119)
|
self.assertEqual(average_N,120)
|
||||||
|
|
||||||
@override_settings(TESTING=True)
|
@override_settings(TESTING=True)
|
||||||
class TestForceUnit(TestCase):
|
class TestForceUnit(TestCase):
|
||||||
|
|||||||
@@ -433,14 +433,16 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
yerror = []
|
yerror = []
|
||||||
groupsize = []
|
groupsize = []
|
||||||
groupval = []
|
groupval = []
|
||||||
for key, item in groups:
|
try:
|
||||||
xvalues.append(groups.get_group(key)[xparam].mean())
|
for key, item in groups:
|
||||||
yvalues.append(groups.get_group(key)[yparam].mean())
|
xvalues.append(groups.get_group(key)[xparam].mean())
|
||||||
xerror.append(groups.get_group(key)[xparam].std())
|
yvalues.append(groups.get_group(key)[yparam].mean())
|
||||||
yerror.append(groups.get_group(key)[yparam].std())
|
xerror.append(groups.get_group(key)[xparam].std())
|
||||||
groupsize.append(len(groups.get_group(key)[xparam]))
|
yerror.append(groups.get_group(key)[yparam].std())
|
||||||
groupval.append(groups.get_group(key)[groupby].mean())
|
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)
|
xvalues = pd.Series(xvalues)
|
||||||
yvalues = pd.Series(yvalues)
|
yvalues = pd.Series(yvalues)
|
||||||
|
|||||||
Reference in New Issue
Block a user