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