Fix some outstanding argument issues in flatfilt.
authorW. Trevor King <wking@drexel.edu>
Wed, 19 May 2010 09:41:42 +0000 (05:41 -0400)
committerW. Trevor King <wking@drexel.edu>
Wed, 19 May 2010 09:41:42 +0000 (05:41 -0400)
Also adjust temporary contact point value in vclamp.scale to ensure
'blind window' fits.

hooke/plugin/flatfilt.py
hooke/plugin/vclamp.py

index efca147af2e964fbf2137987930c6753cdfc378c..ca9b1b89e8cc5ef761a6476b05877486f6999e0e 100644 (file)
@@ -54,7 +54,7 @@ class FlatFiltPlugin (Plugin):
     def __init__(self):
         super(FlatFiltPlugin, self).__init__(name='flatfilt')
         self._arguments = [ # For Command initialization
-            Argument('median filter', type='int', default=7, help="""
+            Argument('median window', type='int', default=7, help="""
 Median window filter size (in points).
 """.strip()),
             Argument('blind window', type='float', default=20e-9, help="""
@@ -163,7 +163,7 @@ class FlatPeaksCommand (Command):
             if value == None: # Use configured default value.
                 params[key] = self.plugin.config[key]
         # TODO: better option parser to do this automatically by Argument.type
-        for key in ['max cut', 'min deviations', 'min points', 'see double', 'stable']:
+        for key in ['blind window', 'median window', 'max cut', 'min deviations', 'min points', 'see double', 'stable']:
             params[key] = float(params[key])
         # TODO: convert 'see double' from nm to points
         return z_data,d_data,params
@@ -198,9 +198,9 @@ class FlatFilterCommand (FilterCommand):
     def filter(self, curve, hooke, inqueue, outqueue, params):
         inq = Queue()
         outq = Queue()
-        conv_command = [c for c in hooke.commands
+        filt_command = [c for c in hooke.commands
                         if c.name=='flat filter peaks'][0]
-        conv_command.run(hooke, inq, outq, **params)
+        filt_command.run(hooke, inq, outq, **params)
         peaks = outq.get()
         if not (isinstance(peaks, list) and (len(peaks) == 0
                                              or isinstance(peaks[0], Peak))):
@@ -208,4 +208,4 @@ class FlatFilterCommand (FilterCommand):
         ret = outq.get()
         if not isinstance(ret, Success):
             raise ret
-        return len(peaks) >= params['min peaks']
+        return len(peaks) >= int(params['min peaks'])
index 7374ab529ada89eb8b87e4c65a84034423ee7a93..54498e4d5e8601bb211851805b61935d6a26c04a 100644 (file)
@@ -42,7 +42,7 @@ def scale(curve):
         data.info['columns'].extend(['surface z piezo (m)', 'deflection (N)'])
         z_data = data[:,data.info['columns'].index('z piezo (m)')]
         d_data = data[:,data.info['columns'].index('deflection (m)')]
-        surface_offset = 0 # TODO
+        surface_offset = min(z_data) # TODO
         data.info['surface offset (m)'] = surface_offset
         data[:,-2] = z_data - surface_offset
         data[:,-1] = d_data * data.info['spring constant (N/m)']