1 # calibcant - tools for thermally calibrating AFM cantilevers
3 # Copyright (C) 2008-2011 W. Trevor King <wking@drexel.edu>
5 # This file is part of calibcant.
7 # calibcant is free software: you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation, either
10 # version 3 of the License, or (at your option) any later version.
12 # calibcant is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with calibcant. If not, see
19 # <http://www.gnu.org/licenses/>.
21 """Define some variables to configure the package for a particular lab
26 from FFT_tools import window_hann as _window_hann
27 import h5config.config as _config
28 import h5config.tools as _h5config_tools
31 class PackageConfig (_h5config_tools.PackageConfig):
32 "Configure `calibcant` module operation"
33 settings = _h5config_tools.PackageConfig.settings + [
34 _config.BooleanSetting(
36 help='Plot piezo motion using `matplotlib`.',
40 help=('Default temperature for thermal calibration in degrees '
45 class _TemperatureUnit (object):
47 class Celsius (_TemperatureUnit):
49 class Kelvin (_TemperatureUnit):
52 class TemperatureConfig (_config.Config):
53 "Configure `calibcant` temperature operation"
55 _config.ChoiceSetting(
57 help='Units of raw temperature measurements.',
63 _config.BooleanSetting(
65 help=('The temperature values are defaults (vs. real '
70 class _BumpModel (object):
72 class Linear (_BumpModel):
74 class Quadratic (_BumpModel):
77 class BumpConfig (_config.Config):
78 "Configure `calibcant` bump operation"
81 name='initial-position',
82 help=('Position relative to surface for start of bump in meters. '
83 'Should be less than zero to ensure non-contact region '
84 'before you hit the surface.'),
88 help=('Maximum deflection in volts in case of stepper positioning '
89 'to achieve the initial position.'),
92 name='min-slope-ratio',
93 help=('Set the minimum ratio between the deflection/displacement '
94 'of the contact and the non-contact regions for bumps '
95 'seeking the surface. Bumps without sufficient difference '
96 'assume they need to move closer to find the surface.'),
98 _config.IntegerSetting(
100 help=('Number of stepper steps to move "far" away from the '
101 'surface. For possible stepper adjustments while initially '
102 'locating the surface.'),
104 _config.FloatSetting(
106 help='Distance to approach in meters.',
108 _config.FloatSetting(
110 help='Approach/retract speed in meters/second.',
112 _config.FloatSetting(
114 help='Number of samples during approach and during retreat.',
116 _config.ChoiceSetting(
118 help='Bump deflection model.',
122 ('quadratic', Quadratic),
127 class _VibrationModel (object):
129 class Variance (_VibrationModel):
131 class BreitWigner (_VibrationModel):
133 class OffsetBreitWigner (_VibrationModel):
136 class VibrationConfig (_config.Config):
137 "Configure `calibcant` vibration operation"
139 _config.FloatSetting(
141 help='Sampling frequency in Hz.',
143 _config.FloatSetting(
145 help=('Aquisition time in seconds. This is rounded up as required '
146 'so the number of samples will be an integer power of two.'),
148 _config.ChoiceSetting(
150 help='Vibration model.',
153 ('variance', Variance),
154 ('Breit-Wigner', BreitWigner),
155 ('offset Breit-Wigner', OffsetBreitWigner),
157 _config.IntegerSetting(
159 help='FFT chunk size (for PSD fits).',
161 _config.BooleanSetting(
163 help='Overlap FFT chunks (for PSD fits).'),
164 _config.ChoiceSetting(
166 help='FFT chunk window (for PSD fits).',
167 default=_window_hann,
169 ('Hann', _window_hann),
171 _config.FloatSetting(
172 name='minimum-fit-frequency',
173 help='Lower bound of Lorentzian fitting region.',
175 _config.FloatSetting(
176 name='maximum-fit-frequency',
177 help='Upper bound of Lorentzian fitting region.',
182 class CalibrationConfig (_config.Config):
183 "Configure a full `calibcant` calibration run"
185 _config.ConfigSetting(
187 help='Configure the surface bumps',
188 config_class=BumpConfig),
189 _config.IntegerSetting(
191 help='Number of surface bumps.',
193 _config.ConfigSetting(
195 help='Configure the temperature measurements',
196 config_class=TemperatureConfig),
197 _config.IntegerSetting(
198 name='num-temperatures',
199 help='Number of temperature measurements.',
201 _config.ConfigSetting(
203 help='Configure the temperature measurements',
204 config_class=VibrationConfig),
205 _config.IntegerSetting(
206 name='num-vibrations',
207 help='Number of thermal vibration measurements.',
209 _config.FloatSetting(
210 name='temperature-sleep',
211 help=('Time between temperature measurements (in seconds) to get '
212 'independent measurements when reading from slow sensors.'),
214 _config.FloatSetting(
215 name='vibration-spacing',
216 help=('Approximate distance from the surface in meters for the '
217 'vibration measurements. This should be large enough that '
218 'surface effects are negligable.'),