2 # calibcant - tools for thermally calibrating AFM cantilevers
4 # Copyright (C) 2011-2012 W. Trevor King <wking@drexel.edu>
6 # This file is part of calibcant.
8 # calibcant is free software: you can redistribute it and/or modify it under
9 # the terms of the GNU General Public License as published by the Free Software
10 # Foundation, either version 3 of the License, or (at your option) any later
13 # calibcant is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # calibcant. If not, see <http://www.gnu.org/licenses/>.
20 """Load a calibration file and plot everything interesting.
23 from optparse import OptionParser
25 from matplotlib.pyplot import close, get_fignums, figure, show
26 from calibcant.calibrate import load_all
27 from calibcant.analyze import analyze_all
31 usage = '%prog [options] filename'
32 p = OptionParser(usage)
34 p.add_option('-g', '--group', dest='group', default='/',
35 help='HDF5 group containing calibration data (%default).')
36 p.add_option('-b', '--no-bumps', dest='bumps', default=True,
38 help="Don't display bump details.")
39 p.add_option('-v', '--no-vibrations', dest='vibrations', default=True,
41 help="Don't display vibration details.")
42 p.add_option('-s', '--save-figures', dest='save', action='store_true',
43 help="Save plots (instead of displaying them.")
45 options,args = p.parse_args(args)
48 calibrator,data,raw_data = load_all(filename=filename, group=options.group)
51 if not options.vibrations:
52 raw_data['vibration'] = []
53 analyze_all(config=calibrator.config, data=data, raw_data=raw_data,
54 plot=True, dry_run=True)
56 for i in get_fignums():
58 fig.savefig('%i.png' % i, dpi=300)
64 if __name__ == '__main__':
67 sys.exit(main(sys.argv[1:]))