2 # calibcant - tools for thermally calibrating AFM cantilevers
4 # Copyright (C) 2008-2011 W. Trevor King <wking@drexel.edu>
6 # This file is part of calibcant.
8 # calibcant is free software: you can redistribute it and/or
9 # modify it under the terms of the GNU Lesser General Public
10 # License as published by the Free Software Foundation, either
11 # version 3 of the License, or (at your option) any later version.
13 # calibcant is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Lesser General Public License for more details.
18 # You should have received a copy of the GNU Lesser General Public
19 # License along with calibcant. If not, see
20 # <http://www.gnu.org/licenses/>.
22 """Load a calibration file and plot everything interesting.
25 from optparse import OptionParser
27 from matplotlib.pyplot import close, get_fignums, figure, show
28 from calibcant.analyze import calib_load_all, calib_plot_all
32 usage = '%prog [options] filename'
33 p = OptionParser(usage)
35 p.add_option('-g', '--group', dest='group', default='/',
36 help='HDF5 group containing calibration data (%default).')
37 p.add_option('-b', '--no-bumps', dest='bumps', default=True,
39 help="Don't display bump details.")
40 p.add_option('-v', '--no-vibrations', dest='vibrations', default=True,
42 help="Don't display vibration details.")
43 p.add_option('-s', '--save-figures', dest='save', action='store_true',
44 help="Save plots (instead of displaying them.")
46 options,args = p.parse_args(args)
49 stuff = calib_load_all(filename=filename, group=options.group)
51 stuff['bump_details'] = []
52 if not options.vibrations:
53 stuff['vibration_details'] = []
54 calib_plot_all(**stuff)
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:]))