using rowingdata_pl, requires rowingdata > 3.6.6
This commit is contained in:
@@ -73,6 +73,7 @@ import pytz
|
|||||||
import collections
|
import collections
|
||||||
import pendulum
|
import pendulum
|
||||||
from rowingdata import rowingdata as rrdata
|
from rowingdata import rowingdata as rrdata
|
||||||
|
from rowingdata import rowingdata_pl as rrdata_pl
|
||||||
|
|
||||||
from rowingdata import rower as rrower
|
from rowingdata import rower as rrower
|
||||||
|
|
||||||
@@ -618,6 +619,8 @@ def update_wps(r, types, mode='water', asynchron=True):
|
|||||||
r.save()
|
r.save()
|
||||||
except ValueError: # pragma: no cover
|
except ValueError: # pragma: no cover
|
||||||
pass
|
pass
|
||||||
|
except OverflowError:
|
||||||
|
pass
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -1397,6 +1400,11 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
w.team.add(t)
|
w.team.add(t)
|
||||||
|
|
||||||
# put stroke data in database
|
# put stroke data in database
|
||||||
|
try:
|
||||||
|
row = rrdata_pl(df=pl.from_pandas(row.df))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
_ = dataplep(row.df, id=w.id, bands=True,
|
_ = dataplep(row.df, id=w.id, bands=True,
|
||||||
barchart=True, otwpower=True, empower=True, inboard=inboard)
|
barchart=True, otwpower=True, empower=True, inboard=inboard)
|
||||||
|
|
||||||
|
|||||||
@@ -1982,23 +1982,30 @@ def dataplep(rowdatadf, id=0, inboard=0.88, forceunit='lbs', bands=True, barchar
|
|||||||
empower=True, debug=False, polars=True
|
empower=True, debug=False, polars=True
|
||||||
):
|
):
|
||||||
# rowdatadf is pd.DataFrame
|
# rowdatadf is pd.DataFrame
|
||||||
if rowdatadf.empty:
|
|
||||||
return 0
|
|
||||||
|
|
||||||
try:
|
|
||||||
df = pl.from_pandas(rowdatadf)
|
if isinstance(rowdatadf, pd.DataFrame):
|
||||||
except ArrowInvalid:
|
if rowdatadf.empty:
|
||||||
for k, v in dtypes.items():
|
return 0
|
||||||
try:
|
|
||||||
rowdatadf[k] = rowdatadf[k].astype(v)
|
|
||||||
except KeyError: # pragma: no cover
|
|
||||||
pass
|
|
||||||
try:
|
try:
|
||||||
df = pl.from_pandas(rowdatadf)
|
df = pl.from_pandas(rowdatadf)
|
||||||
except ArrowInvalid:
|
except ArrowInvalid:
|
||||||
return dataprep(rowdatadf, id=id, inboard=inboard, forceunit=forceunit, bands=bands, barchart=barchart,
|
for k, v in dtypes.items():
|
||||||
otwpower=otwpower, debug=debug,polars=True)
|
try:
|
||||||
|
rowdatadf[k] = rowdatadf[k].astype(v)
|
||||||
|
except KeyError: # pragma: no cover
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
df = pl.from_pandas(rowdatadf)
|
||||||
|
except ArrowInvalid:
|
||||||
|
return dataprep(rowdatadf, id=id, inboard=inboard, forceunit=forceunit, bands=bands, barchart=barchart,
|
||||||
|
otwpower=otwpower, debug=debug,polars=True)
|
||||||
|
|
||||||
|
else:
|
||||||
|
df = rowdatadf
|
||||||
|
if df.is_empty():
|
||||||
|
return 0
|
||||||
|
|
||||||
df = df.with_columns((pl.col("TimeStamp (sec)")-df[0, "TimeStamp (sec)"]).alias("TimeStamp (sec)"))
|
df = df.with_columns((pl.col("TimeStamp (sec)")-df[0, "TimeStamp (sec)"]).alias("TimeStamp (sec)"))
|
||||||
df = df.with_columns((pl.col(" Stroke500mPace (sec/500m)").clip(1,3000)).alias(" Stroke500mPace"))
|
df = df.with_columns((pl.col(" Stroke500mPace (sec/500m)").clip(1,3000)).alias(" Stroke500mPace"))
|
||||||
|
|||||||
@@ -289,31 +289,6 @@
|
|||||||
<label for="group-advanced">Advanced</label>
|
<label for="group-advanced">Advanced</label>
|
||||||
<ul>
|
<ul>
|
||||||
{% if workout|water %}
|
{% if workout|water %}
|
||||||
<li id="advanced-wind">
|
|
||||||
<a href="/rowers/workout/{{ workout.id|encode }}/wind/">
|
|
||||||
<i class="fas fa-pennant fa-fw"></i> Wind
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li id="advanced-stream">
|
|
||||||
<a href="/rowers/workout/{{ workout.id|encode }}/stream/">
|
|
||||||
<i class="fas fa-stream fa-fw"></i> Stream
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li id="chart-otwpower">
|
|
||||||
<a href="/rowers/workout/{{ workout.id|encode }}/interactiveotwplot/">
|
|
||||||
<i class="fal fa-calculator-alt fa-fw"></i> Corrected Pace Plot
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li id="advanced-otwpower">
|
|
||||||
<a href="/rowers/workout/{{ workout.id|encode }}/otwsetpower/">
|
|
||||||
<i class="fas fa-calculator-alt fa-fw"></i> OTW Power
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
<li id="advanced-otwpower">
|
|
||||||
<a href="/rowers/workout/{{ workout.id|encode }}/zeropower-confirm/">
|
|
||||||
<i class="fas fa-eraser fa-fw"></i> Remove Power Data
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
{% if 'speedcoach2' in workout.workoutsource or 'nklinklogbook' in workout.workoutsource %}
|
{% if 'speedcoach2' in workout.workoutsource or 'nklinklogbook' in workout.workoutsource %}
|
||||||
<li id="advanced-usegps">
|
<li id="advanced-usegps">
|
||||||
<a href="/rowers/workout/{{ workout.id|encode }}/otwusegps/">
|
<a href="/rowers/workout/{{ workout.id|encode }}/otwusegps/">
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from django.db import transaction
|
|||||||
nu = datetime.datetime.now()
|
nu = datetime.datetime.now()
|
||||||
import datetime
|
import datetime
|
||||||
import pytz
|
import pytz
|
||||||
|
import polars as pl
|
||||||
|
|
||||||
# interactive plots
|
# interactive plots
|
||||||
from rowers import interactiveplots
|
from rowers import interactiveplots
|
||||||
@@ -659,7 +660,7 @@ class InteractivePlotTests(TestCase):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
def test_interactive_hr_piechart(self):
|
def test_interactive_hr_piechart(self):
|
||||||
df = pd.read_csv('rowers/tests/testdata/getrowdata_mock.csv')
|
df = pl.read_csv('rowers/tests/testdata/getrowdata_mock.csv')
|
||||||
|
|
||||||
script, div = interactiveplots.interactive_hr_piechart(df, self.r,'')
|
script, div = interactiveplots.interactive_hr_piechart(df, self.r,'')
|
||||||
self.assertFalse(len(script)==0)
|
self.assertFalse(len(script)==0)
|
||||||
|
|||||||
@@ -157,17 +157,14 @@ class URLTests(TestCase):
|
|||||||
'/rowers/workout/'+encoded1+'/instroke/',
|
'/rowers/workout/'+encoded1+'/instroke/',
|
||||||
'/rowers/workout/'+encoded1+'/interactiveotwplot/',
|
'/rowers/workout/'+encoded1+'/interactiveotwplot/',
|
||||||
'/rowers/workout/'+encoded1+'/map/',
|
'/rowers/workout/'+encoded1+'/map/',
|
||||||
'/rowers/workout/'+encoded1+'/otwsetpower/',
|
|
||||||
'/rowers/workout/'+encoded1+'/recalcsummary/',
|
'/rowers/workout/'+encoded1+'/recalcsummary/',
|
||||||
'/rowers/workout/'+encoded1+'/restore/',
|
'/rowers/workout/'+encoded1+'/restore/',
|
||||||
'/rowers/workout/'+encoded1+'/smoothenpace/',
|
'/rowers/workout/'+encoded1+'/smoothenpace/',
|
||||||
'/rowers/workout/'+encoded1+'/split/',
|
'/rowers/workout/'+encoded1+'/split/',
|
||||||
'/rowers/workout/'+encoded1+'/stats/',
|
'/rowers/workout/'+encoded1+'/stats/',
|
||||||
'/rowers/workout/'+encoded1+'/stream/',
|
|
||||||
'/rowers/workout/'+encoded1+'/undosmoothenpace/',
|
'/rowers/workout/'+encoded1+'/undosmoothenpace/',
|
||||||
'/rowers/workout/'+encoded1+'/unsubscribe/',
|
'/rowers/workout/'+encoded1+'/unsubscribe/',
|
||||||
'/rowers/workout/'+encoded1+'/view/',
|
'/rowers/workout/'+encoded1+'/view/',
|
||||||
'/rowers/workout/'+encoded1+'/wind/',
|
|
||||||
'/rowers/workout/'+encoded1+'/workflow/',
|
'/rowers/workout/'+encoded1+'/workflow/',
|
||||||
'/rowers/workout/fusion/'+encoded1+'/',
|
'/rowers/workout/fusion/'+encoded1+'/',
|
||||||
'/rowers/workout/upload/',
|
'/rowers/workout/upload/',
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user