Commit baec4a1a authored by Oliver Kirsebom's avatar Oliver Kirsebom
Browse files

include height as input arg

parent 5b286216
......@@ -16,14 +16,15 @@ from ketos.data_handling.parsing import str2bool
ureg = UnitRegistry()
PeakFindingConfig = namedtuple('PeakFindingConfig', 'separation size multiplicity')
PeakFindingConfig.__new__.__defaults__ = (60, 3.0, 1)
PeakFindingConfig = namedtuple('PeakFindingConfig', 'separation size multiplicity height')
PeakFindingConfig.__new__.__defaults__ = (60, 3.0, 1, 0)
PeakFindingConfig.__doc__ = '''\
Configuration of peak finding algorithm
separation - Minimum temporal separation between neighboring peaks in seconds
size - Minimum peak height relative to baseline given in multiples of the signal standard devitation (float)
multiplicity - Minimum number of data series in which peak occurs'''
multiplicity - Minimum number of data series in which peak occurs
height - minimum absolute height of peak'''
SVMConfig = namedtuple('SVMConfig', 'nu kernel gamma degree training_data')
SVMConfig.__new__.__defaults__ = (0.01, "poly", 0.001, 2, "None")
......@@ -91,7 +92,9 @@ def parse_peak_finding_config(data):
size = float(d['prominence'])
if d['multiplicity'] is not None:
multiplicity = int(d['multiplicity'])
res = PeakFindingConfig(separation=separation, size=size, multiplicity=multiplicity)
if d['height'] is not None:
height = float(d['height'])
res = PeakFindingConfig(separation=separation, size=size, multiplicity=multiplicity, height=height)
return s, res
def parse_svm_config(data):
......@@ -199,7 +202,7 @@ def main():
cfg = configs['peak_finding_config']
time_res = extract_time_res(X)
dist = max(1, int(cfg.separation / time_res))
df['Peak Finding'] = detect_peaks(X, distance=dist, prominence=cfg.size, multiplicity=cfg.multiplicity)
df['Peak Finding'] = detect_peaks(X, distance=dist, prominence=cfg.size, multiplicity=cfg.multiplicity, height=cfg.height)
#====================
......@@ -270,7 +273,6 @@ def main():
if time_table != None:
df_tt = pd.read_csv(time_table)
df_tt = df_tt.sort_index(ascending=False, axis=0)
print(df_tt)
fnames = list()
times = list()
for t in df_out['time']:
......@@ -304,4 +306,4 @@ def main():
if __name__ == '__main__':
main()
\ No newline at end of file
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment