calibcant-calibrate.py: Record the stepper approach trace
authorW. Trevor King <wking@tremily.us>
Sat, 19 Jan 2013 03:56:04 +0000 (22:56 -0500)
committerW. Trevor King <wking@tremily.us>
Sat, 19 Jan 2013 03:56:04 +0000 (22:56 -0500)
Sometimes these approach curves are pretty funky, so I'll start
recording them by default.

bin/calibcant-calibrate.py

index 5cf5a92f78570f7234e102866b9a64fd22a1c20d..0ae2c0e395724202083effd2d5c6da2d9ab63a6e 100755 (executable)
 import argparse as _argparse
 import time as _time
 
-from calibcant.calibrate import Calibrator as _Calibrator
+import h5py as _h5py
 from pyafm.storage import load_afm as _load_afm
+
+from calibcant.calibrate import Calibrator as _Calibrator
 import calibcant.config as _config
 
 
@@ -62,7 +64,11 @@ def main(args):
         calibrator.setup_config()
         deflection = afm.piezo.read_deflection()
         try:
-            afm.stepper_approach(target_deflection=deflection + 1e3)
+            position,deflection = afm.stepper_approach(
+                target_deflection=deflection + 1e3, record_data=True)
+            with _h5py.File(filename) as f:
+                f['/approach/position'] = position
+                f['/approach/deflection'] = deflection
             if insufficient_calibration_data:
                 data = calibrator.acquire(filename=filename)
             else: