calibcant-plot.py: Plot the stepper approach curve
authorW. Trevor King <wking@tremily.us>
Sat, 19 Jan 2013 04:08:03 +0000 (23:08 -0500)
committerW. Trevor King <wking@tremily.us>
Sat, 19 Jan 2013 04:15:26 +0000 (23:15 -0500)
bin/calibcant-plot.py

index ba959f4b41bda4cadfa9c688f408cae55321b00d..acf9c485f2afa5424942e5a53f1475a610e21b13 100755 (executable)
@@ -22,7 +22,9 @@
 
 from optparse import OptionParser
 
+import h5py as _h5py
 from matplotlib.pyplot import close, get_fignums, figure, show
+
 from calibcant.calibrate import load_all
 from calibcant.analyze import analyze_all
 
@@ -45,6 +47,18 @@ def main(args):
     options,args = p.parse_args(args)
     filename = args[0]
 
+    with _h5py.File(filename) as f:
+        if options.group in f:
+            g = f[options.group]
+            if 'approach' in g:
+                position = g['approach/position'][...]
+                deflection = g['approach/deflection'][...]
+                fig = figure()
+                axes = fig.add_subplot(1, 1, 1)
+                axes.plot(position, deflection)
+                axes.set_title('Stepper approach')
+                axes.set_xlabel('position (steps)')
+                axes.set_ylabel('deflection (bits)')
     calibrator,data,raw_data = load_all(filename=filename, group=options.group)
     if not options.bumps:
         raw_data['bump'] = []