Rider class example

Import the necessary library


In [ ]:
%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

from skcycling.data_management import Rider

Load the data from rider

The rider data can be loaded from pickles files.


In [ ]:
filename = '../../data/rider/user_5.p'

my_rider = Rider.load_from_pickles(filename)

print 'This rider has {} rides.'.format(len(my_rider.rides_pp_))

Data plotting

The record power-profile as well as each ride power-profile can be shown easily.


In [ ]:
plt.figure(figsize=(14, 10))

for rpp in my_rider.rides_pp_:
    t = np.linspace(0, rpp.max_duration_profile_, rpp.data_.size)
    plt.plot(t, rpp.data_)
    plt.ylabel('Power in watt (W)')
    plt.xlabel('Time in minute (min)')

plt.show()

In [ ]:
plt.figure(figsize=(14, 10))

# Force to compute the record power-profile
my_rider.compute_record_pp()

t = np.linspace(0, my_rider.max_duration_profile_, my_rider.record_pp_.data_.size)
plt.plot(t, my_rider.record_pp_.data_)
plt.ylabel('Power in watt (W)')
plt.xlabel('Time in minute (min)')

plt.show()