diff --git a/ltsdb_json.py b/ltsdb_json.py index 4537dcb..b70a3b5 100644 --- a/ltsdb_json.py +++ b/ltsdb_json.py @@ -54,7 +54,8 @@ class LTS: data = self.data n = len(data) t_last = data[-1][0] - dt = (t_last - data[-5][0]) / 4 + dt = max((t_last - data[-5][0]) / 4, 1) + log.debug("dt = %s, n = %s", dt, n) k = math.log((t_last - data[0][0]) / dt / n + 1) for i in range(1, n): t_ideal = (math.exp(k * (n - i)/n) - 1) * (n * dt)