calibcant/discussion.tex: Cite PNAS and Nature for data archival
[thesis.git] / src / calibcant / discussion.tex
1 \section{Discussion}
2 \label{sec:calibcant:discussion}
3
4 \subsection{Peak frequency}
5 \label{sec:calibcant:peak-frequency}
6
7 Since we went through the trouble of calculating the derivative of
8 $\PSD_f$ in \cref{eq:model-psd-df}, it's useful to also calculate the
9 frequency of the resonant peak.
10 \begin{align}
11   0 &= \deriv{f}{\PSD_f}
12     = \frac{2G_{1f}f_\text{max}}
13            {\p({(f_0^2-f_\text{max}^2)^2 + \beta_f^2 f_\text{max}^2})^2}
14       \p({2(f_0^2-f_\text{max}^2) - \beta_f^2}) \\
15     &= 2(f_0^2-f_\text{max}^2) - \beta_f^2 \\
16   f_\text{max}^2 &= f_0^2 - \frac{\beta_f^2}{2} \\
17   f_\text{max} &= \sqrt{f_0^2 - \frac{\beta_f^2}{2}} \;,
18   \label{eq:peak-frequency}
19 \end{align}
20 where we used $f\ne0$ during the large simplifying multiplication.  We
21 see that the peak frequency is shifted from $f_0$ depending on the
22 damping term $\beta_f$.  For overdamped cantilevers with large values
23 of $\beta$, the peak frequency will not have a real solution.%
24 %
25 \nomenclature{$f_\text{max}$}{The frequency of the peak power in
26   $\PSD_f$ (\cref{eq:peak-frequency}).}
27
28 \subsection{Propagation of errors}
29 \label{sec:calibcant:discussion:errors}
30
31 Extracting cantilever spring constants with \cref{eq:kappa} is great,
32 but the number you get is not much good if you can't estimate its
33 accuracy.  We can find the effect of measurement and fitting errors on
34 the calculated $\kappa$ using Taylor expansions\citep{ku66}.  To the
35 first order,
36
37 \begin{equation}
38   f(\vect{x}) \approx f_0 + \sum_i^n \p({\deriv{x_i}{f}(x_i - x_{i0})}) \;.
39 \end{equation}
40
41 To applying this to \cref{eq:kappa}, we need the derivatives
42 \begin{align}
43   \deriv{\sigma_p}{\kappa}
44      &= \deriv{\sigma_p}{}\p({\frac{\sigma_p^2 k_BT}{\avg{V_p(t)^2}}})
45      = \frac{2\kappa}{\sigma_p} \\
46   \deriv{T}{\kappa} &= \frac{\kappa}{T} \\
47   \deriv{\avg{V_p(t)^2}}{\kappa} &= \frac{-\kappa}{\avg{V_p(t)^2}} \;,
48 \end{align}
49 where I have used $\avg{V_p(t)^2}$ directly to support alternative
50 variance extraction models (\cref{sec:calibcant:vibration}).
51
52 Our measurements of $\sigma_p$, $T$, and $\avg{V_p(t)^2}$ are
53 independent and therefore uncorrelated.  This lets us estimate
54 standard deviation of $\kappa$ from the standard deviation of the
55 measured parameters\citep{ku66}.
56
57 \begin{align}
58   \sigma_\kappa &\approx \sqrt{
59       \p({\deriv{\sigma_p}{\kappa}})^2 \sigma_{\sigma_p}^2 +
60       \p({\deriv{T}{\kappa}})^2 \sigma_{T}^2 +
61       \p({\deriv{\avg{V_p(t)^2}}{\kappa}})^2 \sigma_{\avg{V_p(t)^2}}^2
62       } \\
63     &\approx \sqrt{
64       \frac{4\kappa^2}{\sigma_p^2} \sigma_{\sigma_p}^2 +
65       \frac{\kappa^2}{T^2} \sigma_{T}^2 +
66       \frac{\kappa^2}{\avg{V_p(t)^2}} \sigma_{\avg{V_p(t)^2}}^2
67       } \\
68   \frac{\sigma_\kappa}{\kappa} &\approx \sqrt{
69       4\p({\frac{\sigma_{\sigma_p}}{\sigma_p}})^2 +
70       \p({\frac{\sigma_{T}}{T}})^2 +
71       \p({\frac{\sigma_{\avg{V_p(t)^2}}^2}{\avg{V_p(t)^2}}^2})
72     }
73 \end{align}
74
75 By repeating each experiment (surface bumps, temperature readings, and
76 thermal vibrations) several times, we can estimate the statistical
77 uncertainty in each parameter (\cref{fig:calibcant:statistics}).
78 Values for $\sigma_p$ and $\avg{V_p^2}$ are quite sensitive to the
79 location of the laser spot on the cantilever, so they can vary over
80 large time scales as the microscope alignment drifts (e.g.~due to
81 thermal expansion as the room warms up).  However, the calculated
82 value for $\kappa$ should not vary significantly.
83
84 For example, on a recent calibration run\footnote{2013-02-07T08-20-46}
85 I measured $\sigma_p=35.68\pm0.87\U{V/$\mu$m}$,
86 $T=298.151\pm0.033\U{K}$, and $\avg{V_p^2}=96.90\pm0.99\U{mV$^2$}$,
87 which gives $\kappa=54.1\pm2.7\U{mN/m}$.  These numbers are very
88 similar to those obtained with a different cantilever from the same
89 batch measured a month later (\cref{tab:calibcant:stability}).  The
90 uncertainty contributions from each term are
91 \begin{align}
92   4\p({\frac{\sigma_{\sigma_p}}{\sigma_p}})^2 &= 2.38\E{-3}\U{N$^2$/m$^2$} \\
93   \p({\frac{\sigma_{T}}{T}})^2 &= 1.29\E{-8}\U{N$^2$/m$^2$} \\
94   \p({\frac{\sigma_{\avg{V_p(t)^2}}^2}{\avg{V_p(t)^2}}^2})
95     &= 1.04\E{-4}\U{N$^2$/m$^2$}
96 \end{align}
97 The size of the thermal vibration is
98 $\sqrt{\avg{V_p^2}}/\sigma_p\approx2.8\U{\AA}$ with forces on the
99 order of $\kappa\sqrt{\avg{V_p^2}}/\sigma_p\approx15\U{pN}$.
100
101 In this particular run, most of the uncertainty in $\kappa$ comes from
102 $\sigma_{\sigma_p}$, with some from $\sigma_{\avg{V_p(t)^2}}$.  To add
103 uncertainty comparable to the photodiode sensitivity contribution, the
104 temperature variance would have to be
105 \begin{equation}
106   \sigma_T = \frac{\sigma_{\sigma_p}}{\sigma_p}\cdot T
107     \approx \frac{2\cdot 0.87}{35.68} \cdot 298.151\U{T}
108     \approx 15\U{K} \;.
109 \end{equation}
110 This is a large enough window that simply using room temperature (or
111 even a hard-coded $300\U{K}$) should not introduce excessive error in
112 the calculated $\kappa$.
113
114 \begin{figure}
115   \begin{center}
116     \includegraphics[width=0.8\textwidth]{figures/calibcant/statistics.png}
117     \caption{Estimating the statistical uncertainty of the calculated
118       cantilever spring constant $\kappa$ through repeated
119       measurements.\label{fig:calibcant:statistics}}
120   \end{center}
121 \end{figure}
122
123 \begin{table}
124   \begin{center}
125     \begin{tabular}{c c S[table-format=3.3] S[table-format=1.3]
126                         S[table-format=3.3] S[table-format=1.3]}
127       \toprule
128       \multicolumn{2}{c}{Timestamp:} &
129       \multicolumn{2}{c}{2013-03-03T16-37-12} &
130       \multicolumn{2}{c}{2013-03-04T12-21-54} \\
131       \midrule
132       Quantity & Units & {Mean} & {Std.~Dev.} & {Mean} & {Std.~Dev.} \\
133       \midrule
134       $\sigma_p$    & \bareU{V/$\mu$m} & 46.22   & 0.76  & 41.30   & 0.21 \\
135       $T$           & \bareU{K}        & 296.302 & 0.021 & 294.272 & 0.022 \\
136       $\avg{V_p^2}$ & \bareU{mV$^2$}   & 108.3   & 1.1   & 105.5   & 2.16 \\
137       $\kappa$      & \bareU{mN/m}     & 67.3    & 2.5   & 65.6    & 1.5 \\
138       \bottomrule
139     \end{tabular}
140     \caption{Measured spring constant calibration parameters (mean and
141       standard deviation) for a single cantilever on two consecutive
142       days.  The measured parameters have changes slightly because the
143       laser alignment and buffer temperature drift over time, but the
144       measured $\kappa$ are not significantly different ($p=0.9$, as
145       measured with a two-tailed Welch's
146       $t$-test\citep{welch38,welch47}).\label{tab:calibcant:stability}}
147     % Using Welch's t test
148     %     http://en.wikipedia.org/wiki/Welch%27s_t_test
149     %   from math import sqrt  # using Python in the following
150     %   x1 = 67.3
151     %   v1 = 2.5**2
152     %   n1 = 10    # sortof :p
153     %   x2 = 65.6
154     %   v2 = 1.5**2
155     %   n2 = 10
156     %   t = (x1 - x2) / sqrt(v1/n1 + v2/n2)
157     %     = 1.8
158     % Degrees of freedom with the Welch-Satterthwaithe equation
159     %   df = (v1/n1 + v2/n2)**2 / ( (v1/n1)**2/(n1-1) + (v2/n2)**2/(n2-1) )
160     % Test null hypothesis that means are equal (two-tailed t)
161     %     http://en.wikipedia.org/wiki/Two-tailed_test
162     %   from scipy.stats.mstats import betai
163     %   p = betai(0.5*df, 0.5, float(df) / (df + t*t))
164     %     = 0.09
165     % With arrays, we could have used scipy.stats.mstats.ttest_ind().
166   \end{center}
167 \end{table}
168
169 \subsection{Archiving experimental data}
170 \label{sec:calibcant:discussion:data}
171
172 Scientific data is not thrown away after analysis.  Organizations may
173 have standards for archival, and many journals require supporting data
174 to be available on request after publication or archived in public
175 databases\citep{pnas-data-archival,nature-data-archival}.  Both the
176 raw data and the experimental parameters used to collect need to be
177 preserved, but managing this manually is tedious and error prone.  Lab
178 notebooks rarely contain \emph{all} of the parameters used to collect
179 and analyze a particular calibration.  Data collected with
180 \calibcant\ is saved in \citetalias{hdf5} with the full configuration
181 (\cref{sec:pyafm:h5config}), bundling all of the information together
182 in a single file.
183
184 One minor drawback to this approach is that configuration information
185 (which is not likely to change often) is duplicated between
186 calibration runs.  While this uses some extra disk space, the overhead
187 is small.  The full calibration datafile weighs in at $3.4\U{MB}$,
188 while the calibration section alone is just $37\U{kB}$ (1\% of the
189 total).
190
191 Besides the benefit of having a self contained file, HDF5 provides
192 efficient support for large arrays of typed data (such as the unsigned
193 16-bit values from our DACs and ADCs), which is not possible with many
194 other open file formats.  The HDF libraries are supported by the
195 non-profit HDF Group with a 20 year development
196 history\citep{hdf-group} and many users\citep{hdf-users}.  This
197 suggests that HDF will be around for the long haul, and if it is
198 eventually phased out, that there will be a number of well funded
199 organizations interested in developing migration plans.