1 # Copyright (C) 2010-2012 W. Trevor King <wking@tremily.us>
3 # This file is part of Hooke.
5 # Hooke is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU Lesser General Public License as published by the Free
7 # Software Foundation, either version 3 of the License, or (at your option) any
10 # Hooke is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
15 # You should have received a copy of the GNU Lesser General Public License
16 # along with Hooke. If not, see <http://www.gnu.org/licenses/>.
19 >>> from hooke.hooke import Hooke, HookeRunner
23 Prepare a curve for polymer fitting.
25 >>> h = r.run_lines(h, ['load_playlist test/data/test']) # doctest: +ELLIPSIS
26 <FilePlaylist test.hkp>
29 >>> h = r.run_lines(h, ['zero_surface_contact_point --block retract']
30 ... ) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE, +REPORT_UDIFF
31 {...'fitted parameters': [8.413...e-08, 2.812...e-10, 158.581...],...}
34 >>> h = r.run_lines(h, ['polynomial_flatten --block retract --deflection_column "surface deflection (m)" --degree 1'])
37 >>> h = r.run_lines(h, ['convert_distance_to_force --block retract --deflection_column "flattened deflection (m)"'])
40 >>> h = r.run_lines(h, ['remove_cantilever_from_extension --block retract'])
43 >>> h = r.run_lines(h, ['flat_filter_peaks --block retract --min_points 1']
44 ... ) # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE
45 [<Peak flat filter peak 0 of surface deflection 510
46 [ -1.065...e-09 -2.244...e-09]>,
47 <Peak flat filter peak 1 of surface deflection 610
48 [ -1.156...e-09 -8.840...e-10 -3.173...e-10 -7.480...e-10]>,
49 <Peak flat filter peak 2 of surface deflection 704
50 [ -7.933...e-10 -1.654...e-09]>,
51 <Peak flat filter peak 3 of surface deflection 812
53 <Peak flat filter peak 4 of surface deflection 916 [ -2.085...e-09]>,
54 <Peak flat filter peak 5 of surface deflection 1103
55 [ -1.768...e-09 -8.885...e-09 -1.722...e-09]>]
59 Fit the flat filter peaks with a polymer tension.
61 >>> h = r.run_lines(h, ['flat_peaks_to_polymer_peaks --block retract'])
64 >>> h = r.run_lines(h, ['polymer_fit_peaks --block retract'])
70 >>> curve = h.playlists.current().current()
71 >>> retract = curve.data[1]
72 >>> retract.info['columns'] # doctest: +NORMALIZE_WHITESPACE
73 ['z piezo (m)', 'deflection (m)',
74 'surface distance (m)', 'surface deflection (m)',
75 'flattened deflection (m)', 'deflection (N)',
76 'cantilever adjusted extension (m)', 'flat filter peaks (m)',
77 'polymer peak 0 (N)', 'polymer peak 1 (N)', 'polymer peak 2 (N)',
78 'polymer peak 3 (N)', 'polymer peak 4 (N)', 'polymer peak 5 (N)']
85 >>> retract[1097:1103,-2:] # doctest: +ELLIPSIS
86 Data([[ NaN, 5.2...e-10],