Skip to content

Commit

Permalink
Shift interpolation curve slightly to fit better with morning measure…
Browse files Browse the repository at this point in the history
…ments.
  • Loading branch information
braniii committed Mar 18, 2024
1 parent 0de0b07 commit eaef33e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
3 changes: 0 additions & 3 deletions app/lib/core/measurementDatabase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,4 @@ class MeasurementDatabase {
Measurement.fromString(exportString: line)
];
}

/// offset of day in hours
static const int _offsetInH = 12;
}
9 changes: 6 additions & 3 deletions app/lib/core/measurementInterpolation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ class MeasurementInterpolation {
}

final int dateFrom = db.sortedMeasurements.last.measurement.dayInMs
- _dayInMs * _offsetInDays;
- _dayInMs * _offsetInDays + _dailyOffsetInHours;
final int dateTo = db.sortedMeasurements.first.measurement.dayInMs
+ _dayInMs * _offsetInDays;
+ _dayInMs * _offsetInDays + _dailyOffsetInHours;

// set isExtrapolated
_isExtrapolated = Vector.fromList(<int>[
Expand Down Expand Up @@ -382,7 +382,7 @@ class MeasurementInterpolation {
/// smooth weights with Gaussian kernel
Vector _gaussianInterpolation(Vector weights) => Vector.fromList(
<double>[
for (int idx in timesIdx)
for (final int idx in timesIdx)
(weights[idx] != 0)
? gaussianMean(times[idx], weights)
: 0
Expand Down Expand Up @@ -452,6 +452,9 @@ class MeasurementInterpolation {
/// offset of day in interpolation shown
static const int _offsetInDaysShown = 7;

/// offset of day in interpolation shown
static const int _dailyOffsetInHours = 8;

/// 24h given in [ms]
static const int _dayInMs = 24 * 3600 * 1000;
}

0 comments on commit eaef33e

Please sign in to comment.