Private
Public Access
1
0

histo converted to polars

This commit is contained in:
2024-04-08 20:50:08 +02:00
parent 6d549e3b8b
commit fd46732b6e
3 changed files with 116 additions and 20 deletions

View File

@@ -469,18 +469,20 @@ def interactive_forcecurve(theworkouts):
columns = ['catch', 'slip', 'wash', 'finish', 'averageforce',
'peakforceangle', 'peakforce', 'spm', 'distance',
'workoutstate', 'driveenergy', 'cumdist']
'workoutstate', 'driveenergy', 'cumdist', 'workoutid']
columns = columns + [name for name, d in metrics.rowingmetrics]
rowdata = dataprep.getsmallrowdata_db(columns, ids=ids,
rowdata = dataprep.getsmallrowdata_pl(columns, ids=ids,
workstrokesonly=False)
rowdata.dropna(axis=1, how='all', inplace=True)
rowdata.dropna(axis=0, how='any', inplace=True)
rowdata = rowdata.fill_nan(None).drop_nulls()
if rowdata.empty:
if rowdata.is_empty():
return "", "No Valid Data Available"
data_dict = rowdata.to_dict("records")
data_dict = rowdata.to_dicts()
thresholdforce = 100. if 'x' in boattype else 200.
@@ -490,7 +492,7 @@ def interactive_forcecurve(theworkouts):
'thresholdforce': thresholdforce,
}
script, div = get_chart("/forcecurve", chart_data)
script, div = get_chart("/forcecurve", chart_data, debug=False)
return script, div
@@ -822,25 +824,27 @@ def interactive_histoall(theworkouts, histoparam, includereststrokes,
ids = [int(w.id) for w in theworkouts]
columns = [name for name, d in metrics.rowingmetrics]+['spm', 'driveenergy', 'distance', 'workoutstate', 'workoutid']
workstrokesonly = not includereststrokes
rowdata = dataprep.getsmallrowdata_db(
[histoparam], ids=ids, doclean=True, workstrokesonly=workstrokesonly)
rowdata = dataprep.getsmallrowdata_pl(
columns, ids=ids, doclean=True, workstrokesonly=workstrokesonly)
rowdata.dropna(axis=0, how='any', inplace=True)
rowdata = rowdata.fill_nan(None).drop_nulls()
rowdata = dataprep.filter_df(rowdata, 'spm', spmmin, largerthan=True)
rowdata = dataprep.filter_df(rowdata, 'spm', spmmax, largerthan=False)
#rowdata = dataprep.filter_df(rowdata, 'spm', spmmin, largerthan=True)
#rowdata = dataprep.filter_df(rowdata, 'spm', spmmax, largerthan=False)
rowdata = dataprep.filter_df(
rowdata, 'driveenergy', workmin, largerthan=True)
rowdata = dataprep.filter_df(
rowdata, 'driveenergy', workmax, largerthan=False)
#rowdata = dataprep.filter_df(
# rowdata, 'driveenergy', workmin, largerthan=True)
#rowdata = dataprep.filter_df(
# rowdata, 'driveenergy', workmax, largerthan=False)
if rowdata.empty:
if rowdata.is_empty():
return "", "No Valid Data Available"
try:
histopwr = rowdata[histoparam].values
histopwr = rowdata[histoparam].to_numpy()
except KeyError:
return "", "No data"
if len(histopwr) == 0: # pragma: no cover