Make ExceptionTooFar check more robust with .max().
authorW. Trevor King <wking@drexel.edu>
Tue, 24 Jan 2012 13:02:08 +0000 (08:02 -0500)
committerW. Trevor King <wking@drexel.edu>
Tue, 24 Jan 2012 13:02:08 +0000 (08:02 -0500)
unfold_protein/unfolder.py

index ae835f6c4cadc68f36882257d9a899463cd1d35b..fb289dc317455d979c34d252e8ab59853e323bb2 100755 (executable)
@@ -105,8 +105,10 @@ class Unfolder (object):
             step=step_bits, frequency=frequency, return_data=True)
         data['setpoint'] = setpoint
         # check the output
-        if data['deflection'][-1] < setpoint_bits:
-            _LOG.info('unfolding too far from the surface')
+        if data['deflection'].max() < setpoint_bits:
+            _LOG.info(('unfolding too far from the surface '
+                       '(def {} < target {})').format(
+                        data['deflection'].max(), setpoint_bits))
             self.afm.piezo.jump(self.afm.axis_name, start_pos)
             #if PYLAB_INTERACTIVE_VERBOSE == True:
             #    figure(BASE_FIG_NUM+1)