Browse Source

Force fs to be a float in sfit4

tags/nilmtools-1.1.7
Jim Paris 8 years ago
parent
commit
979ab13bff
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      src/sinefit.py

+ 2
- 2
src/sinefit.py View File

@@ -157,7 +157,7 @@ def sfit4(data, fs):
(Verified to match sfit4.m)
"""
N = len(data)
t = linspace(0, (N-1) / fs, N)
t = linspace(0, (N-1) / float(fs), N)

## Estimate frequency using FFT (step b)
Fc = fft(data)
@@ -182,7 +182,7 @@ def sfit4(data, fs):
i = arccos((Z2*cos(ni2) - Z1*cos(ni1)) / (Z2-Z1)) / n

# Convert to Hz
f0 = i * fs / N
f0 = i * float(fs) / N

# Fit it. We'll catch exceptions here and just returns zeros
# if something fails with the least squares fit, etc.


Loading…
Cancel
Save