division by zero fix in dataprep
This commit is contained in:
@@ -759,9 +759,11 @@ def create_row_df(r,distance,duration,startdatetime,
|
|||||||
totalseconds += duration.second
|
totalseconds += duration.second
|
||||||
totalseconds += duration.microsecond/1.e6
|
totalseconds += duration.microsecond/1.e6
|
||||||
|
|
||||||
|
try:
|
||||||
spm = 60.*nr_strokes/totalseconds
|
spm = 60.*nr_strokes/totalseconds
|
||||||
|
except ZeroDivisionError:
|
||||||
|
spm = 20.
|
||||||
|
|
||||||
step = totalseconds/float(nr_strokes)
|
step = totalseconds/float(nr_strokes)
|
||||||
|
|
||||||
elapsed = np.arange(nr_strokes)*totalseconds/(float(nr_strokes-1))
|
elapsed = np.arange(nr_strokes)*totalseconds/(float(nr_strokes-1))
|
||||||
@@ -775,7 +777,10 @@ def create_row_df(r,distance,duration,startdatetime,
|
|||||||
pace = 500.*totalseconds/distance
|
pace = 500.*totalseconds/distance
|
||||||
|
|
||||||
if workouttype in ['rower','slides','dynamic']:
|
if workouttype in ['rower','slides','dynamic']:
|
||||||
velo = distance/totalseconds
|
try:
|
||||||
|
velo = distance/totalseconds
|
||||||
|
except ZeroDivisionError:
|
||||||
|
velo = 2.4
|
||||||
power = 2.8*velo**3
|
power = 2.8*velo**3
|
||||||
else:
|
else:
|
||||||
power = 0
|
power = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user