Success import and better peaks validation in flatfilt and convfilt.
authorW. Trevor King <wking@drexel.edu>
Wed, 19 May 2010 08:50:39 +0000 (04:50 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 19 May 2010 08:50:39 +0000 (04:50 -0400)
hooke/plugin/convfilt.py
hooke/plugin/flatfilt.py

index 7400f22830f057b3468dc4fba45f025d36198ce8..b85348a6feae57a679a2e41de7980a45b6f2e290 100644 (file)
@@ -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):
index f1e427e81d33914d86bd0a5d210b3c41937544e1..db54263bb9741ebe609ac12fbe8a480da05b5d6e 100644 (file)
@@ -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):