Commit Graph

11 Commits

Author SHA1 Message Date
Alejandro Martinez
ae6d00103e Python metrics(metric, all, filter)
A more efficient way to obtain a metric series for a large number
of activities, it can be converted to numpy array without copy:
import numpy as np
nparray = np.asarray(GC.metrics("Average_Power", True, "isRun=0 && isSwim=0")
2017-12-15 11:56:55 -03:00
Alejandro Martinez
eae7f1d9ed Add Python seasonMetrics(all, filter, compare)
Similar to R API season.metrics
2017-12-14 17:30:32 -03:00
Alejandro Martinez
9a48237543 Make PythonDataSeries independent of RideFile
To reuse it for other double series s.t. metrics or mean maximal data
2017-12-13 11:52:08 -03:00
Alejandro Martinez
a3e23fd6de Enabled compare for Python activiyMetrics
activityMetrics(True) returns a list of 2 element tuples with
metrics&metadata dict as first element and color name as second one.
2017-12-12 21:29:39 -03:00
Alejandro Martinez
a15bcfc102 Python activityMetrics
Returns a Python dict with metrics and metadata fields.
It doesn't implement compare mode yet.
2017-12-12 08:35:06 -03:00
Mark Liversedge
7eb926b33a Python Web Display
.. instead of an opengl canvas lets start with a Web canvas.

.. we might have options to use QtCharts or OpenGL later.

.. not working - committed to save WIP.
2017-12-11 18:58:59 +00:00
Mark Liversedge
76eaecab5a Fixup Py_ssize_t on Windows VS build
.. Py_ssize_t is not always a long, so lets use the python
   type in our bindings to keep the buffer code simple.
2017-12-09 19:08:00 +00:00
Mark Liversedge
2a5fcfe5db Python DataSeries functions
.. start of API to work with ride data, exposing the raw
   sample data via the buffer protocol python api and SIP

.. adds utility functions that will ultimately be wrapped
   inside a python class/function:

   GC.series(n) - return series data as a python array
   GC.seriesName(n) - return string describing series data
   GC.seriesLast() - returns int for last series type
   GC.seriesPresent(n) - returns True if series in ride

.. example of using these functions in python to create a
   dict object collecting all available data:

   activity = {}
   for x in range(0, GC.seriesLast()):
      if (GC.seriesPresent(x)):
         activity[GC.seriesName(x)] = GC.series(x)
2017-12-09 16:50:29 +00:00
Mark Liversedge
3a534e1ff4 Python GC.build() and GC.version()
.. simple examples, lots of generated code changes which is
   not very helpful.

.. but the only files that were edited by hand are goldencheetah.sip
   Bindings.h and Bindings.cpp
2017-12-05 19:23:38 +00:00
Mark Liversedge
db3d119f7d Python GC.athlete()
Basic proof of concept for CPP binding using SIP but with
our own type conversion (to avoid overhead of SIP lib/deploy).
Its far from perfect but will serve as a starting point.

.. needed to fixup type conversion in goldencheetah.sip to
   convert returning QString as PyUnicode

.. needed to fixup passing context when multi-threaded

.. needed to fixup Bindings.h/cpp to offer new API
2017-12-04 15:20:43 +00:00
Mark Liversedge
00144effd8 Python Module Framework
.. Using SIP thats used in PyQt et al we have a module
   called `goldencheetah' which includes bindings.

   Currently there is only a single method `getValue()'
   that returns 1. It's to get the basic plumbing in place.

   src/Python/SIP contains all the files related to the
   module. The cpp files are generated by the `sip' utility
   which will need to be available if you want to work on the
   bindings. Run make -f Makefile.hack to regenerate the cpp
   files if you edit them.

   I prefer to distribute the generated files at this point
   whilst development occurs. We may change that at a later
   date.

.. Please note that the gcconfig.pri.in file has changed as
   we now include the python include path rather than set a
   macro for the include directive (See PYTHONINCLUDES in
   gcconfig.pri.in)

.. lastly, to test this is working in a python chart console:
   > print(GC.getValue())
   1
   >
2017-12-02 16:33:54 +00:00