calibcant/procedure.tex: Add trailing period in no-offset figure
[thesis.git] / src / calibcant / procedure.tex
1 \section{Calibcant}
2 \label{sec:calibcant:procedure}
3
4 A calibration run based on \cref{eq:kappa} consists of bumping the
5 surface with the cantilever tip to measure $\sigma_p$, measuring the
6 buffer temperature $T$ with a thermocouple, and measuring thermal
7 vibration when the tip is far from the surface to extract the fit
8 parameters $G_{1f}$, $f_0$, and $\beta_f$.  I've written the
9 \calibcant\ package to carry out this calibration procedure, building
10 on packages in the \pyafm\ stack (\cref{fig:calibcant:stack}).
11
12 \begin{figure}
13   \tikzstack{black!20}{}
14   \caption{Dependency graph for \calibcant, which shares the
15     \pyafm\ stack with \unfoldprotein (\cref{fig:pyafm:stack}).  The
16     only difference is that the ``brain'' module controlling the stack
17     has changed from \unfoldprotein\ to
18     \calibcant.\label{fig:calibcant:stack}}
19 \end{figure}
20
21 \subsection{Photodiode calibration}
22 \label{sec:calibcant:bump}
23
24 To calculate the photodiode sensitivity $\sigma_p$, we need surface
25 bumps with a clearly delimited contact slope.  The \calibcant\ package
26 uses \imint{python}|AFM.move_just_onto_surface|
27 (\cref{sec:pyafm:pyafm}) to position the cantilever tip a configurable
28 distance off the surface (\cref{sec:pyafm:h5config}).  Then
29 \calibcant\ uses the \pypiezo\ component (\cref{sec:pyafm:pypiezo}) to
30 ramp the tip towards the surface a configurable distance before
31 returning the tip to its original position.  The cantilever deflection
32 during this approach--retract cycle is analyzed to measure $\sigma_p$
33 (\cref{fig:calibcant:bump}).
34
35 \begin{figure}
36   \begin{center}
37     \includegraphics[width=0.8\textwidth]{figures/calibcant/bump.png}
38     \caption{Measuring the photodiode sensitivity $\sigma_p$ by
39       bumping the cantilever tip on the substrate surface.  In the
40       first panel, the blue dots are experimental data, the green line
41       is the heuristic guess at initial fitting parameters, and the
42       red line is the optimized fit.  The second panel shows the
43       residual (measured data minus modeled data) for the bump.  In
44       both panels, there are two deflection measurements at each
45       position, one taken during the approach phase and another taken
46       during the retraction phase.  This is the first bump from the
47       2013-02-07T08-20-46 calibration.\label{fig:calibcant:bump}}
48   \end{center}
49 \end{figure}
50
51 The retraction data is analyzed using a similar approach to \pypiezo's
52 surface detection algorithm to extract the slope of the contact
53 region.  Where \pypiezo\ uses a bilinear model
54 (\cref{eq:bilinear-surface}), \calibcant\ uses a limited linear model:
55
56 \begin{equation}
57   d(z) = \begin{cases}
58       d_\text{rail}  &  z \le z_\text{rail} \\
59       d_\text{kink} + \sigma_p (z - z_\text{kink})
60         &  z_\text{rail} \le z \le z_\text{kink} \\
61       d_\text{kink}  &  z \ge z_\text{kink}
62     \end{cases}
63   \label{eq:limited-linear-surface}
64 \end{equation}
65
66 The fitted parameters are the surface contact point $(z_\text{kink},
67 d_\text{kink})$ and the contact slope $\sigma_p$.  ADCs can only
68 digitize voltages between the rails of their power supply, and the
69 clipping deflection $d_\text{rail}$ is the deflection ADC's maximum
70 measureable voltage ($2^{16}\U{bits}$ for our 16-bit ADCs).
71
72 By explicitly modeling the clipping deflection, we avoid the need for
73 manual intervention when the configured approach distance is too large
74 for the cantilever geometry and a bump pushes too hard.  With short
75 cantilevers, even small tip deflection distances can generate large
76 laser deflection angles (\cref{fig:afm-schematic}), leading to
77 unmeasurable deflection voltages.  One of the unfolding pulls in
78 \cref{fig:pyafm:labview-comparison:many} exhibits this effect,
79 although it was recorded using a different stack.
80
81 An alternative approach using sinusoidal piezo oscillation in the
82 contact region has been proposed by \citet{materassi09}, on the
83 grounds that it is more reliable and easily automated than an explicit
84 bump and manual analysis.  While I agree that \emph{any} automated
85 method is likely better than manual analysis, I feel that the
86 difference between using an automated bump with a linear contact fit
87 and using an automated oscillation with a linear contact fit is likely
88 negligible.
89
90 \subsection{Temperature measurements}
91 \label{sec:calibcant:temperature}
92
93 After a series of surface bumps have been made to measure $\sigma_p$,
94 the stepper motor is used to move the cantilever a configurable
95 distance from the surface (generally $\sim30\U{$\mu$m}$).  While the
96 cantilever settles down after the jarring stepper motion, we measure
97 the buffer temperature using \pypid\ (\cref{sec:pyafm:pypid}), a
98 Melcor Series MTCA Thermoelectric Cooler Controller\citep{melcor}, and
99 a type E thermocouple\footnote{Part number 5TC-TT-E-30-72 from OMEGA
100   Engineering Inc.\citep{omega}.  Breaking down the product number,
101   it's a five pack of thermocouples (5TC) with perfluoroalkoxy
102   insulation (TT), type E metals (chromel--constantan), number 30 AWG
103   wires ($0.255\U{mm}$ diameter), in a $72\U{inch}$ length.}.  The
104 thermocouple is inserted through one of the ports in the AFM fluid
105 cell, so the thermocouple tip is in the buffer less than $3\U{mm}$
106 from the cantilever tip.% TODO: measure distance
107
108 \Cref{eq:kappa} depends on the \emph{absolute} temperature, so labs
109 without easy access to a thermocouple can probably get away with
110 estimating the buffer temperature.  Errors of $5\U{K}$ from an actual
111 temperature of around $300\U{K}$ will be within 1.7\% of the actual
112 value.  The effect of this error on $\kappa$ will be modest, but see
113 \cref{sec:calibcant:discussion:errors} for a full discussion.
114
115 \subsection{Thermal vibration}
116 \label{sec:calibcant:vibration}
117
118 After the temperature measurements are complete, we measure the
119 cantilever's thermal vibration without moving the piezo
120 (\cref{fig:calibcant:vibration}).  The parameters controlling these
121 vibrations are configurable (with \hFconfig,
122 \cref{sec:pyafm:h5config}), but the default values are:
123
124 \begin{description}
125   \item[frequency] The sampling frequency, which defaults to
126     $50\U{kHz}$.  This value gives a Nyquist frequency of $25\U{kHz}$,
127     which is well above our resonant cantilever frequencies
128     ($\sim5\U{kHz}$ in the buffer).
129   \item[sample time] The acquisition time in seconds.  This is rounded
130     up as required so the number of samples will be an integer power
131     of two for efficient Fourier transformation.  It defaults to
132     $1\U{s}$.
133   \item[model] The vibration model.  This selects the fitting method
134     for extracting the variance $\avg{V_p(t)^2}$.  By default,
135     \cref{eq:psd-Vp} is used, but you can add the constant offset
136     (discussed below) or use the na\"{\i}ve
137     $\avg{V_p(t)^2}=\sum(V_p^2)/N$.
138   \item[minimum fit frequency] The low-frequency end of the
139     \PSD\ usually has a good deal of noise due to detector drift or
140     background (non-cantilever) vibrations.  This parameter allows
141     you to select a window of the \PSD\ for fitting that excludes the
142     troublesome low-frequency region.  It defaults to $500\U{Hz}$.
143   \item[maximum fit frequency] For completeness, you can also set a
144     high-frequency cutoff, although I've never had to use this
145     parameter.
146   \item[chunk-size, overlap, \ldots] Assorted parameters for Fourier
147     transforms used to compute the \PSD.
148 \end{description}
149
150 \begin{figure}
151   \begin{center}
152     \subfloat[][]{\label{fig:calibcant:vibration:offset}
153       \includegraphics[width=0.8\textwidth]{figures/calibcant/vibration.png}}
154     \caption{\protect\subref{fig:calibcant:vibration:offset}Measuring
155       the cantilever's thermal vibration.  The top panel shows the raw
156       time series data in bins, the middle panel shows the
157       distribution of bin values with a Gaussian fit, and the bottom
158       panel shows the $\PSD_f(V_p,f)$ with a fit following
159       \cref{eq:psd-Vp-offset}.  The constant offset $P_{0f}$, drawn as
160       the horizontal line in the third panel, accounts for white noise
161       in the measurement circuit\citep{burnham03}.  The vertical line
162       marks the peak frequency $f_\text{max}$
163       (\cref{eq:peak-frequency}).  Only data in the blue region was
164       used when computing the best fit.  This is the first vibration
165       from the 2013-02-07T08-20-46 calibration, yielding a fitted
166       variance $\avg{V_p(t)^2}=96.90\pm0.99\U{mV$^2$}$.
167       \label{fig:calibcant:vibration}}
168   \end{center}
169 \end{figure}
170
171 \begin{figure}
172   \ContinuedFloat
173   \begin{center}
174     \subfloat[][]{\label{fig:calibcant:vibration:no-offset}
175       \includegraphics[width=0.8\textwidth]{figures/calibcant/vibration-no-offset.png}}
176     \caption{\protect\subref{fig:calibcant:vibration:no-offset}This is
177       the same data as in
178       \protect\subref{fig:calibcant:vibration:offset} fit with
179       \cref{eq:psd-Vp}, yielding a fitted variance
180       $\avg{V_p(t)^2}=120.92\pm0.90\U{mV$^2$}$.  The third panel is
181       very similar to figure 2 in \citet{florin95}, but they do not go
182       into further detail on the method or model.  They may be fitting
183       their data to \cref{eq:lorentzian}, see
184       \cref{sec:calibcant:lorentzian}.  Another similar figure is in
185       \citet{hutter93}.}
186   \end{center}
187 \end{figure}
188
189 \Cref{eq:psd-Vp} decreases for large frequencies, but the measured
190 \PSD\ levels out (\cref{fig:calibcant:vibration:no-offset}).  I
191 attribute this to background white noise in the measurement circuit,
192 and not due to cantilever oscillation.  To avoid artificially
193 inflating the estimated $\avg{V_p(t)^2}$, I created an alternative
194 model for $\PSD_f(V_p,f)$ that adds a frequency-independent offset
195 $P_{0f}$\citep{burnham03}.
196
197 \begin{equation}
198   \PSD_f(V_p, f) = \frac{G_{1f}}{(f_0^2-f^2)^2 + \beta_f^2 f^2} + P_{0f} \;.
199   \label{eq:psd-Vp-offset}
200 \end{equation}
201
202 Plots of \cref{eq:psd-Vp-offset} fits look better than
203 \cref{eq:psd-Vp} fits (\cref{fig:calibcant:vibration}), but the
204 significance on the variance calculated with
205 \cref{eq:avg-Vp-Gone-f} depends on the amount of background noise
206 in the vibration data.  With over an order of magnitude difference
207 between the power of the damped harmonic oscillator peak and the
208 background noise, the effect of $P_{0f}$ will be small.  With noisier
209 setups, removing the white background noise can lead to a significant
210 difference.  The fitted variance $\avg{V_p(t)^2}$ of my
211 2013-02-07T08-20-46 data shifts from $120.92\pm0.90\U{mV$^2$}$ using
212 \cref{eq:psd-Vp} to $96.90\pm0.99\U{mV$^2$}$ using
213 \cref{eq:psd-Vp-offset}, a 20\% decrease.  The calculated spring
214 constant increases from $43.3\pm{2.1}$ to $54.1\pm2.7\U{mN/m}$, a 25\%
215 increase.  Changes of this magnitude are important for accurate
216 unfolding force calibration.