W/KG fixup distribution/histogram

The w/kg ridefile cache was not quite right
for distribution charting.
This commit is contained in:
Mark Liversedge
2012-12-03 14:56:43 +00:00
parent ef8fd292c6
commit 2a2ef7ba08
4 changed files with 12 additions and 6 deletions

View File

@@ -61,8 +61,9 @@
// 39 18 Aug 2012 Mark Liversedge New metric LRBalance
// 40 20 Oct 2012 Mark Liversedge Lucene search/filter and checkbox metadata field
// 41 27 Oct 2012 Mark Liversedge Lucene switched to StandardAnalyzer and search all texts by default
// 42 03 Dec 2012 Mark Liversedge W/KG ridefilecache changes - force a rebuild.
static int DBSchemaVersion = 41;
static int DBSchemaVersion = 42;
DBAccess::DBAccess(MainWindow* main, QDir home) : main(main), home(home)
{

View File

@@ -171,7 +171,7 @@ class PowerHist : public QwtPlot
// discritized unit for smoothing
static const double wattsDelta = 1.0;
static const double wattsKgDelta = 0.1;
static const double wattsKgDelta = 0.01;
static const double nmDelta = 0.1;
static const double hrDelta = 1.0;
static const double kphDelta = 0.1;
@@ -179,7 +179,7 @@ class PowerHist : public QwtPlot
// digits for text entry validator
static const int wattsDigits = 0;
static const int wattsKgDigits = 1;
static const int wattsKgDigits = 2;
static const int nmDigits = 1;
static const int hrDigits = 0;
static const int kphDigits = 1;

View File

@@ -820,7 +820,11 @@ RideFileCache::computeDistribution(QVector<float> &array, RideFile::SeriesType s
array.resize(max-min);
foreach(RideFilePoint *dp, ride->dataPoints()) {
double value = dp->value(series);
double value = dp->value(baseSeries);
if (series == RideFile::wattsKg) {
value /= ride->getWeight();
}
float lvalue = value * pow(10, decimals);
// watts time in zone
@@ -1108,7 +1112,7 @@ void RideFileCache::doubleArray(QVector<double> &into, QVector<float> &from, Rid
{
double divisor = pow(10, decimalsFor(series)); // ? 10 : 1;
into.resize(from.size());
for(int i=0; i<from.size(); i++) into[i] = from[i] / divisor;
for(int i=0; i<from.size(); i++) into[i] = double(from[i]) / divisor;
return;
}

View File

@@ -38,7 +38,7 @@ typedef double data_t;
// arrays when plotting CP curves and histograms. It is precoputed
// to save time and cached in a file .cpx
//
static const unsigned int RideFileCacheVersion = 6;
static const unsigned int RideFileCacheVersion = 7;
// revision history:
// version date description
// 1 29-Apr-11 Initial - header, mean-max & distribution data blocks
@@ -47,6 +47,7 @@ static const unsigned int RideFileCacheVersion = 6;
// 4 02-May-11 Moved to Mark Rages mean-max function with higher precision
// 5 18-Aug-11 Added VAM mean maximals
// 6 27-Jun-12 Added W/kg mean maximals and distribution
// 7 03-Dec-12 Fixed W/kg calculations!
// The cache file (.cpx) has a binary format:
// 1 x Header data - describing the version and contents of the cache