Commit Graph

11 Commits

Author SHA1 Message Date
Mark Liversedge
48e8b26347 Histogram plot by zone for seasons
The recent update to plot histograms for seasons or other
date ranges did not support displaying by zone since the
cache did not contain zoned data. This patch fixes that
with an update to RideFileCache to pre-compute and to the
PowerHist class to retrieve and plot.

There are some minor issues that need to be addressed:

* Handling aggregation with different zone schemes

* Deciding which zone scheme to use for the bar labels
  when multiple differing schemes have been used within
  the date range selected.

* Showing a break down of time in zone by range i.e.
  how much time was spent at Threshold when CP was X
  as opposed to when it was Y (hint: do it like we
  currently display intervals when plotting a single
  ride).

* Refreshing the Time In Zone data in the .cpx file
  when CP/LTHR changes is not implemented.

The RideFileCache now checks the version of the cache to
determine if it needs to be refreshed -- so no need to
delete old .cpx files before running GC with this patch.
2011-05-03 16:26:40 +01:00
Mark Liversedge
b34ceaa182 Plot seasons / date ranges on Histogram Plot
The recent RideFileCache patches added functions to
pre-compute mean-max and distributions. This enabled
this patch to add plotting histograms for a date
range rather than a specific ride.

It supports all the same data series as before but will
allow you to select a season from a new combo box.

I have refactored a fair amount of the code, but kept the
original code in PowerHist as close to unchanged as I could
since I did not want to disturb existing functionality.

There is no support for Zoning historic data -- this requires
an update to the RideFileCache.
2011-05-02 19:39:39 +01:00
Mark Liversedge
820dc11d77 Ride Statistics performance improvements
The metric code for calculating NP was sub-optimal (actually
it was pretty crap). This patch improves the performance of
the calculation quite substantially (>50% improved).

Additionally, the critical durations code has been adjusted
to reduce the amount of work for long rides (>3hrs or more).
2011-05-02 10:33:58 +01:00
Mark Liversedge
35f52fdc9e Add xPower and Normalized Power to Critical Plot
The Skiba and Coggan metrics for xPower and NP
respectively can now be plotted on the CP curve.

There are two issues;
* Downsampling of data to 5s samples skews xPower's EWMA
* Setting scale to start at 30mins breaks the x-axis scale engine

Both issues need fixing, since the first skews xPower upwards and
the second suggests that xPower/NP are meaningful for durations
less than 30 minutes.

Fixes #307.
2011-04-28 23:51:55 +01:00
Mark Liversedge
1b144e4a2f Fix typo to get cadence CP chart back. 2011-04-27 21:29:23 +01:00
Mark Liversedge
fbee480a94 Fix CP calculation for files with sub-recIntSecs samples
Peak 1s - 5s critical heartrate was way off the charts and did
not represent the data within the ride file.

Almost certainly caused by the WKO+ file importer, or possibly
by the WKO+ files themselves. It is possible to have ride files
with samples that are shorter than recIntSecs, e.g. where the
recording sample rate is 1s you might see:

Time       HR
01:21:32.0 157
01:21:32.7 157
01:21:33.0 157

In this case there are two samples between 1:21:32 and 1:21:33 rather
than the expected one sample. The code to compute averages used the
duration and recIntSecs to determine the average. This patch now
maintains a count instead.

Fixes #319
2011-04-27 20:48:39 +01:00
Mark Liversedge
d47f7bde4b Fix CP curve only shows first 6 seconds bug
Many thanks to Gary Smith for helping to diagnose and fix
this error. It is caused by ridefiles that have a gap in
recording at the very start of the ride (i.e. the first
sample is > recIntSecs).

Hopefully this means the CP code is now robust. It is also
worth noting that after fixing the erroneous copy/paste
code in compute() it is now 5 times faster than the original
code and computes 5 times more data series.

Fixes #316.
2011-04-26 21:56:05 +01:00
Mark Liversedge
fc016360e9 Remove dumb cut/paste error that increased CP calc work. 2011-04-26 21:02:23 +01:00
Mark Liversedge
198cfc5d68 Fill in Gaps in recording when computing CP charts
The new implementation of CP calculation uses a different
approach to identifying critical power/cadence etc which
makes it sensitive to gaps in recording (it assumes all
samples are temporally contiguous).

This patch ensures the data series are pre-processed to
add 0 values for any gaps in recording -- it does NOT
try to smooth data, since there are tools available to
do this, and if the data as presented has gaps we will
not attempt to 'correct' them -- the user can do this
themselves.

It leaves ride data intact.
2011-04-26 20:28:57 +01:00
Mark Liversedge
26dd0d7316 Fix CP calculation crash
Fixes SEGV in RideFileCache caused by incorrect recIntSecs setting
for a ridefile. Other reported issues with high power values for
short intervals was data related and not a bug.

Fixes #314.
2011-04-25 16:44:16 +01:00
Mark Liversedge
1288c71999 Missed from previous commit. 2011-04-25 02:58:19 +01:00