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