-Scripts and python modules to calibrate AFM cantilevers via the
-"Thermal tune" method:
+calibcant: tools for thermally calibrating AFM cantilevers
+
+Calculates the spring constant `k` of a cantilever using the
+equipartition theorem:
+
1/2 k_B T = 1/2 K x^2
+
The analysis uses the expected power spectral density (PSD) of a
damped simple harmonic oscillator to filter out noise from the
measured PSD.
-== Dependencies ==
-
-linfit (depends in turn on scipy.stats.linregress)
-
-*** Command line interface ***
-
-** bumps **
-
-Create a two-column ascii data file for fitting bumps with (for example)
- $ int16s_to_ascii_array ~/rsrch/data/z_piezo_calib/20080116/20080116090005_bump_surface_Z_piezo_output \
- ~/rsrch/data/z_piezo_calib/20080116/20080116090005_bump_surface_Deflection_input > d
-
-Then fit slope with
- $ python calibcant_bump_analyze.py -c d > stdout 2> stderr
- $ cat stdout
- 0.00958650972452
- $ cat stderr
- not cutting
-
-
-** vibs **
-
-Create a two-column ascii data file for fitting bumps with (for example)
- $ cd ~/src/comedi_simult_AIO
- $ cmd -c0 -n1 -F200000 -N2097152 > vib.raw # 2097152 = 2^21 points ~= 10 seconds of data
- $ unitary_avg_fft_from_raw.py vib.raw
-Creates vib.raw.psd, with frequency in Hz in the first column, and amplitude in Volts^2/Hz in the second column.
-Then get the variance with
- $ cd ~/src/calibrate_cantilever
- $ python psd_filter_analyze.py -s9 -tmedian -g ~/src/comedi_simult_AIO/vib.raw 2> check.gp
- <Lorentzian-fit-variance>
-You can check the validity of the fit with
- $ gnuplot check.gp -
-And adjust the min and max of the fitted frequency range as neccessary
- $ python psd_filter_analyze.py -s9 -tmedian -m1000 -M8500 -g ~/src/comedi_simult_AIO/vib.raw 2> check.gp
- <new Lorentzian-fit-variance>
-Until the fit looks reasonable.
-
-
-** calibrating **
-
-Once you've assembled a few slopes, vibs, and Ts, put it all together to calculate k with
- $ python calibcant_analyze.py -vC 0.02,0.03,0.025 22.5,22.1 6e-9,5.5e-9 > stdout 2> stderr
- $ cat stdout
- 456.069575483
- $ cat stderr
- Variable (units) : mean +/- std. dev. (relative error)
- Cantilever k (pN/nm) : 456.07 +/- 146.671 (0.321599)
- photoSensitivity**2 (V/nm)**2 : 0.000641667 +/- 0.000204464 (0.318645)
- T (K) : 295.45 +/- 0.2 (0.000676933)
- 1/Vphoto**2 (1/V)**2 : 1.74242e+08 +/- 7.57576e+06 (0.0434783)
+
+Installation
+============
+
+Packages
+--------
+
+Gentoo
+~~~~~~
+
+I've packaged calibcant for Gentoo. You need layman_ and my `wtk
+overlay`_. Install with::
+
+ # emerge -av app-portage/layman
+ # layman --add wtk
+ # emerge -av sci-physics/calibcant
+
+Dependencies
+------------
+
+If you're installing by hand or packaging calibcant for another
+distribution, you'll need the following dependencies:
+
+=========== ================= ============================
+Package Debian_ Gentoo_
+=========== ================= ============================
+Numpy_ python-numpy dev-python/numpy
+Scipy_ python-scipy sci-libs/scipy
+H5config_ dev-python/h5config [#wtk]_
+H5Py_ python-h5py dev-python/h5py
+Matplotlib_ python-matplotlib dev-python/matplotlib
+Nose_ python-nose dev-python/nose
+FFT_tools_ dev-python/FFT-tools [#wtk]_
+Pypiezo_ sci-libs/pypiezo [#wtk]_
+=========== ================= ============================
+
+.. [#wtk] In the `wtk overlay`_.
+
+You'll also need my pyafm_ and stepper_ packages, or suitable
+replacements.
+
+Installing by hand
+------------------
+
+Calibcant is available as a Git_ repository::
+
+ $ git clone git://tremily.us/calibcant.git
+
+See the homepage_ for details. To install the checkout, run the
+standard::
+
+ $ python setup.py install
+
+
+Usage
+=====
+
+See the module docstrings for simple examples.
+
+
+Testing
+=======
+
+Run internal unit tests with::
+
+ $ nosetests --with-doctest --doctest-tests calibcant
+
+
+Licence
+=======
+
+This project is distributed under the `GNU General Public License
+Version 3`_ or greater.
+
+
+Author
+======
+
+W. Trevor King
+wking@drexel.edu
+Copyright 2007-2011
+
+
+.. _layman: http://layman.sourceforge.net/
+.. _wtk overlay: http://blog.tremily.us/posts/Gentoo_overlay/
+.. _Debian: http://www.debian.org/
+.. _Gentoo: http://www.gentoo.org/
+.. _NumPy: http://numpy.scipy.org/
+.. _SciPy: http://www.scipy.org/
+.. _H5config: http://blog.tremily.us/posts/h5config/
+.. _H5Py: http://code.google.com/p/h5py/
+.. _Matplotlib: http://matplotlib.sourceforge.net/
+.. _Nose: http://somethingaboutorange.com/mrl/projects/nose/
+.. _FFT_tools: http://blog.tremily.us/posts/FFT-tools/
+.. _Pypiezo: http://blog.tremily.us/posts/pypiezo/
+.. _pyafm: http://blog.tremily.us/posts/pyafm/
+.. _stepper: http://blog.tremily.us/posts/stepper/
+.. _Git: http://git-scm.com/
+.. _homepage: http://blog.tremily.us/posts/calibcant/
+.. _GNU General Public License Version 3: http://www.gnu.org/licenses/gpl.txt