From 9e871c054ff8792b5a7fc25dd61b0b271746d68e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 19 May 2010 04:50:39 -0400 Subject: [PATCH] Success import and better peaks validation in flatfilt and convfilt. --- hooke/plugin/convfilt.py | 5 +++-- hooke/plugin/flatfilt.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hooke/plugin/convfilt.py b/hooke/plugin/convfilt.py index 7400f22..b85348a 100644 --- a/hooke/plugin/convfilt.py +++ b/hooke/plugin/convfilt.py @@ -38,7 +38,7 @@ from multiprocessing import Queue import numpy -from ..command import Command, Argument, Failure +from ..command import Command, Argument, Success, Failure from ..config import Setting from ..experiment import VelocityClamp from ..plugin import Plugin, argument_to_setting @@ -210,7 +210,8 @@ class ConvolutionFilterCommand (FilterCommand): if c.name=='convolution peaks'][0] conv_command.run(hooke, inq, outq, **params) peaks = outq.get() - if not isinstance(peaks[0], Peak): + if not (isinstance(peaks, list) and (len(peaks) == 0 + or isinstance(peaks[0], Peak))): raise Failure('Expected a list of Peaks, not %s' % peaks) ret = outq.get() if not isinstance(ret, Success): diff --git a/hooke/plugin/flatfilt.py b/hooke/plugin/flatfilt.py index f1e427e..db54263 100644 --- a/hooke/plugin/flatfilt.py +++ b/hooke/plugin/flatfilt.py @@ -38,7 +38,7 @@ from multiprocessing import Queue from numpy import diff from scipy.signal.signaltools import medfilt -from ..command import Command, Argument, Failure +from ..command import Command, Argument, Success, Failure from ..config import Setting from ..experiment import VelocityClamp from ..plugin import Plugin, argument_to_setting @@ -202,7 +202,8 @@ class FlatFilterCommand (FilterCommand): if c.name=='flat filter peaks'][0] conv_command.run(hooke, inq, outq, **params) peaks = outq.get() - if not isinstance(peaks[0], Peak): + if not (isinstance(peaks, list) and (len(peaks) == 0 + or isinstance(peaks[0], Peak))): raise Failure('Expected a list of Peaks, not %s' % peaks) ret = outq.get() if not isinstance(ret, Success): -- 2.26.2