Avoid division by 0
Not quite sure how that could happen but it did.
This commit is contained in:
parent
f272b1ba95
commit
0595c19de9
|
@ -54,7 +54,8 @@ class LTS:
|
||||||
data = self.data
|
data = self.data
|
||||||
n = len(data)
|
n = len(data)
|
||||||
t_last = data[-1][0]
|
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)
|
k = math.log((t_last - data[0][0]) / dt / n + 1)
|
||||||
for i in range(1, n):
|
for i in range(1, n):
|
||||||
t_ideal = (math.exp(k * (n - i)/n) - 1) * (n * dt)
|
t_ideal = (math.exp(k * (n - i)/n) - 1) * (n * dt)
|
||||||
|
|
Loading…
Reference in New Issue