From: W. Trevor King Date: Wed, 19 May 2010 08:50:39 +0000 (-0400) Subject: Success import and better peaks validation in flatfilt and convfilt. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9e871c054ff8792b5a7fc25dd61b0b271746d68e;p=hooke.git Success import and better peaks validation in flatfilt and convfilt. --- 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):