Commit Graph

17 Commits

Author SHA1 Message Date
Mark Liversedge
96144d588c Fix crash on 'dodgy' .man file in v3
This is a fix for bug 205 which is registered against v2.1 but
is also present in v3. This fix will not be relevant for v2.1
since the cpi file has been replaced with the cpx file.
2011-08-02 02:05:32 +01:00
Mark Liversedge
cee3813566 Clean compile time nits
Lots of nitty fixups, largely for uninitialised temporary
variables.

I have left the use of boost::function and boost::bind in the
DownloadRideDialog alone, so it will vomit when compiled
with boost 1.46 and gcc 4.5 or higher. Will look into this
more carefully at a later stage.

I am working up to resolving issues identified from -pedantic next.
2011-05-12 22:12:36 +01:00
Mark Liversedge
073631346a Refresh CPX file when importing ride files. 2011-05-07 11:26:59 +01:00
Mark Rages
aad197764a Added comment explaining meanmax algorithm
Tweaked meanmax algorithm to limit the maximum window size
2011-05-05 01:33:47 -05:00
Mark Liversedge
d780719cf4 Mark Rages' Superfast Mean Max Computer
Mark Rages has developed a super fast and innovative
approach to identifying max-mean intervals. This
approach is 20% faster than the current approach and
importantly does not require "downsampling" of data
yielding much higher resolution for longer intervals.

The code has not been 'adjusted' to adopt QT style
containers (e.g. QVector) and uses malloc/free.

The primary innovations include:
* integrating the data series to reduce the operation
  for identifying an interval sum to a single subtract
  operation.

* Searching for max sum via a window-search rather
  than iterating over the entire series (divide / conquer)

Interestingly, now we have retained high resolution the
xPower algorithm still yields differing results to the
existing metric code. I have contacted Sean to get some
insight into why this might be the case, but suspect it
is related to the implementation of the xPower 25s EWMA.

Tip o' the hat to Mark Rages for this -- sometimes you
just have to accept that no matter how smart you think
you are, there are some folk who /really are/ smart!
2011-05-04 21:19:49 +01:00
Mark Liversedge
475078f548 Store pre-computed statistics as floats not longs
The .cpx file used unsigned long to reduce storage
requirements but lost precision. This patch migrates
to using floats, which in most cases are the same size.

One side effect of this update is that mean-max charts
for HR, Speed, Cadence no longer have a 'staircase' effect
and plot more smoothly.
2011-05-03 17:04:48 +01:00
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