Flip deflection sign in picoforce driver so +deflection for +tension
[hooke.git] / hooke / driver / wtk.py
index a7aec0bef1576a61f308a3b4e1515cc5e9838b5f..ec7670d3e896a8e97b43f3051a1a8e31799af531 100644 (file)
@@ -96,11 +96,11 @@ class WTKDriver (Driver):
             unlabeled_approach_data, params, 'approach')
         retract = self._scale_block(
             unlabeled_retract_data, params, 'retract')
-        info = {'filetype':'wtk', 'experiment':experiment.VelocityClamp}
+        info = {'filetype':self.name, 'experiment':experiment.VelocityClamp}
         return ([approach, retract], info)
 
     def _paths(self, path):
-        return (path, path+'_approach', path+'_param')
+        return (path+'_approach', path, path+'_param')
 
     def _read_params(self, param_path):
         params = {}
@@ -156,7 +156,7 @@ class WTKDriver (Driver):
         array in SI units.
         """
         ret = curve.Data(
-            shape=data.shape,
+            shape=(data.shape[0], 2),
             dtype=numpy.float,
             info=copy.deepcopy(info)
             )
@@ -185,7 +185,11 @@ class WTKDriver (Driver):
             * info['z piezo sensitivity (m/V)']
             )
 
-        ret[:,d_scol] = (
+        # Leading '-' because deflection voltage increases as the tip
+        # moves away from the surface, but it makes more sense to me
+        # to have it increase as it moves toward the surface (positive
+        # tension on the protein chain).
+        ret[:,d_scol] = -(
             (data[:,d_rcol]
              * info['deflection sensitivity (V/bit)']
              - info['deflection offset (V)'])