diff --git a/components/LiveTrainingView.js b/components/LiveTrainingView.js
index b116381..30dcde4 100644
--- a/components/LiveTrainingView.js
+++ b/components/LiveTrainingView.js
@@ -20,6 +20,16 @@ function LiveTrainingView(props) {
const laps = (analysis.peaks.size / props.peaksPerLap).toFixed(1);
const totalMomentum = Math.trunc(analysis.totalMomentum * props.kgFactor / 10 / 60);
+ const toTimeStr = seconds => {
+ let minuteStr = String(Math.floor(seconds / 60));
+ if(minuteStr.length < 2)
+ minuteStr = "0" + minuteStr;
+ let secondStr = String(Math.floor(seconds % 60));
+ if(secondStr.length < 2)
+ secondStr = "0" + secondStr;
+ return minuteStr + ":" + secondStr;
+ }
+ console.log("Active", analysis.activeTime);
useKeepAwake();
return (
@@ -37,8 +47,8 @@ function LiveTrainingView(props) {
-
-
+
+
diff --git a/data_processing/DataAnalysis.js b/data_processing/DataAnalysis.js
index 87deed9..b632ac7 100644
--- a/data_processing/DataAnalysis.js
+++ b/data_processing/DataAnalysis.js
@@ -31,10 +31,11 @@ export default class DataAnalysis {
// active time
const newAverages = this.movingAverage.addVector(newDataArr);
this.activeMeasurements += newAverages.reduce((n, val) => {
- return n + (val >= analysisParameters.activeTimeThreshold);
- });
+ return n + ((val >= analysisParameters.activeTimeThreshold) ? 1 : 0);
+ }, 0);
+ console.log("data", newDataArr, "newAverages", newAverages, "reduction", this.activeMeasurements);
- // peaks
+ // peaks
const newPeaks = this.peakDetectorSimple.addVector(newDataArr);
this.allPeaks = this.allPeaks.concat(List(newPeaks));
@@ -52,7 +53,7 @@ export default class DataAnalysis {
this.analyzedUpToIdx = allMeasurements.size;
return {
peaks: this.allPeaks,
- totalTime: allMeasurements / analysisParameters.numMeasurementsPerSec,
+ totalTime: allMeasurements.size / analysisParameters.numMeasurementsPerSec,
activeTime: this.activeMeasurements / analysisParameters.numMeasurementsPerSec,
totalMomentum: this.aggregatedMomentum,
diff --git a/state/Reducer.js b/state/Reducer.js
index e364ea6..142804c 100644
--- a/state/Reducer.js
+++ b/state/Reducer.js
@@ -43,8 +43,8 @@ const INITIAL_SETTINGS = {
peakDetectorZScoreThreshold: 2,
peakDetectorZScoreInfluence: 0.1,
- activeTimeThreshold: 300,
- movingAverageWindowSize: 10*5,
+ activeTimeThreshold: 700,
+ movingAverageWindowSize: 10*3,
}
};