Commit Graph

84 Commits

Author SHA1 Message Date
Mark Liversedge
495dff77ca Generic Chart Slope Paint
.. full for scatter, in selection rect for line. Seems a compromise
   between providing useful context on a scatter and avoiding lots of
   noise on a line chart.
2020-03-09 21:03:56 +00:00
Mark Liversedge
35a37ff846 Add QT Charts to R Chart
.. mostly complete, following the Python charts lead on the
   API and basic UX.

.. some nits left in there; pie/bar chart categories and labels
   and an open question on whether/how we let users set the axis
   color / leave it alone.
2020-03-09 19:40:17 +00:00
Ale Martinez
a7debe567b Change Python and R season meanmax to honor left sidebar filters
Fixes #3369
2020-03-08 16:10:54 -03:00
Ale Martinez
d2c2085741 Fixes R GC.activity when the data frames list don't match the activities list
The names attribute length must be equal to the vector size
Fixes #2542
2019-05-21 20:36:17 -03:00
Ale Martinez
3902405feb R activityXData - no need to recompute derived series 2018-05-04 17:17:33 -03:00
Ale Martinez
434c15ad50 Add R GC.activity.xdata(name="", compare=FALSE)
When name="" returns a list of XData series names present
When name is an XData series present return a dataframe with vectors for:
time, distance and each valuename
with a row for each XData sample.
Implements #2847
2018-05-04 16:21:36 -03:00
Ale Martinez
17dbb48fc4 Add R activity.intervals
Fixes #2848
2018-04-30 23:25:30 -03:00
Mark Liversedge
d9349150f6 Deprecate R scripts in DataFilter/UserMetric
.. since the R interpreter doesn't support multithreading* and this
   is needed for metric computation

   * we could get around this with IPC/signals but decide it was not
     worth the coding effort and maintenance overhead.
2018-04-08 17:09:49 +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
Mark Liversedge
ef68066f7f Don't bug user if R/Python not compatible
.. most users don't care and will freak out.

.. also set PYTHONHOME if user specified (this helps users on
   MacOS use their local modules).
2018-02-15 15:10:30 +00:00
Mark Liversedge
8e5e95bfe4 R setup graphics device before install routines
.. because we also call par() to get the default
   settings for the graphics device and when none
   exists it creates a default one.
2018-02-05 13:18:54 +00:00
Mark Liversedge
56335c13ef R check version before loading
.. If built with R > 3.4 we need >3.4 installed
.. If built with R < 3.4 we need <3.4 installed
.. will also disable in prefs if can't load
2018-02-05 12:00:44 +00:00
Mark Liversedge
4ce070f4c9 R Don't create GreaphicsDevice till all initialised
.. trying to reduce the number of crashes.
2018-02-04 09:48:01 +00:00
Mark Liversedge
a82c3b93a6 DataFilter embed R Scripts
.. similarly to embedding python when computing metrics

.. exactly the same semantics, although R isn't fussy
   about whitespace.

.. and example metric might be:

   {
        value { %%R GC.result(19) %%; }
   }

.. the interpreter is protected with a mutex which means
   R programs will never run in multiple threads. This has
   a performance penalty, but then using R for metrics is
   likely to be rather specialised anyway.
2018-01-29 14:05:49 +00:00
Alejandro Martinez
b984c340ba Refactor Measures
Part 5 of #2588
- BodyMeasures code in Athlete was moved to BodyMeasures class in Core
- HrvMeasures code in Athlete was moved to HrvMeasures class in Core
- Both implement the Abstract Base Class MeasuresGroup which provides uniform
  access to measures
- Class Measures consolidate access to Body/Hrv Measures
- Body/Hrv measures file is accessed for only one place
- Names/Symbols for Body/Hrv measures are defined only once
2017-11-19 00:14:26 -03:00
Alejandro Martinez
646c3ca1ad Access to Daily Measures from R
measures(all=FALSE, group="Body"), returns a data frame with the fields
of the specified measures group (currently "Body" and "Hrv" are supported)
and a row for each day on the current selected date range if all=FALSE or
the whole range of available data if all=TRUE.
Part 3 of #2588
2017-11-06 15:47:09 -03:00
slorenz
efb2a3c2e2 Enable powerzones for "run" in R.
This resolves #2521
2017-05-20 13:37:01 +02:00
Mark Liversedge
f3f2462ff4 Fix R Embed Version 3.4 Crash
.. the call methods structure changed at v3.4.0 of R
   which means when you register routines you should
   pass the correct structure.

.. this can only be determined at runtime when the R
   dynamic library is loaded.
2017-05-03 13:20:29 +01:00
Mark Liversedge
ed21fb7d8a Embedded R Tweaks
.. Hi-dpi support fixes use of OpenGL acceleration
.. Added a bit of debug on startup (when GC_WANT_ALLDEBUG is set)
2017-05-01 08:40:06 +01:00
Mark Liversedge
f0d6692c65 R 3.4.0 Support
.. the C runtime declarations changed in R-base which broke
   the RTool.cpp build.

.. fixed up to support 3.4.0 onwards with new structure whilst
   still working for earlier versions.
2017-04-22 22:37:30 +01:00
slorenz
ef55c7c4c1 Provide zoneslow and zonescolor in GC.athlete.zones(). 2017-04-15 19:22:36 +02:00
Joern
dba6f6f1af Fix Static Code Check results
... incomplete class initialization
... duplicate if statements
... typos in objects names (copy&paste) (AllPlot)
... missing else (CPPlot)
... missing DELETEs for objects (only if obvious that object is not used somewhere else)
... copy&paste errors (e.g. ModelPlot)
... small floats instead of integer evaluating to 0
... potential SEGV since pointer is not checked for NULL
... misleading code formatting (hard to read) in *zones.cpp
2017-03-23 20:07:09 +01:00
Mark Liversedge
db599e3998 R XDATA columns replace ' ' with '_'
.. as variables with a space in them are not very useful.
2017-02-05 21:30:58 +00:00
Mark Liversedge
d4f9e7ba26 R GC.season.intervals() honour type=
.. the type parameter was being ignored (it wasn't
   implemented at all.

.. now you can do:

   hills <- GC.season.intervals(type="CLIMBING")
   peakpower <- GC.season.intervals(type="PEAK POWER")
   all <- GC.season.intervals()
2017-01-16 16:16:16 +00:00
Mark Liversedge
ed9724b920 R season intervals use short type desc
.. its easier to filter on short words !
2017-01-15 19:43:14 +00:00
Mark Liversedge
85f216d6b5 R GC.season.intervals(type=, compare=)
.. get a dataframe of intervals and their metrics for an entire season.
2017-01-15 18:45:25 +00:00
Mark Liversedge
73cc509d40 R Chart GC.size() and Default Page Size
.. you can query the window size with GC.size(), it will return a vector
   if 2 integers for width and height.

.. the default page size is no longer 500x500 instead it defaults to the
   size of the chart

.. if you do choose a size it is scaled to the window size, but keeps
   the original aspect ratio -- so setting the chart size can be
   useful to ensure the chart has a particular aspect ratio.
2017-01-08 13:34:06 +00:00
Mark Liversedge
e98b1666c5 R GC.season.metrics() returns special fields
.. like workout_code and sport, which were ommitted
   previously and are rather useful!
2017-01-02 11:38:37 +00:00
Mark Liversedge
5769f4b0ff R GC.season.MeanMax includes Dates
.. so you can cross reference the MMP data to other metrics
   by match/merge on date.
2016-12-07 01:01:14 +00:00
Mark Liversedge
e56cffd240 RideFile::NA -> NA_REAL for R chart
.. translate from RideFile::NA values to R NA values
   when putting xdata into an activity data.frame.
2016-07-26 09:38:25 +01:00
Mark Liversedge
a57f366de5 Add XDATA to R:GC.activity()
.. get access to XDATA to work with it in R
2016-07-23 12:17:05 +01:00
Mark Liversedge
b7ff1d37c8 R version number fix
.. wasn't being captured properly in About > Version
2016-06-14 17:55:07 +01:00
Mark Liversedge
3de86fbf5b R Fix SEGV on GC.activity if empty
.. if the workout has no data to return, then don't
   return null in dfForActvity, return an empty list.
2016-05-27 22:52:26 +01:00
Mark Liversedge
893b5d659e R Fix GC.activity(split=)
.. you can now fetch activities as a list and split them
   based upon gaps in recording (recording anomalies).

.. this is to support trackeR; data should already be cleaned
   by the user, but thats not always the case (!)
2016-05-27 19:23:54 +01:00
Mark Liversedge
54b14a796a R GC.activity(split=)
.. but disabled due to a strange malloc error, which is likely
   to be related to the R garbage collector.
2016-05-27 18:42:00 +01:00
Mark Liversedge
2a51d875df R Interrupt Long Running Script with ESC
.. as users would expect in RStudio etc
2016-05-27 11:15:23 +01:00
Mark Liversedge
a6f328c459 R Use List not Pairlist (Part 2 of 2)
.. completes the updates to RTool.cpp

.. as predicted by forming the pmc data.frame via an S3
   list instead of a pair list the merge() function works
   properly and column names are retained.
2016-05-26 21:19:52 +01:00
Mark Liversedge
c27f246bd4 R Use List not Pairlist (Part 1 of 2)
.. we should use a list not an old pair list when constructing
   lists and data.frames.

.. to ensure better compatibility with coercion functions in R
   and also possibly to resolve known issues with merge()

.. this is part 1 of 2, breaking up the mass changes to the many
   data wrangling functions in RTool.cpp

.. it also contains an update to RLibrary to resolve the functions
   used when working with lists (SET_VECTOR_ELT).
2016-05-26 19:53:53 +01:00
Mark Liversedge
678272c5d6 R don't create a data.frame of data.frames !
.. R doesn't like this, but we only did it when returning
   multiple activitieis in GC.activity() when passing activity=
   with a list / vector.
2016-05-26 14:39:44 +01:00
Mark Liversedge
0ff65ef49f R athlete.zones(date=..., sport=...)
.. so you can get the config for a specific date
2016-05-22 13:04:00 +01:00
Mark Liversedge
b8db0fc2f3 R GC.athlete.zones()
.. returns a dataframe of all zone config
2016-05-22 12:07:21 +01:00
Mark Liversedge
cb0f60c7d4 R Add filter="..." to metrics, meanmax and peaks
.. the ability to apply a datafilter to the data retrieved
   is extended to the season.metrics, season.meanmax and
   season.peaks methods

.. this helps to let GC filter out e.g. power data is present
   before we do anything in R since GC is faster and it also
   reduces the data being passed back etc.
2016-05-21 20:18:09 +01:00
Mark Liversedge
2dd4ec1693 Fix MeanMax Computation trailing Zero
.. clean it up, rather than resolve source (there is still a
   problem in there somewhere).

.. at least now interval plots and model fits aren't skewed
   by a trailing zero value
2016-05-21 10:38:49 +01:00
Mark Liversedge
3edac33e26 R save/restore all graphical parameters
.. par.default has all default values
.. par.gc is default updated to include theme

.. par(par.gc) is called before every plot
2016-05-21 09:40:06 +01:00
Mark Liversedge
23a1b63293 R Fix rownames in GC.activity(activity=...)
.. make a well formed data.frame.
2016-05-18 17:36:38 +01:00
Mark Liversedge
f7a6efc085 R GC.activity(activity=...)
.. You can now specify which activity to retrieve by passing
   a POSIXct date time representing the start time of the ride

.. this is mostly useful when used in conjunction with
   GC.activities(filter=...) to select ride dates.
2016-05-18 17:01:15 +01:00
Mark Liversedge
bfff3c46ab R GC.activities(filter="")
.. allow user to pass a data filter to evaluate when getting
   a list of activities.

.. e.g. GC.activities('Workout_Code = "1L2")
   will get a list of activity start times where the workout
   code is 1L2.
2016-05-18 14:41:22 +01:00
Mark Liversedge
4038494ed6 R API honour search/filter in use
.. when returning values we honour whatever filter is active
   at the time from home sidebar or the search box

.. it is applied regardless of which view the chart is on.
2016-05-18 13:13:41 +01:00
Mark Liversedge
38730e05b0 R GC.athlete() extends
.. to include more details and render the athlete.home()
   function unneccessary.
2016-05-15 17:25:21 +01:00
Mark Liversedge
e09a943835 R Version Fixup
.. get runtime version loaded and show on crash dialog and console
   since the runtime may be different from compile time as it is
   now dynamically loaded.
2016-05-14 09:10:46 +01:00