Compare commits

...

1 Commits

Author SHA1 Message Date
0cf2db6c5e Fix divide by zero in sinefit 2014-02-14 15:56:52 -05:00

View File

@@ -96,8 +96,11 @@ def process(data, interval, args, insert_function, final):
rows = data.shape[0] rows = data.shape[0]
# Estimate sampling frequency from timestamps # Estimate sampling frequency from timestamps
fs = (rows-1) / (timestamp_to_seconds(data[-1][0]) - ts_min = timestamp_to_seconds(data[0][0])
timestamp_to_seconds(data[0][0])) ts_max = timestamp_to_seconds(data[-1][0])
if ts_min >= ts_max:
return 0
fs = (rows-1) / (ts_max - ts_min)
# Pull out about 3.5 periods of data at once; # Pull out about 3.5 periods of data at once;
# we'll expect to match 3 zero crossings in each window # we'll expect to match 3 zero crossings in each window