Commit Graph

10086 Commits

Author SHA1 Message Date
Mark Liversedge
d568dd0e06 Linux build error (Another Voronoi fixup)
.. apologies, working on multiple platforms at once is a pain.

   will refactor the Steven Future code into its own C++ class
   in the next few days.
2021-09-28 23:02:01 +01:00
Mark Liversedge
dfdf0c5898 Fixup last commit linker error (Future's algorithm)
.. last commit introduced a compiler error on missing global variables.

   the intention here is to take future's algorithm, embed into a class
   and add wrappers for user charts / datafilters.
2021-09-28 20:00:22 +01:00
Mark Liversedge
53ee8f358c Future's Algorithm
.. for calculating Vornoi diagrams.
2021-09-28 19:28:42 +01:00
Mark Liversedge
4c720884b6 DataFilter - kmeans()
.. kmeans(centers|assignments, k, dim1, dim2 .. dimn)

   perform a k means cluster on data with multiple dimensions
   and return the centers, or the assignments.

   the return values are ordered so they can be displayed
   easily in an overview table e.g.

   values {
       kmeans(centers, 3, metrics(TSS), metrics(IF));
   }

.. will look at how we might plot these in charts with either
   color coding of points or perhaps voronoi diagrams.
2021-09-28 17:31:09 +01:00
Mark Liversedge
4c6c8e6d71 Additional Windows fixups for Fast Kmeans
.. std::max needs <algorithm> and don't need <unistd> at all.
2021-09-28 11:45:34 +01:00
Mark Liversedge
5fb2dfb73e Fast Kmeans on Windows
.. remove unused general functions that work with memory and time
   in a non-portable way.
2021-09-28 11:35:32 +01:00
Mark Liversedge
1dc1cd678f Fast Kmeans Algorithm
.. with grateful thanks to Greg Hamerly

   A fast kmeans algorithm described here:
   https://epubs.siam.org/doi/10.1137/1.9781611972801.12

   The source repository is also here:
   https://github.com/ghamerly/fast-kmeans

   NOTE:

   The original source has been included largely as-is with
   a view to writing a wrapper around it using Qt semantics
   for use in GoldenCheetah (e.g. via datafilter)

   The original source included multiple kmeans algorithms
   we have only kept the `fast' Hamerly variant.
2021-09-28 10:25:17 +01:00
Alejandro Martinez
a3c1f6d2fc Check for inconsistencies between Speed and Distance/Time in Editor
Only the first 10 examples are reported to avoid anomalies log flooding.
This anomalies can be easily fixed using Fix Speed from Distance tool
with moving average windows set to 1.
2021-09-21 18:45:42 -03:00
Mark Liversedge
fb76ecc33c pdf and cdf for Gamma distribution
.. its quite handy.
2021-09-20 21:27:44 +01:00
Mark Liversedge
8580a45c38 Datafilter pdf/cdf for normal and beta distributions
.. renamed pdf/cdf to pdfnormal and cdfnormal as they returned
   a pdf for a guassian.

.. added pdfbeta(a,b,x) and cdfbeta(a,b,x) for working with
   beta distributions.
2021-09-20 19:16:52 +01:00
Mark Liversedge
ca3a48c0bc Fixup cdf
.. should be monotonically increasing not decreasing.
2021-09-19 12:11:43 +01:00
Mark Liversedge
e26ab4f957 Datafilter - Gaussian Probability functions
.. pdf(x) and cdf(x) return the probability density function
   and cumulative density function for x.
2021-09-19 09:00:47 +01:00
Mark Liversedge
d97adfe987 Overview User Chart Export
.. save to .gchart when a user chart is on an overview.

   rather annoyingly the scaling is preserved which should
   ideally be defaulted on import depending upon context.
   we should fix that.
2021-09-18 19:11:57 +01:00
Mark Liversedge
65853b095d Overview Import Chart
.. Create a new tile on an overview by importing the XML .gchart.

   The importer checks the chart is a user chart and also that
   it was created for the current view (Analysis vs Trends).
2021-09-18 17:53:42 +01:00
Mark Liversedge
c592de6af9 Export Overview Data Table to CSV
.. via an "Export Data" button in the config dialog.
2021-09-17 14:01:08 +01:00
Mark Liversedge
e0892371b7 Overview respond to interval hovering
.. Data table and Interval Bubble generate and respond to
   interval signals like hover and select.

.. a compromise to help users navigate the data when it
   is not possible to clickthru for intervals

.. the data table now accepts a new function i {} which
   returns the names of the intervals for each row in
   a similar way to f {} for activities.
2021-09-14 17:55:59 +01:00
Mark Liversedge
6236611aee Interval time tweak
.. time_to_string is for formatting durations, so it will
   use as few characters as possible (e.g 10s, 1:00).

   since the interval time is a time of day we want the
   full hh:mm:ss format.
2021-09-14 09:17:07 +01:00
Alejandro Martinez
ea26efc44a Add intervals(time) to formula language
Fixes #4040
2021-09-13 18:48:42 -03:00
Mark Liversedge
60430fa97b Datafilter - match() should only return first match
.. all matches were being returned, which was not the documented
   behaviour, nor generally the desired result

   i.e.
   match(c(1,2,3), c(1,2,3,1,2,3,1,2,3));
   would return
   [ 0, 3, 6, 1, 4, 7, 2, 5, 8 ]
   but should have returned
   [ 0, 1, 2 ]

.. there are likely two things users would like to be able to
   control that could be added in the future:

   - match all occurences (this commit stops that now)
   - return NA or -1 for items that are note found
2021-09-13 22:03:39 +01:00
Mark Liversedge
437c38f959 Limit palette for a Heatmap color
.. hue goes red-yellow-green-cyan-blue-magenta-purple-red

   we only really want the first half of that range for our
   heatmap, which effectively makes it red-amber-green with
   cyan for very low numbers.

   As a palette it will make a lot more sense to the majority
   of users.

   We may look to add multiple schemes, for example limit to
   a single color range or brown/blue etc etc.
2021-09-13 17:05:11 +01:00
Mark Liversedge
08876a9065 Datafilter - metrics(time)
.. to get time of day for ride.
2021-09-13 15:57:12 +01:00
Alejandro Martinez
4d9367ed20 Add Time for the current activity to formulas
Part 1 of #4040
2021-09-12 20:06:26 -03:00
Mark Liversedge
dab1520e39 Overview Data Table scroll wheel
.. horrible nested scrolling- when in a data table and there
   are multiple rows any wheel event will scroll whilst the
   mouse cursor is over the table.

.. we do check that the mouse moved too, so if just scrolling
   with the mouse wheel it won't trigger until the mouse
   is moved (but most folks aren't that steady on the mouse!).
2021-09-12 14:48:56 +01:00
Mark Liversedge
be5f0b3d22 Datafilter - "vector1[indexes] <- vector2" fixup
.. if you assign to a vector using indexes it was only setting
   with a single value. But it should be possible to assign
   a vector and have it repeat

   e.g.
   a <- c(1,2,3,4,5,6);
   indexes <- c(3,4,5);
   a[indexes] <- c(9,10);
   # a now contains [ 1, 2, 9, 10, 9, 6 ]

.. also as part of the data table click thru, the highlight
   that a row can be clicked to navigate to the ride
   should only be shown if that row has a file name.

.. both fixups are related to listing PMC data in an overview
   data table and allowing click through for the rows that
   have a ride associated, the code looks like this:

   f {
       # find dates that contain rides
       ridedates <- metrics(date);
       pmcdates <- pmc(BikeStress,date);
       index <- match(ridedates, pmcdates);

       # returning all blanks for filenames
       # except where there is a ride on that date
       returning <- rep("", length(pmcdates));
       returning[index] <- filename();
       returning;
   }
2021-09-11 17:00:38 +01:00
Mark Liversedge
bd64625c05 Heat and Normalize
.. tweaking the names from the last couple of commits

   * to return heatmap values (between 0 and 1) the
   Data Table function "h" is now called "heat".

   * the data filter function that does the unity based
   normalization is renamed from "heat" to "normalize".

.. did this since normalize() is more accurate and
   will be more appropriate when adapting data to
   use other algorithms in the future.
2021-09-11 08:58:38 +01:00
Mark Liversedge
cb874b6793 Heat color on trends overview
.. activities legacy program reinstated and also sets the h {}
   function for the activity list.

.. the DataOverviewItem::setDateRange() method now calls h {}
   if it is present (forgot in last commit)
2021-09-10 21:05:55 +01:00
Mark Liversedge
2477096345 Overview Data table heat coloring
.. added a heat(min,max,value) data filter function to convert
   values to a heat value between 0 and 1

   e.g. heat(0,config(pmax),Average_Power)

.. added Utils::heatcolor(x) method to convert a heat value
   from 0-1 to a hue/saturation value color

.. the overview program now has another user definable function
   called h {} which returns the heat values. If it is not
   present no heat coloring takes place.

.. added h {} to the legacy intervals program, it adds the
   h {} function but calling heat() with 0 for min and max
   which ultimately makes it do nothing-- crucially the
   user can adapt the min and max values to meet their
   requirements
2021-09-10 14:45:49 +01:00
Mark Liversedge
f6375f18f9 Overview Table Header Line too thin
.. not sure when this changed, but makes the line disappear
   when so thin.
2021-09-09 10:38:49 +01:00
Alejandro Martinez
a6628eb447 Reposition Interval and Banister helpers when off window
This is already fixed when it is out to the right,
but still can happen to the left, continuation of b36bbdc
2021-09-08 12:43:59 -03:00
Mark Liversedge
e3e826a017 Blocks can be used as datafilter function parameters
.. mostly to make using the activities() function a lot
   simpler. A parameter can include a block of code that
   should be evaluated as a parameter.

   e.g:

   activities("isRun", { xx <- metrics(date);
                         yy <- metrics(Pace); } );

   this avoids having to declare a function and call it
   just so we can pass as a function parameter.
2021-09-04 17:31:31 +01:00
Alejandro Martinez
578a7fb263 Spanish Translation - Last update
Until errors are reported or new terms added.
2021-09-03 12:25:22 -03:00
Alejandro Martinez
41fbd9563a Spanish Translation - Partial Update 2021-09-02 23:20:00 -03:00
Mark Liversedge
d953b44c00 OverviewItemConfig Legacy Selector
..is only needed for configuring data tables.

Fixes #4031
2021-08-31 21:08:56 +01:00
grauser
32c7b68f43 Translation : lupdate translations/gc_fr 2021-08-31 18:01:01 +02:00
Mark Liversedge
4ddaa041a9 Don't process events when recreating user charts
.. it was always rather dodgy, but caused issues when charts
   recreated on config changed (like interacts badly with
   the setUpdatesEnabled() call.

.. has a nice effect of stopping the jarring repaints too
   which were horrible when themes changed.

Fixes #4029
2021-08-31 10:48:16 +01:00
Mark Liversedge
b5046f4be1 Fix Dark Theme Stress Balance
.. it was black, which wasn't the best choice against a
   dark background (!)
2021-08-30 10:11:11 +01:00
MaksVasilev
01beed8f46 Untraslated string
Fixed version of #4027
2021-08-28 13:04:42 -03:00
Mark Liversedge
d7c1b66b27 Overview Data table remember sort
.. so it gets reinstated after restart
2021-08-28 09:49:18 +01:00
Mark Liversedge
9b679a7d79 Clip data overview table painting
.. it looked nasty going all the way to the tile boundary.
2021-08-27 15:31:29 +01:00
Mark Liversedge
78850dabc3 ChartBar buttons match main toolbar
.. aesthetics adapted to have same feel.

.. the actual + icon had embossing in it (!)
2021-08-27 14:56:30 +01:00
Mark Liversedge
494e01ba7a DataOverviewItem legacy program on trends
.. added the legacy selector to trends view.
2021-08-27 12:08:08 +01:00
Mark Liversedge
5e516aefca DataFilter Aggregate helpers for metrics
.. aggmetricstrings() and aggmetrics()

   data filter functions that return aggregated values as
   opposed to all values for the activities.

.. asaggstrings()

   data filter function that returns aggregated values for
   the list of metrics provided (primarily used in data
   tables).

.. the next commit includes an update to the data table
   settings tool to use asaggstrings on trends view.
2021-08-27 12:07:37 +01:00
Mark Liversedge
e31f05236c Fix Overview Data table date sorting in German
.. and possibly other locales/language combinations
2021-08-27 09:45:20 +01:00
Mark Liversedge
13dc1059bc Python console perspective setting
.. use perspective property from the chart.
2021-08-26 13:54:50 +01:00
Mark Liversedge
ec46e545f5 User Chart and property "perspective" SEGV
.. lots of problems related to this, notably:

   * UserChart is no longer a GcWindow so doesn't have any
     properties registered.

   * Even if it was the property was not being registered
     by GcWindow or GcChartWindow anyway

   * The value was not being initialised so checking for
     NULL was kinda pointless (groan)

   * OverviewItems looked up the property and never found
     it, so crashes were avoided by accident.

.. One interesting point that was revealed during testing
   and debugging-- the UserChart program does not honor
   any filtering EXCEPT for the activity{ } function, which
   although it is not by design, is quite useful.

Fixes #4021
2021-08-26 13:46:44 +01:00
Mark Liversedge
1e480b6965 Less debug
.. last commit had some erroneous debug
2021-08-25 15:54:53 +01:00
Mark Liversedge
5e8e490e51 Datafilter powerindex(power,duration)
.. returns the powerindex for the given power and duration
   which can be vectors.

.. useful to transform meanmax power to strengths and
   weakness rating.
2021-08-25 15:52:55 +01:00
Mark Liversedge
fa296f7c13 Further update for UserChart scale crash
.. need to also add blocking around generic chart which
   can be called in different threads.

.. see previous commit for details.
2021-08-25 11:15:15 +01:00
Mark Liversedge
cc8b6b114d UserChart Scaling causes crash
.. when moving the scaling slider the charts get updated
   immediately, this causes a SEGV as charts are deleted
   whilst they are being updated.

.. we now block updates whilst critical processing is
   happenning to avoid this.

Fixes #4026
2021-08-25 09:48:44 +01:00
Mark Liversedge
73d28661fa User Chart support Stacked Percent Style
.. we now support percent stack bar charts, which are useful (and
   popular) for time spent in zone style charts.
2021-08-25 08:38:25 +01:00