Commit Graph

67 Commits

Author SHA1 Message Date
Alejandro Martinez
fbae10f103 Avoid crash in CP chart when perspective is not set
This was reported at the forum and it is reproducible with
the supplied home-perspectives.xml, it was likely generated
by an older version, but lets get defensive just in case.
2022-09-05 12:39:08 -03:00
Mark Liversedge
b738038907 Trends view perspective filter
.. applies to all charts in the perspective, so you can create
   a perspective called "Running" and set the filter to "isRun"
   and all charts in the perspective will only show data from
   runs.

.. updated charts on Trends view to honor the perspective
   filter, as below:

   * Overview
   * Trends
   * User Chart
   * Treemap
   * Critical Power
   * R Chart
   * Python Chart
   * Histogram - for metrics
   * Summary - no change as deprecating shortly

.. renamed the HomeView to TrendsView in line with some of the
   other recent name changes. The class names were set over 10
   years ago and no longer reflect the UI concepts.

.. New signal: GcWindow::perspectiveChanged(Perspective *)

   When the chart is moved from one perspective to another, likely does
   not need to do anything on Analysis view, but on Trends view its
   quite likely the filter has changed, so refresh is needed.

.. New signal: GcWindow::perspectiveFilterChanged(QString)

   When the perspective filter is updated this signal is called but
   only on trends view since it doesn't really matter on Analysis
   from the charts point of view.
2021-07-08 15:17:14 +01:00
Alejandro Martinez
0ba409a192 CPPlot - Display model parameters in Pace units for Row
Missing from previous commits
2021-05-29 19:03:23 -03:00
Alejandro Martinez
773e5a21b0 Add Row to default sports and Pace Row (min/500)
Fixes #3892
2021-05-27 21:08:34 -03:00
Alejandro Martinez
3a07cc52d7 Generalize Power Zones for any sport
All sports defined as values for Sport metadata field can have
specifics Power Zones and default to Bike zones otherwise.
Similar to current power zones for Run.
Part 3 of #3280
2021-05-26 16:15:27 -03:00
Mark Liversedge
6486e89145 Fix show efforts on CP Plot
.. showEfforts was not being initialised when the plot was created
   which resulted in sustained efforts always being shown regardless
   of the chart setting.
2021-05-22 15:24:47 +01:00
Mark Liversedge
9a0b6e0bc7 qSort is deprecated, use std::sort
.. mostly straight replacement as qt5 containers are templated
   and qSort semantics are the same as std::sort

.. prepping for Qt6.2 which is due late 2021.

Signed-off-by: Mark Liversedge <liversedge@gmail.com>
2021-05-21 11:30:46 +01:00
Ale Martinez
cb37db2281 Export to CSV with UTF8 and ISO date format
For broader support of translations and date formats
Fixes #3613
2020-11-28 17:56:06 -03:00
Ale Martinez
5ef8817107 Move Pace units from athlete to general settings
Also change defaults to match metric/imperial for consistency.
Fixes #2253
2020-08-23 12:53:53 -03:00
Mark Liversedge
80d7eed382 RideMetadata and friends moved to GlobalContext
.. Ride metadata was associated to the athlete rather than a
   global setting. This was a serious design flaw since user
   metrics can reference metadata.

.. A global metadata.xml file is generated on startup by
   consolidating all athlete level settings into a single
   configuration.

.. Other dependencies were also moved; SpecialFields,
   ColorEngine and UseMetricUnits.

.. We should now be able to remove athlete configuration
   from the config dialog and put it into the athlete view
   instead.

   This will also fixe a long standing issue with
   configuring athlete settings when multiple athletes are
   open.

[publish binaries]
2020-08-21 19:01:37 +01:00
Mark Liversedge
33d5c1fe2b Cosmetic Updates
.. sorry, but the power profile colors are hardcoded (which is fine)
   but they are too dark, so fixed that up.

.. also the overview (until it is configurable) doesn't show total work
   or variability index. Which I've added as they are quite useful esp.
   work as a proxy for load and calories.
2020-04-19 14:42:36 +01:00
Ale Martinez
e06c93ca0e CPPlot - Show as percentage only applies to ride curve
Fixes #3260
2019-12-15 10:26:04 -03:00
Ale Martinez
beac898601 Fix units of work in tooltips for AllPlot and CPPlot
Also change wrong label in PMC (Coggan)
Fixes #3194
2019-10-21 21:56:05 -03:00
Mark Liversedge
8836252cdf CP plot show ride as power index
.. similar to showing as a percent of athlete best, this
   scales the ride mmp to percent of the average athlete.
2019-02-03 11:46:23 +00:00
Mark Liversedge
efb1a648f6 CP MMP Filter improvement
.. use powerIndex to select points when t > 120s. This has resulted
   in a much higher hit rate at finding performance tests in MMP
   data (almost 99% of the time).
2019-01-04 13:27:28 +00:00
Ale Martinez
7073fb0d09 CP Plot Tests honor sport settings
In Activities view we filter bests (and now tests) to match the
selected activity sport.
2018-12-04 15:49:47 -03:00
Mark Liversedge
a64c6f06d6 CP Plot Tests honor filter settings
.. when finding performance tests the filter settings for the
   chart need to be honored.
2018-12-02 10:12:15 +00:00
Mark Liversedge
0b4d46666d Model CP and W' decay in Morton Model
.. add option to apply a decay factor to CP and W' when plotting
   the model curve in CP Plot.

.. since we always fit to observations <20mins the mostly submax
   points at longer durations in the general population do not
   impact the fit at all.

.. the decay factors for w' and cp have been fit to the results of:

   Effects of Two Hours of Heavy-Intensity Exercise on the Power-
Duration Relationship
   Clark IE, Vanhatalo A, Bailey SJ, Wylie LJ, Kirby BS, Wilkins BW,
Jones AM.
   https://europepmc.org/abstract/med/29521722
2018-11-30 15:56:52 +00:00
Mark Liversedge
5f3486ebe5 CP Plot PD Profile W/KG
.. now need to tidy up chart labels.
2018-11-13 18:48:37 +00:00
Mark Liversedge
f60e28e801 CP Plot Power Profile Lines (watts only)
.. need a follow up for w/kg
2018-11-13 17:49:49 +00:00
Mark Liversedge
b5ed04b7c1 CP Plot show w/kg percentiles
.. should also add 3,7,12,20 concrete percentiles so can review
   regardless of model fit.
2018-11-03 19:21:27 +00:00
Mark Liversedge
9fb73099a9 CP Plot Percentiles for CP, W' and Pmax Estimates
.. using analysis from the opendata proejct we have now
   got a normal distribution for CP, W' and Pmax parameters.

.. so we can now plot the percentiles on the CP plot that the
   user's values sit in.
2018-10-27 11:47:15 +01:00
Ale Martinez
2787870c2c CPPlot force refresh when filters change, even if Date Range is the same
Previous behavior was annoying: filters s.t. sport were not applied
until date range changed.
2018-10-23 21:03:11 -03:00
Mark Liversedge
61cf324fa7 Fix units on CP plot work/time
.. performance test markers said "Unknown" for units when
   plotting work / time.
2018-09-23 11:01:17 +01:00
Mark Liversedge
143c10d9c0 CP Plot Helper Title for Work/Time
.. add "Work/Time" to model name when using an LR fit
   since we convert to joules.
2018-09-05 07:47:19 +01:00
Mark Liversedge
74fe950fc2 CP Plot Helper show model name
.. set the model overlay title to the full name of the
   model being used.
2018-09-04 21:55:51 +01:00
Mark Liversedge
dd4ff86da7 Fix last commit
.. it converted CPPlot::filterpower to work which
   of course then broke model fitting.
2018-09-01 18:53:02 +01:00
Mark Liversedge
6e91261502 CP plot filter best in Work/Time plot
.. not just when plotting power or w/kg
2018-09-01 18:22:17 +01:00
Mark Liversedge
2a6083071f LR Model Fit calculate R2
.. lots of folks understand what R2 means for a linear
   regression so calculate it alongside RMSE when we
   are performing a linear regression.
2018-08-25 07:47:23 +01:00
Mark Liversedge
9e5242a782 CP Plot fix y-axis for higher values of PMax
.. when model estimates for Pmax are higher than
   the bests data (e.g. when fitting to perf tests)
   then we need to adjust the y-axis to fit.
2018-08-23 19:33:29 +01:00
Mark Liversedge
1721064184 CP Chart Plots the Linear Work Time Model
.. so you can see how the parameter estimates look when plotted
   in work time.

.. this means parameter estimation and model visualisation are
   separated -- you can estimate CP/W' using the extended model
   and an envelope fit but visualise with the linear work model.
2018-08-23 09:10:32 +01:00
Mark Liversedge
8a64b65ebb Linear Regress for Work/Time Model Fit
.. add fitting option to fit CP2 model to points using
   a linear regress.

.. kinda ironic that the most common and straight forward
   method for estimating CP/W' is added so late.
2018-08-17 18:39:16 +01:00
Mark Liversedge
4f19f75ed1 Tidy Up CP Plot Overlay
.. remove FTP

.. CP first, then W' and Pmax
2018-08-17 10:15:57 +01:00
Mark Liversedge
7ff5a970df Disable WS/Velo models
.. the fit is wrong and need to look at that
   more closely.

.. in the meantime disabled in CPPlot.
2018-08-07 16:23:55 +01:00
Mark Liversedge
e07c8494f1 Text Labels on CP plot for Performance Tests
.. tooltips getting too tricky with so much being plotted
   and since there are so few perf tests a label should be ok.
2018-08-06 09:25:19 +01:00
Mark Liversedge
5455714a47 CP Plot Performance Test Aesthetics
.. honour interval color selected by user when plotting
   performance tests on the CP plot

.. performance test symbol size is enlarged if the test is
   within the currently selected ride (in activity view).
2018-08-05 23:01:42 +01:00
Mark Liversedge
a1635f075c Support Performance Tests for watts and watts/kg
.. in the CP plot and associated modelling functions.
2018-08-05 13:15:44 +01:00
Mark Liversedge
d4cb586850 CP Chart Modelling Improvements
.. CP plot modelling will fallback when insufficient data
   is available to model reliably, with a precedence:

      1. Performance tests
      2. Filtered MMP
      3. All MMP

.. when modelling for a single ride collect bests/performance
   data for the period up to that ride.

   This is so as you select older rides the model reflects the
   training status at that ride, not for the current period.

.. add adhoc season for 'Last 6 weeks' since it is a common
   timeframe to use when tracking impact of training
2018-08-05 12:31:11 +01:00
Mark Liversedge
c79565cbdd Better CP Plot Fit Summary
.. tell user what fit or data was used as there is a cascade back
   depending on the model selected and the availability of data.

.. the summary is also now in grey to indicate it is supplementary.
2018-08-03 12:14:39 +01:00
Mark Liversedge
54b161261e CP plot show info about fit
.. RMSE for now, just to get a basic sense

.. what type of fit was performed (since there is a fallback)

.. how many datapoints were used in the fit and RMSE calculation.
2018-08-02 21:30:24 +01:00
Mark Liversedge
1a7839d051 RideFile::watts is sufficient
.. don't need to fully quality RideFile::SeriesType::watts
2018-07-30 14:53:21 +01:00
Mark Liversedge
4437e94c9a CP fit to performances
.. add option to CP chart to fit model to marked performances.

.. works, but very crude UI - no warnings if not enough data and
   no constraints on combinations of model, fit and fit data that
   can be selected.

.. will tidy up over the next few days.
2018-07-30 13:22:21 +01:00
Mark Liversedge
061df5fc8d Plot performance tests on CP chart
.. as a first pass lets show the performance tests on the CP
   plot to get a sense of how any bests / models align to the
   results of our tests

.. we will look to fit to the tests using LMA in another commit.
2018-07-30 11:01:21 +01:00
Ale Martinez
e0a4330d30 Show model parameters on CPPlot for aPower and aPowerKg
Curve fitting was already enabled but parameters were not displayed
2018-07-06 20:14:49 -03:00
qheath
c8523a2716 various minor bugfixes + warningfixes (#2878)
* fix unclosed file descriptors

* remove various compiler warnings

sometimes it was only ambiguous indentation, sometimes bugs were fixed:

- forgotten `break;` instructions or `fallthrough` annotations:
  - src/ANT/ANTChannel.cpp
  - src/Charts/CriticalPowerWindow.cpp
  - src/Charts/MUPlot.cpp
  - src/Core/DataFilter.cpp
  - src/FileIO/RideFileCache.cpp
  - src/FileIO/RideFileCommand.cpp
  - src/Train/DialWindow.cpp
- forgotten braces:
  - lmfit/lmmin.c
  - src/FileIO/XDataDialog.cpp
- test on the wrong variables:
  - src/Gui/Pages.cpp
- wrong parenthesis
  - src/Charts/CPPlot.cpp
- missing macro argument
  - src/Cloud/WithingsDownload.cpp
- missing `return;` statement
  - src/Cloud/Xert.cpp
- unused variables
  - src/Gui/DiarySidebar.cpp
- unclear indentation
  - src/Core/RideItem.cpp
  - src/FileIO/BinRideFile.cpp
  - src/Metrics/PaceZones.cpp
  - src/Metrics/RideMetadata.cpp
  - src/Metrics/Zones.cpp

* remove unnecessary Leaf::Parameters enum value from data filters

lists of parameters don't exist as such outside of the parser, and have
no business using the same type `Leaf` as complete terms anyway

* remove unnecessary argument

`leaf1.print(leaf2,...)` would print `leaf2` and completely ignore
`leaf1`, so now `leaf2.print(...)` is used instead
2018-05-30 13:33:02 +01:00
Mark Liversedge
ba9bab3993 Add Least-Squares fit to CP Chart - 1 of 2
.. adding an option to select least squares fit to the cp
   chart, in addition to the existing envelope fit.

.. additionally, if filter bests option has been selected
   the least squares fit will use these points rather than
   all the points (since well over 95% will be submaximal).

.. It requires the lmfit library to be available - and this
   has been an non-optional install for over a year - we
   just haven't used it prior to this commit.

.. Each PD model needs to implement three functions to enable
   the least squares fit to work:

   * int nparms() - returns the number of parameters
   * double f(double t, double *parms) - parametric function
   * bool setParms(double *parms) - set the parameters post fit

.. This commit implements it for CP derivatives;
   * Classic CP - 2 parameter model
   * Morton 3 Parameter - 3 parameter model
   * GC Extended CP model - the extended model

   BUT: it is implemented and disabled for eCP for now until
        we can set parameter constraints correctly.

.. A second commit is needed for the remaining models from
   Ward Smith and Mike P. This should also show which of the
   filtered points have been used for curve fitting on the
   chart (maybe a different color)
2018-05-20 18:40:51 +01:00
Mark Liversedge
49d78e6c7b Remove TrainingPeaks Trademarks
.. renaming the 3 metrics they trademarked in 2013:

   TSS => BikeStress
   IF => BikeIntensity
   NP => IsoPower

.. this will break data filters, user formula and
   R and Python charts.

.. in the next commit will add user metrics to ensure
   backward compatibility.
2018-02-17 11:12:50 +00:00
Walter
7db994606b Use logarithmic scale for speed chart, like CS 2017-12-29 18:28:49 +01:00
Mark Liversedge
e9b8ee64cb Merge branch 'master' into kr-warnings-2017-0418 2017-07-16 10:10:07 +01:00
Mark Liversedge
81ceb65ddd Hi-DPI Support some nits
.. ride navigator color

.. column chooser button size and fonts.
2017-05-11 17:58:11 +01:00