another batch of files with a light sprinkle of comments
This commit is contained in:
@@ -3,6 +3,7 @@ import matplotlib.pyplot as plt
|
||||
|
||||
import numpy as np
|
||||
|
||||
# Make pace ticks for pace axis '2:00', '1:50', etc
|
||||
def format_pace_tick(x,pos=None):
|
||||
min=int(x/60)
|
||||
sec=int(x-min*60.)
|
||||
@@ -10,6 +11,7 @@ def format_pace_tick(x,pos=None):
|
||||
template='%d:%s'
|
||||
return template % (min,sec_str)
|
||||
|
||||
# Returns a pace string from a pace in seconds/500m, '1:45.4'
|
||||
def format_pace(x,pos=None):
|
||||
if isinf(x) or isnan(x):
|
||||
x=0
|
||||
@@ -24,6 +26,7 @@ def format_pace(x,pos=None):
|
||||
|
||||
return str1
|
||||
|
||||
# Returns a time string from a time in seconds
|
||||
def format_time(x,pos=None):
|
||||
|
||||
|
||||
@@ -37,11 +40,13 @@ def format_time(x,pos=None):
|
||||
|
||||
return str1
|
||||
|
||||
# Formatting the distance tick marks
|
||||
def format_dist_tick(x,pos=None):
|
||||
km = x/1000.
|
||||
template='%6.3f'
|
||||
return template % (km)
|
||||
|
||||
# Formatting the time tick marks (h:mm)
|
||||
def format_time_tick(x,pos=None):
|
||||
hour=int(x/3600)
|
||||
min=int((x-hour*3600.)/60)
|
||||
@@ -49,6 +54,11 @@ def format_time_tick(x,pos=None):
|
||||
template='%d:%s'
|
||||
return template % (hour,min_str)
|
||||
|
||||
# Utility to select reasonable y axis range
|
||||
# Basically the data range plus some padding, but with ultimate
|
||||
# you can set the slowest paces to fall off the axis.
|
||||
# Useful for OTW rowing where you sometimes stops and pace runs out of
|
||||
# the boundaries
|
||||
def y_axis_range(ydata,miny=0,padding=.1,ultimate=[-1e9,1e9]):
|
||||
|
||||
# ydata must by a numpy array
|
||||
@@ -86,6 +96,7 @@ def y_axis_range(ydata,miny=0,padding=.1,ultimate=[-1e9,1e9]):
|
||||
|
||||
return [yrangemin,yrangemax]
|
||||
|
||||
# Make a plot (this one is only used for testing)
|
||||
def mkplot(row,title):
|
||||
df = row.df
|
||||
|
||||
|
||||
Reference in New Issue
Block a user