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 (re)analyze from the raw data.
25 from optparse import OptionParser
27 from matplotlib.pyplot import show
28 from calibcant.analyze import calib_analyze_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('-d', '--dry-run', dest='dry_run', action='store_true',
38 help="Don't change the original file.")
40 options,args = p.parse_args(args)
43 k,k_s = calib_analyze_all(
44 filename=filename, group=options.group, dry_run=options.dry_run)
45 print "New spring constant:"
46 print "%g +/- %g N/m" % (k, k_s)
49 if __name__ == '__main__':
52 sys.exit(main(sys.argv[1:]))