Package sabx10 :: Package profiles :: Module plotter :: Class ProfilePlotter
[hide private]
[frames] | no frames]

Class ProfilePlotter

source code

object --+
         |
        ProfilePlotter

Generates a profile file.

Instance Methods [hide private]
 
_calc_most_least(self)
Go through the segments for the ride and find the longest segment, the lowest elevation, and the highest elevation.
source code
 
__init__(self, ride, graph_filebase, graph_dir, dpi)
Save the passed-in data and generate calculated instance data.
source code
 
_set_min_anno_dist(self, inch_width)
Calculate and set the min_ann_dist for the plot.
source code
float
_normalize_elevation(self, elevation)
Normalize an elevation in relation to the lowest elevation in the ride, such that the lowest elevation in the ride will be at an elevation of zero.
source code
 
_normalize_elevations(self, elevations)
Normalize all the elevations in the list.
source code
 
_plot_graph(self, distances, elevations, length)
Plot the graph of the distances and elevations.
source code
 
_filter_annotations(self, annotations)
Take the annotation list and remove annotations that are too close to the ones next to it, to prevent overlap.
source code
list of Annotation
_normalize_annotations(self, annotations)
Normalize the elevations of the annotation points.
source code
 
_plot_annotations(self, annotations)
Add the annotations to the current plot (if there are any).
source code
 
_plot_profile(self, distances, elevations, length, annotations)
Graph the distances, elevations, and annotations on the current plot.
source code
 
_save_profile(self, seg_index, size_name)
Save the current plot to a file.
source code
 
plot_small_profile(self, distances, elevations, length, seg_index='all', annotations=None)
Plot a small sized profile.
source code
 
plot_large_profile(self, distances, elevations, length, seg_index='all', annotations=None)
Plot a large sized profile.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
int dpi
resolution of profile file
string graph_dir
directory to write profile files into
string graph_filebase
base name for profile files
float highest
highest elevation
float longest
length of longest segment
float lowest
lowest elevation
float min_anno_dist
minimum distance between annotations
Ride ride
Ride to process
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, ride, graph_filebase, graph_dir, dpi)
(Constructor)

source code 

Save the passed-in data and generate calculated instance data.

Parameters:
  • ride (Ride) - Ride to process
  • graph_filebase (string) - base name for profile files
  • graph_dir (string) - directory to write profile files into
  • dpi (int) - resolution of profile file
Overrides: object.__init__

_set_min_anno_dist(self, inch_width)

source code 

Calculate and set the min_ann_dist for the plot. This is how far apart annotations need to be before they overlap.

Parameters:
  • inch_width (float) - width of profile, in inches

_normalize_elevation(self, elevation)

source code 

Normalize an elevation in relation to the lowest elevation in the ride, such that the lowest elevation in the ride will be at an elevation of zero.

Parameters:
  • elevation (float) - elevation to normalize
Returns: float
normalized elevation

_normalize_elevations(self, elevations)

source code 

Normalize all the elevations in the list.

Parameters:
  • elevations (list of float) - list of elevations to normalize

_plot_graph(self, distances, elevations, length)

source code 

Plot the graph of the distances and elevations. Fill-in under the graph based on the grade between points.

Parameters:
  • distances (list of float) - list of distances to plot
  • elevations (list of float) - list of elevations corresponding to the distances
  • length (float) - length of set of points being plotted

_filter_annotations(self, annotations)

source code 

Take the annotation list and remove annotations that are too close to the ones next to it, to prevent overlap.

Parameters:
  • annotations (list of Annotation) - list of annotations to filter

_normalize_annotations(self, annotations)

source code 

Normalize the elevations of the annotation points.

Parameters:
  • annotations (list of Annotation) - list of annotations to filter
Returns: list of Annotation
list of filtered annotations

_plot_annotations(self, annotations)

source code 

Add the annotations to the current plot (if there are any). Filter and normalize them first.

Parameters:
  • annotations (list of Annotation) - list of annotations to filter

_plot_profile(self, distances, elevations, length, annotations)

source code 

Graph the distances, elevations, and annotations on the current plot.

Parameters:
  • distances (list of float) - list of distances for the plot
  • elevations (list of float) - list of elevations for the plot
  • length (float) - overall length of plot
  • annotations (list of Annotation) - annotations for the plot

_save_profile(self, seg_index, size_name)

source code 

Save the current plot to a file.

Parameters:
  • seg_index (int) - index of segment being plotted
  • size_name (string) - size name being plotted

plot_small_profile(self, distances, elevations, length, seg_index='all', annotations=None)

source code 

Plot a small sized profile.

Parameters:
  • distances (list of float) - list of distances for the plot
  • elevations (list of float) - list of elevations for the plot
  • length (float) - overall length of plot
  • seg_index (int) - index of segment being plotted
  • annotations (list of Annotation) - annotations for the plot

plot_large_profile(self, distances, elevations, length, seg_index='all', annotations=None)

source code 

Plot a large sized profile.

Parameters:
  • distances (list of float) - list of distances for the plot
  • elevations (list of float) - list of elevations for the plot
  • length (float) - overall length of plot
  • seg_index (int) - index of segment being plotted
  • annotations (list of Annotation) - annotations for the plot