Compare commits
2 Commits
nilmtools-
...
nilmtools-
Author | SHA1 | Date | |
---|---|---|---|
8ab31eafc2 | |||
979ab13bff |
@@ -67,7 +67,7 @@ def get_stream_info(client, path):
|
|||||||
|
|
||||||
class Filter(object):
|
class Filter(object):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self, parser_description = None):
|
||||||
self._parser = None
|
self._parser = None
|
||||||
self._client_src = None
|
self._client_src = None
|
||||||
self._client_dest = None
|
self._client_dest = None
|
||||||
@@ -78,6 +78,9 @@ class Filter(object):
|
|||||||
self.end = None
|
self.end = None
|
||||||
self.interhost = False
|
self.interhost = False
|
||||||
self.force_metadata = False
|
self.force_metadata = False
|
||||||
|
if parser_description is not None:
|
||||||
|
self.setup_parser(parser_description)
|
||||||
|
self.parse_args()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def client_src(self):
|
def client_src(self):
|
||||||
|
@@ -157,7 +157,7 @@ def sfit4(data, fs):
|
|||||||
(Verified to match sfit4.m)
|
(Verified to match sfit4.m)
|
||||||
"""
|
"""
|
||||||
N = len(data)
|
N = len(data)
|
||||||
t = linspace(0, (N-1) / fs, N)
|
t = linspace(0, (N-1) / float(fs), N)
|
||||||
|
|
||||||
## Estimate frequency using FFT (step b)
|
## Estimate frequency using FFT (step b)
|
||||||
Fc = fft(data)
|
Fc = fft(data)
|
||||||
@@ -182,7 +182,7 @@ def sfit4(data, fs):
|
|||||||
i = arccos((Z2*cos(ni2) - Z1*cos(ni1)) / (Z2-Z1)) / n
|
i = arccos((Z2*cos(ni2) - Z1*cos(ni1)) / (Z2-Z1)) / n
|
||||||
|
|
||||||
# Convert to Hz
|
# Convert to Hz
|
||||||
f0 = i * fs / N
|
f0 = i * float(fs) / N
|
||||||
|
|
||||||
# Fit it. We'll catch exceptions here and just returns zeros
|
# Fit it. We'll catch exceptions here and just returns zeros
|
||||||
# if something fails with the least squares fit, etc.
|
# if something fails with the least squares fit, etc.
|
||||||
|
Reference in New Issue
Block a user