mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 00:28:42 +00:00
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")
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#include <QString>
|
|
#include "RideFile.h"
|
|
|
|
#undef slots
|
|
#include <Python.h>
|
|
|
|
|
|
class PythonDataSeries {
|
|
|
|
public:
|
|
PythonDataSeries(QString name, Py_ssize_t count);
|
|
PythonDataSeries(PythonDataSeries*);
|
|
PythonDataSeries();
|
|
~PythonDataSeries();
|
|
|
|
QString name;
|
|
Py_ssize_t count;
|
|
double *data;
|
|
};
|
|
|
|
class Bindings {
|
|
|
|
public:
|
|
long threadid() const;
|
|
QString athlete() const;
|
|
long build() const;
|
|
QString version() const;
|
|
|
|
// working with data series
|
|
bool seriesPresent(int type) const;
|
|
int seriesLast() const;
|
|
QString seriesName(int type) const;
|
|
PythonDataSeries *series(int type) const;
|
|
|
|
// working with metrics
|
|
PyObject* activityMetrics(bool compare=false) const;
|
|
PyObject* seasonMetrics(bool all=false, QString filter=QString(), bool compare=false) const;
|
|
PythonDataSeries *metrics(QString metric, bool all=false, QString filter=QString()) const;
|
|
|
|
// working with the web view
|
|
int webpage(QString url) const;
|
|
|
|
private:
|
|
// get a dict populated with metrics and metadata for an activity
|
|
PyObject* activityMetrics(RideItem* item) const;
|
|
// get a dict populated with metrics and metadata for activities in Date Range passing filter
|
|
PyObject* seasonMetrics(bool all, DateRange range, QString filter) const;
|
|
|
|
};
|