-[autopeak]\r
- [[auto_fit_nm]]\r
- default = 5\r
- minimum = 0\r
- type = float\r
- value = 5\r
- \r
- [[auto_fit_points]]\r
- default = 50\r
- minimum = 0\r
- type = integer\r
- value = 50\r
- \r
- [[auto_left_baseline]]\r
- default = 20\r
- minimum = 0\r
- type = float\r
- value = 20\r
- \r
- [[auto_max_p]]\r
- default = 10\r
- minimum = 0\r
- type = float\r
- value = 10\r
- \r
- [[auto_min_p]]\r
- default = 0.005\r
- minimum = 0\r
- type = float\r
- value = 0.005\r
- \r
- [[auto_right_baseline]]\r
- default = 20\r
- minimum = 0\r
- type = float\r
- value = 20\r
- \r
- [[auto_slope_span]]\r
- default = 20\r
- minimum = 0\r
- type = integer\r
- value = 20\r
- \r
- [[baseline_clicks]]\r
- default = automatic\r
- elements = contact point, automatic, 1 point, 2 points\r
- type = enum\r
- value = automatic\r
- \r
- [[color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[delta_force]]\r
- default = 10\r
- minimum = 0\r
- type = integer\r
- value = 10\r
- \r
- [[fit_function]]\r
- default = wlc\r
- elements = wlc, fjc, fjcPEG\r
- type = enum\r
- value = wlc\r
- \r
- [[noauto]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[noflatten]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[persistence_length]]\r
- default = 0.35\r
- minimum = 0\r
- type = float\r
- value = 0.35\r
- \r
- [[plot_linewidth]]\r
- default = 1\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 1\r
- \r
- [[plot_size]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 20\r
- \r
- [[plot_style]]\r
- default = scatter\r
- elements = plot, scatter\r
- type = enum\r
- value = scatter\r
- \r
- [[rebase]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[reclick]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[temperature]]\r
- default = 293\r
- minimum = 0\r
- type = float\r
- value = 293\r
- \r
- [[usepl]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[usepoints]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[whatset]]\r
- default = retraction\r
- elements = extension, retraction\r
- type = enum\r
- value = retraction\r
+[autopeak]
+ [[auto_fit_nm]]
+ default = 5
+ minimum = 0
+ type = float
+ value = 5
-
++
+ [[auto_fit_points]]
+ default = 50
+ minimum = 0
+ type = integer
+ value = 50
-
++
+ [[auto_left_baseline]]
+ default = 20
+ minimum = 0
+ type = float
+ value = 20
-
++
+ [[auto_max_p]]
+ default = 10
+ minimum = 0
+ type = float
+ value = 10
-
++
+ [[auto_min_p]]
+ default = 0.005
+ minimum = 0
+ type = float
+ value = 0.005
-
++
+ [[auto_right_baseline]]
+ default = 20
+ minimum = 0
+ type = float
+ value = 20
-
++
+ [[auto_slope_span]]
+ default = 20
+ minimum = 0
+ type = integer
+ value = 20
-
++
+ [[baseline_clicks]]
- default = 0
- maximum = 20
++ default = automatic
++ elements = contact point, automatic, 1 point, 2 points
++ type = enum
++ value = automatic
++
++ [[color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[delta_force]]
++ default = 10
+ minimum = 0
+ type = integer
- value = 0
-
++ value = 10
++
++ [[fit_function]]
++ default = wlc
++ elements = wlc, fjc, fjcPEG
++ type = enum
++ value = wlc
++
+ [[noauto]]
+ default = False
+ type = boolean
+ value = False
-
++
+ [[noflatten]]
+ default = False
+ type = boolean
+ value = False
-
- [[pl]]
- default = 5
++
++ [[persistence_length]]
++ default = 0.35
+ minimum = 0
+ type = float
- value = 5
-
++ value = 0.35
++
++ [[plot_linewidth]]
++ default = 1
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 1
++
++ [[plot_size]]
++ default = 20
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 20
++
++ [[plot_style]]
++ default = scatter
++ elements = plot, scatter
++ type = enum
++ value = scatter
++
+ [[rebase]]
- default = True
++ default = False
+ type = boolean
+ value = False
-
++
+ [[reclick]]
+ default = False
+ type = boolean
+ value = False
-
++
+ [[temperature]]
+ default = 293
+ minimum = 0
+ type = float
+ value = 293
-
++
+ [[usepl]]
+ default = False
+ type = boolean
+ value = False
-
++
+ [[usepoints]]
+ default = False
+ type = boolean
+ value = False
++
++ [[whatset]]
++ default = retraction
++ elements = extension, retraction
++ type = enum
++ value = retraction
--- /dev/null
-[plotmanipulators]\r
- [[order]]\r
- default = '"correct", "median", "absvalue", "flatten", "multiplier", "clamp", "threshold", "coincident", "showconvoluted", "centerzero"'\r
- elements = correct, median, absvalue, flatten, multiplier, clamp, threshold, coincident, showconvoluted, centerzero\r
- type = arraystring\r
- value = '"correct" "median" "absvalue" "flatten" "multiplier" "clamp" "threshold" "coincident" "showconvoluted" "centerzero"'\r
- \r
- [[absvalue]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[centerzero]]\r
- default = False\r
- type = boolean\r
- value = True\r
- \r
- [[clamp]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[coincident]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[correct]]\r
- default = False\r
- type = boolean\r
- value = True\r
- \r
- [[flatten]]\r
- default = False\r
- type = boolean\r
- value = True\r
- \r
- [[median]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[multiplier]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[showconvoluted]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[threshold]]\r
- default = False\r
- type = boolean\r
- value = False\r
-\r
-[preferences]\r
- [[hide_curve_extension]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[legend]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[playlist]]\r
- default = playlists\test.hkp\r
- type = filename\r
- value = playlists\test.hkp\r
- \r
- [[use_zero]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[workdir]]\r
- default = ""\r
- type = folder\r
- value = \r
- \r
- [[x_decimals]]\r
- default = 2\r
- maximum = 10\r
- minimum = 0\r
- type = integer\r
- value = 2\r
- \r
- [[x_prefix]]\r
- default = n\r
- elements = n, p\r
- type = enum\r
- value = n\r
- \r
- [[y_decimals]]\r
- default = 2\r
- maximum = 10\r
- minimum = 0\r
- type = integer\r
- value = 2\r
- \r
- [[y_prefix]]\r
- default = n\r
- elements = n, p\r
- type = enum\r
- value = n\r
-\r
-[copylog]\r
- [[destination]]\r
- default = ""\r
- type = folder\r
- value = \r
- \r
- [[use_LVDT_folder]]\r
- default = False\r
- type = boolean\r
- value = False\r
++[plotmanipulators]
++ [[order]]
++ default = '"correct", "median", "absvalue", "flatten", "multiplier", "clamp", "threshold", "coincident", "showconvoluted", "centerzero"'
++ elements = correct, median, absvalue, flatten, multiplier, clamp, threshold, coincident, showconvoluted, centerzero
++ type = arraystring
++ value = '"correct" "median" "absvalue" "flatten" "multiplier" "clamp" "threshold" "coincident" "showconvoluted" "centerzero"'
++
++ [[absvalue]]
++ default = False
++ type = boolean
++ value = False
++
++ [[centerzero]]
++ default = False
++ type = boolean
++ value = True
++
++ [[clamp]]
++ default = False
++ type = boolean
++ value = False
++
++ [[coincident]]
++ default = False
++ type = boolean
++ value = False
++
++ [[correct]]
++ default = False
++ type = boolean
++ value = True
++
++ [[flatten]]
++ default = False
++ type = boolean
++ value = True
++
++ [[median]]
++ default = False
++ type = boolean
++ value = False
++
++ [[multiplier]]
++ default = False
++ type = boolean
++ value = False
++
++ [[showconvoluted]]
++ default = False
++ type = boolean
++ value = False
++
++ [[threshold]]
++ default = False
++ type = boolean
++ value = False
++
++[preferences]
++ [[hide_curve_extension]]
++ default = False
++ type = boolean
++ value = False
++
++ [[legend]]
++ default = False
++ type = boolean
++ value = False
++
++ [[playlist]]
++ default = playlists\test.hkp
++ type = filename
++ value = playlists\test.hkp
++
++ [[use_zero]]
++ default = True
++ type = boolean
++ value = True
++
++ [[workdir]]
++ default = ""
++ type = folder
++ value =
++
++ [[x_decimals]]
++ default = 2
++ maximum = 10
++ minimum = 0
++ type = integer
++ value = 2
++
++ [[x_prefix]]
++ default = n
++ elements = n, p
++ type = enum
++ value = n
++
++ [[y_decimals]]
++ default = 2
++ maximum = 10
++ minimum = 0
++ type = integer
++ value = 2
++
++ [[y_prefix]]
++ default = n
++ elements = n, p
++ type = enum
++ value = n
++
++[copylog]
++ [[destination]]
++ default = ""
++ type = folder
++ value =
++
++ [[use_LVDT_folder]]
++ default = False
++ type = boolean
++ value = False
--- /dev/null
-[fits]\r
- [[ext]]\r
- default = txt\r
- type = string\r
- value = txt\r
- \r
- [[folder]]\r
- default = ""\r
- type = folder\r
- value = \r
- \r
- [[prefix]]\r
- default = ""\r
- type = string\r
- value = \r
- \r
- [[separator]]\r
- default = ","\r
- type = string\r
- value = ","\r
-\r
-[force_curve]\r
- [[ext]]\r
- default = txt\r
- type = string\r
- value = txt\r
- \r
- [[folder]]\r
- default = ""\r
- type = folder\r
- value = \r
- \r
- [[prefix]]\r
- default = ""\r
- type = string\r
- value = \r
- \r
- [[separator]]\r
- default = ","\r
- type = string\r
- value = ","\r
-\r
-[overlay]\r
- [[prefix]]\r
- default = overlay_\r
- type = string\r
- value = overlay_\r
-\r
-[notes]\r
- [[filename]]\r
- default = notes\r
- type = string\r
- value = notes\r
- \r
- [[folder]]\r
- default = ""\r
- type = folder\r
- value = \r
- \r
- [[prefix]]\r
- default = notes_\r
- type = string\r
- value = notes_\r
- \r
- [[use_playlist_filename]]\r
- default = False\r
- type = boolean\r
- value = False\r
-\r
-[results]\r
- [[append]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[filename]]\r
- default = results.txt\r
- type = filename\r
- value = results.txt\r
- \r
- [[separator]]\r
- default = ","\r
- type = string\r
- value = ","\r
++[fits]
++ [[ext]]
++ default = txt
++ type = string
++ value = txt
++
++ [[folder]]
++ default = ""
++ type = folder
++ value =
++
++ [[prefix]]
++ default = ""
++ type = string
++ value =
++
++ [[separator]]
++ default = ","
++ type = string
++ value = ","
++
++[force_curve]
++ [[ext]]
++ default = txt
++ type = string
++ value = txt
++
++ [[folder]]
++ default = ""
++ type = folder
++ value =
++
++ [[prefix]]
++ default = ""
++ type = string
++ value =
++
++ [[separator]]
++ default = ","
++ type = string
++ value = ","
++
++[overlay]
++ [[prefix]]
++ default = overlay_
++ type = string
++ value = overlay_
++
++[notes]
++ [[filename]]
++ default = notes
++ type = string
++ value = notes
++
++ [[folder]]
++ default = ""
++ type = folder
++ value =
++
++ [[prefix]]
++ default = notes_
++ type = string
++ value = notes_
++
++ [[use_playlist_filename]]
++ default = False
++ type = boolean
++ value = False
++
++[results]
++ [[append]]
++ default = True
++ type = boolean
++ value = True
++
++ [[filename]]
++ default = results.txt
++ type = filename
++ value = results.txt
++
++ [[separator]]
++ default = ","
++ type = string
++ value = ","
- [fit]
- flatten = 1
- temperature = 301
-[fjc]\r
- [[temperature]]\r
- default = 293\r
- minimum = 0\r
- type = float\r
- value = 293\r
-\r
-[fjcPEG]\r
- [[delta_G]]\r
- default = 3\r
- minimum = 0\r
- type = float\r
- value = 3\r
-\r
- [[L_helical]]\r
- default = 0.28\r
- minimum = 0\r
- type = float\r
- value = 0.28\r
-\r
- [[L_planar]]\r
- default = 0.358\r
- minimum = 0\r
- type = float\r
- value = 0.358\r
-\r
- [[temperature]]\r
- default = 293\r
- minimum = 0\r
- type = float\r
- value = 293\r
-\r
-[wlc]\r
- [[temperature]]\r
- default = 293\r
- minimum = 0\r
- type = float\r
- value = 293\r
++[fjc]
++ [[temperature]]
++ default = 293
++ minimum = 0
++ type = float
++ value = 293
++
++[fjcPEG]
++ [[delta_G]]
++ default = 3
++ minimum = 0
++ type = float
++ value = 3
++
++ [[L_helical]]
++ default = 0.28
++ minimum = 0
++ type = float
++ value = 0.28
++
++ [[L_planar]]
++ default = 0.358
++ minimum = 0
++ type = float
++ value = 0.358
++
++ [[temperature]]
++ default = 293
++ minimum = 0
++ type = float
++ value = 293
++
++[wlc]
++ [[temperature]]
++ default = 293
++ minimum = 0
++ type = float
++ value = 293
--- /dev/null
-[convfilt]\r
- [[apply_plotmanipulators]]\r
- default = all\r
- elements = all, flatten, none\r
- type = enum\r
- value = all\r
- \r
- [[blindwindow]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 0\r
- type = float\r
- value = 20\r
- \r
- [[convolution]]\r
- default = "[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]"\r
- type = string\r
- value = "[6.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0]"\r
- \r
- [[maxcut]]\r
- default = 0.2\r
- maximum = 1\r
- minimum = 0\r
- type = float\r
- value = 0.2\r
- \r
- [[medianfilter]]\r
- default = 7\r
- maximum = 100\r
- minimum = 0\r
- type = integer\r
- value = 7\r
- \r
- [[mindeviation]]\r
- default = 5\r
- maximum = 100\r
- minimum = 0\r
- type = float\r
- value = 5\r
- \r
- [[minpeaks]]\r
- default = 5\r
- maximum = 20\r
- minimum = 0\r
- type = integer\r
- value = 5\r
- \r
- [[positive]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[seedouble]]\r
- default = 10\r
- maximum = 1000\r
- minimum = 0\r
- type = integer\r
- value = 10\r
- \r
- [[stable]]\r
- default = 0.005\r
- maximum = 1\r
- minimum = 0\r
- type = float\r
- value = 0.005\r
-\r
-[flatfilt]\r
- [[min_npks]]\r
- default = 4\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 4\r
- \r
- [[min_deviation]]\r
- default = 9\r
- maximum = 100\r
- minimum = 1\r
- type = float\r
- value = 9\r
-\r
-[peaks]\r
- [[color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[size]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 20\r
++[convfilt]
++ [[apply_plotmanipulators]]
++ default = all
++ elements = all, flatten, none
++ type = enum
++ value = all
++
++ [[blindwindow]]
++ default = 20
++ maximum = 10000
++ minimum = 0
++ type = float
++ value = 20
++
++ [[convolution]]
++ default = "[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]"
++ type = string
++ value = "[6.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0]"
++
++ [[maxcut]]
++ default = 0.2
++ maximum = 1
++ minimum = 0
++ type = float
++ value = 0.2
++
++ [[medianfilter]]
++ default = 7
++ maximum = 100
++ minimum = 0
++ type = integer
++ value = 7
++
++ [[mindeviation]]
++ default = 5
++ maximum = 100
++ minimum = 0
++ type = float
++ value = 5
++
++ [[minpeaks]]
++ default = 5
++ maximum = 20
++ minimum = 0
++ type = integer
++ value = 5
++
++ [[positive]]
++ default = False
++ type = boolean
++ value = False
++
++ [[seedouble]]
++ default = 10
++ maximum = 1000
++ minimum = 0
++ type = integer
++ value = 10
++
++ [[stable]]
++ default = 0.005
++ maximum = 1
++ minimum = 0
++ type = float
++ value = 0.005
++
++[flatfilt]
++ [[min_npks]]
++ default = 4
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 4
++
++ [[min_deviation]]
++ default = 9
++ maximum = 100
++ minimum = 1
++ type = float
++ value = 9
++
++[peaks]
++ [[color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[size]]
++ default = 20
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 20
-[distance]\r
- [[color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[decimals]]\r
- default = 2\r
- maximum = 10\r
- minimum = 0\r
- type = integer\r
- value = 2\r
- \r
- [[prefix]]\r
- default = n\r
- elements = n, p\r
- type = enum\r
- value = n\r
- \r
- [[show]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[show_in_legend]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[size]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 20\r
- \r
- [[whatset]]\r
- default = retraction\r
- elements = extension, retraction\r
- type = enum\r
- value = retraction\r
-\r
-[force]\r
- [[color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[decimals]]\r
- default = 2\r
- maximum = 10\r
- minimum = 0\r
- type = integer\r
- value = 2\r
- \r
- [[prefix]]\r
- default = p\r
- elements = n, p\r
- type = enum\r
- value = p\r
- \r
- [[show]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[show_in_legend]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[size]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 20\r
- \r
- [[whatset]]\r
- default = retraction\r
- elements = extension, retraction\r
- type = enum\r
- value = retraction\r
-\r
-[forcebase]\r
- [[baseline_color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[baseline_show]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[baseline_show_in_legend]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[baseline_size]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 20\r
- \r
- [[decimals]]\r
- default = 2\r
- maximum = 10\r
- minimum = 0\r
- type = integer\r
- value = 2\r
- \r
- [[max]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[maximum_color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[maximum_show]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[maximum_show_in_legend]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[maximum_size]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 20\r
- \r
- [[maximumrange_color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[maximumrange_show]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[maximumrange_show_in_legend]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[maximumrange_size]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 20\r
- \r
- [[prefix]]\r
- default = p\r
- elements = n, p\r
- type = enum\r
- value = p\r
- \r
- [[rebase]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[whatset]]\r
- default = retraction\r
- elements = extension, retraction\r
- type = enum\r
- value = retraction\r
-\r
-[generalvclamp]\r
- [[flatten]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[max_cycles]]\r
- default = 1\r
- maximum = 100\r
- minimum = 0\r
- type = integer\r
- value = 1\r
- \r
- [[force_multiplier]]\r
- default = 1\r
- maximum = 100\r
- minimum = 0\r
- type = float\r
- value = 1\r
-\r
-[slope]\r
- [[decimals]]\r
- default = 5\r
- maximum = 10\r
- minimum = 0\r
- type = integer\r
- value = 5\r
- \r
- [[fitspan]]\r
- default = 0\r
- maximum = 10000\r
- minimum = 0\r
- type = integer\r
- value = 0\r
- \r
- [[point_color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[point_show]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[point_show_in_legend]]\r
- default = True\r
- type = boolean\r
- value = False\r
- \r
- [[point_size]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 20\r
- \r
- [[slope_color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[slope_linewidth]]\r
- default = 1\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 1\r
- \r
- [[slope_show]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[slope_show_in_legend]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[whatset]]\r
- default = retraction\r
- elements = extension, retraction\r
- type = enum\r
- value = retraction\r
++[distance]
++ [[color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[decimals]]
++ default = 2
++ maximum = 10
++ minimum = 0
++ type = integer
++ value = 2
++
++ [[prefix]]
++ default = n
++ elements = n, p
++ type = enum
++ value = n
++
++ [[show]]
++ default = True
++ type = boolean
++ value = True
++
++ [[show_in_legend]]
++ default = True
++ type = boolean
++ value = True
++
++ [[size]]
++ default = 20
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 20
++
++ [[whatset]]
++ default = retraction
++ elements = extension, retraction
++ type = enum
++ value = retraction
++
++[force]
++ [[color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[decimals]]
++ default = 2
++ maximum = 10
++ minimum = 0
++ type = integer
++ value = 2
++
++ [[prefix]]
++ default = p
++ elements = n, p
++ type = enum
++ value = p
++
++ [[show]]
++ default = True
++ type = boolean
++ value = True
++
++ [[show_in_legend]]
++ default = True
++ type = boolean
++ value = True
++
++ [[size]]
++ default = 20
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 20
++
++ [[whatset]]
++ default = retraction
++ elements = extension, retraction
++ type = enum
++ value = retraction
++
++[forcebase]
++ [[baseline_color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[baseline_show]]
++ default = True
++ type = boolean
++ value = True
++
++ [[baseline_show_in_legend]]
++ default = True
++ type = boolean
++ value = True
++
++ [[baseline_size]]
++ default = 20
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 20
++
++ [[decimals]]
++ default = 2
++ maximum = 10
++ minimum = 0
++ type = integer
++ value = 2
++
++ [[max]]
++ default = False
++ type = boolean
++ value = False
++
++ [[maximum_color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[maximum_show]]
++ default = True
++ type = boolean
++ value = True
++
++ [[maximum_show_in_legend]]
++ default = True
++ type = boolean
++ value = True
++
++ [[maximum_size]]
++ default = 20
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 20
++
++ [[maximumrange_color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[maximumrange_show]]
++ default = True
++ type = boolean
++ value = True
++
++ [[maximumrange_show_in_legend]]
++ default = True
++ type = boolean
++ value = True
++
++ [[maximumrange_size]]
++ default = 20
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 20
++
++ [[prefix]]
++ default = p
++ elements = n, p
++ type = enum
++ value = p
++
++ [[rebase]]
++ default = False
++ type = boolean
++ value = False
++
++ [[whatset]]
++ default = retraction
++ elements = extension, retraction
++ type = enum
++ value = retraction
++
+[generalvclamp]
+ [[flatten]]
+ default = True
+ type = boolean
+ value = True
-
++
+ [[max_cycles]]
+ default = 1
+ maximum = 100
+ minimum = 0
+ type = integer
+ value = 1
-
++
+ [[force_multiplier]]
+ default = 1
+ maximum = 100
+ minimum = 0
+ type = float
+ value = 1
++
++[slope]
++ [[decimals]]
++ default = 5
++ maximum = 10
++ minimum = 0
++ type = integer
++ value = 5
++
++ [[fitspan]]
++ default = 0
++ maximum = 10000
++ minimum = 0
++ type = integer
++ value = 0
++
++ [[point_color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[point_show]]
++ default = False
++ type = boolean
++ value = False
++
++ [[point_show_in_legend]]
++ default = True
++ type = boolean
++ value = False
++
++ [[point_size]]
++ default = 20
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 20
++
++ [[slope_color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[slope_linewidth]]
++ default = 1
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 1
++
++ [[slope_show]]
++ default = True
++ type = boolean
++ value = True
++
++ [[slope_show_in_legend]]
++ default = True
++ type = boolean
++ value = True
++
++ [[whatset]]
++ default = retraction
++ elements = extension, retraction
++ type = enum
++ value = retraction
--- /dev/null
-[multidistance]\r
- [[apply_plotmanipulators]]\r
- default = all\r
- elements = all, flatten, none\r
- type = enum\r
- value = all\r
- \r
- [[blindwindow]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 0\r
- type = float\r
- value = 20\r
- \r
- [[color]]\r
- default = black\r
- type = color\r
- value = "(0,0,0)"\r
- \r
- [[convolution]]\r
- default = "[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]"\r
- type = string\r
- value = "[6.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0]"\r
- \r
- [[maxcut]]\r
- default = 0.2\r
- maximum = 1\r
- minimum = 0\r
- type = float\r
- value = 0.2\r
- \r
- [[medianfilter]]\r
- default = 7\r
- maximum = 100\r
- minimum = 0\r
- type = integer\r
- value = 7\r
- \r
- [[mindeviation]]\r
- default = 5\r
- maximum = 100\r
- minimum = 0\r
- type = float\r
- value = 5\r
- \r
- [[minpeaks]]\r
- default = 5\r
- maximum = 20\r
- minimum = 0\r
- type = integer\r
- value = 5\r
- \r
- [[positive]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[seedouble]]\r
- default = 10\r
- maximum = 1000\r
- minimum = 0\r
- type = integer\r
- value = 10\r
- \r
- [[size]]\r
- default = 20\r
- maximum = 10000\r
- minimum = 1\r
- type = integer\r
- value = 20\r
- \r
- [[stable]]\r
- default = 0.005\r
- maximum = 1\r
- minimum = 0\r
- type = float\r
- value = 0.005\r
- \r
- [[use_convfilt]]\r
- default = False\r
- type = boolean\r
- value = False\r
++[multidistance]
++ [[apply_plotmanipulators]]
++ default = all
++ elements = all, flatten, none
++ type = enum
++ value = all
++
++ [[blindwindow]]
++ default = 20
++ maximum = 10000
++ minimum = 0
++ type = float
++ value = 20
++
++ [[color]]
++ default = black
++ type = color
++ value = "(0,0,0)"
++
++ [[convolution]]
++ default = "[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]"
++ type = string
++ value = "[6.0,-1.0,-1.0,-1.0,-1.0,-1.0,-1.0]"
++
++ [[maxcut]]
++ default = 0.2
++ maximum = 1
++ minimum = 0
++ type = float
++ value = 0.2
++
++ [[medianfilter]]
++ default = 7
++ maximum = 100
++ minimum = 0
++ type = integer
++ value = 7
++
++ [[mindeviation]]
++ default = 5
++ maximum = 100
++ minimum = 0
++ type = float
++ value = 5
++
++ [[minpeaks]]
++ default = 5
++ maximum = 20
++ minimum = 0
++ type = integer
++ value = 5
++
++ [[positive]]
++ default = False
++ type = boolean
++ value = False
++
++ [[seedouble]]
++ default = 10
++ maximum = 1000
++ minimum = 0
++ type = integer
++ value = 10
++
++ [[size]]
++ default = 20
++ maximum = 10000
++ minimum = 1
++ type = integer
++ value = 20
++
++ [[stable]]
++ default = 0.005
++ maximum = 1
++ minimum = 0
++ type = float
++ value = 0.005
++
++ [[use_convfilt]]
++ default = False
++ type = boolean
++ value = False
--- /dev/null
-[genlist]\r
- [[detect_mfp1d]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[folder]]\r
- default = ""\r
- type = folder\r
- value = \r
- \r
- [[filemask]]\r
- default = *.*\r
- type = string\r
- value = *.*\r
-\r
-[loadlist]\r
- [[filename]]\r
- default = test.hkp\r
- type = filename\r
- value = test.hkp\r
-\r
-[savelist]\r
- [[filename]]\r
- default = untitled.hkp\r
- type = filename\r
- value = untitled.hkp\r
++[genlist]
++ [[detect_mfp1d]]
++ default = False
++ type = boolean
++ value = False
++
++ [[folder]]
++ default = ""
++ type = folder
++ value =
++
++ [[filemask]]
++ default = *.*
++ type = string
++ value = *.*
++
++[loadlist]
++ [[filename]]
++ default = test.hkp
++ type = filename
++ value = test.hkp
++
++[savelist]
++ [[filename]]
++ default = untitled.hkp
++ type = filename
++ value = untitled.hkp
--- /dev/null
-[preferences]\r
- [[legend]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[x_decimals]]\r
- default = 2\r
- maximum = 10\r
- minimum = 0\r
- type = integer\r
- value = 2\r
- \r
- [[x_prefix]]\r
- default = n\r
- elements = n, p\r
- type = enum\r
- value = n\r
- \r
- [[y_decimals]]\r
- default = 2\r
- maximum = 10\r
- minimum = 0\r
- type = integer\r
- value = 2\r
- \r
- [[y_prefix]]\r
- default = n\r
- elements = n, p\r
- type = enum\r
- value = n\r
- \r
++[preferences]
++ [[legend]]
++ default = False
++ type = boolean
++ value = False
++
++ [[x_decimals]]
++ default = 2
++ maximum = 10
++ minimum = 0
++ type = integer
++ value = 2
++
++ [[x_prefix]]
++ default = n
++ elements = n, p
++ type = enum
++ value = n
++
++ [[y_decimals]]
++ default = 2
++ maximum = 10
++ minimum = 0
++ type = integer
++ value = 2
++
++ [[y_prefix]]
++ default = n
++ elements = n, p
++ type = enum
++ value = n
++
-[convplot]\r
- [[column]]\r
- default = 1\r
- maximum = 20\r
- minimum = 1\r
- type = integer\r
- value = 1\r
- \r
- [[convolution]]\r
- default = "[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]"\r
- type = string\r
- value = "[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]"\r
- \r
- [[row]]\r
- default = 2\r
- maximum = 20\r
- minimum = 1\r
- type = integer\r
- value = 2\r
- \r
- [[whatset]]\r
- default = retraction\r
- elements = extension, retraction, both\r
- type = enum\r
- value = retraction\r
-\r
-[derivplot]\r
- [[column]]\r
- default = 1\r
- maximum = 20\r
- minimum = 1\r
- type = integer\r
- value = 1\r
- \r
- [[row]]\r
- default = 2\r
- maximum = 20\r
- minimum = 1\r
- type = integer\r
- value = 2\r
- \r
- [[select]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[whatset]]\r
- default = retraction\r
- elements = extension, retraction, both\r
- type = enum\r
- value = retraction\r
-\r
-[fft]\r
- [[column]]\r
- default = 1\r
- maximum = 20\r
- minimum = 1\r
- type = integer\r
- value = 1\r
- \r
- [[row]]\r
- default = 2\r
- maximum = 20\r
- minimum = 1\r
- type = integer\r
- value = 2\r
- \r
- [[select]]\r
- default = False\r
- type = boolean\r
- value = False\r
- \r
- [[whatset]]\r
- default = retraction\r
- elements = extension, retraction, both\r
- type = enum\r
- value = retraction\r
-\r
-[procplots]\r
- [[centerzero]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[correct]]\r
- default = True\r
- type = boolean\r
- value = True\r
- \r
- [[median]]\r
- default = 0\r
- maximum = 100\r
- minimum = 0\r
- type = integer\r
- value = 0\r
++[convplot]
++ [[column]]
++ default = 1
++ maximum = 20
++ minimum = 1
++ type = integer
++ value = 1
++
++ [[convolution]]
++ default = "[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]"
++ type = string
++ value = "[6.0, -1.0, -1.0, -1.0, -1.0, -1.0, -1.0]"
++
++ [[row]]
++ default = 2
++ maximum = 20
++ minimum = 1
++ type = integer
++ value = 2
++
++ [[whatset]]
++ default = retraction
++ elements = extension, retraction, both
++ type = enum
++ value = retraction
++
++[derivplot]
++ [[column]]
++ default = 1
++ maximum = 20
++ minimum = 1
++ type = integer
++ value = 1
++
++ [[row]]
++ default = 2
++ maximum = 20
++ minimum = 1
++ type = integer
++ value = 2
++
++ [[select]]
++ default = False
++ type = boolean
++ value = False
++
++ [[whatset]]
++ default = retraction
++ elements = extension, retraction, both
++ type = enum
++ value = retraction
++
++[fft]
++ [[column]]
++ default = 1
++ maximum = 20
++ minimum = 1
++ type = integer
++ value = 1
++
++ [[row]]
++ default = 2
++ maximum = 20
++ minimum = 1
++ type = integer
++ value = 2
++
++ [[select]]
++ default = False
++ type = boolean
++ value = False
++
++ [[whatset]]
++ default = retraction
++ elements = extension, retraction, both
++ type = enum
++ value = retraction
++
+[procplots]
++ [[centerzero]]
++ default = True
++ type = boolean
++ value = True
++
++ [[correct]]
++ default = True
++ type = boolean
++ value = True
++
+ [[median]]
+ default = 0
+ maximum = 100
+ minimum = 0
+ type = integer
+ value = 0
-
- [[correct]]
- default = True
- type = boolean
- value = True
--- /dev/null
-[show_results]\r
- [[result_type]]\r
- default = wlc\r
- elements = wlc, fjc, fjcPEG, multidistance\r
- type = enum\r
- value = wlc\r
++[show_results]
++ [[result_type]]
++ default = wlc
++ elements = wlc, fjc, fjcPEG, multidistance
++ type = enum
++ value = wlc
--- /dev/null
- You can dock/undock all windows except for plot tab (I would like to
- disable docking above the menubar and instead have the windows dock
- beneath the menubar)
+*****************
+The GUI interface
+*****************
+
+by Rolf Schmidt <rschmidt@alcor.concordia.ca>
+
- You can save perspectives (delete perspectives however does not work yet).
++Enable by selecting `gui` in your :file:`hooke.cfg`.::
+
- The 'Navigation' menubar works, the 'Main' menubar does not work yet.
++ [user interfaces]
++ command line = False
++ gui = True
+
- Closing plot tabs does not work properly, feedback on specific
- examples and error messages would be much appreciated
++Interface
++=========
+
- In the 'Folders' pane you can double-click playlists (with hkp
- extension) to open them (you cannot double-click curves to open them)
++Starting Hooke's GUI for the first time, you will see the central plot
++area with the current plot surrounded by the following windows (the `F*`
++key toggles the visibility of the panel):
+
- Commands in the 'Commands'-pane that work
++ # Folders (`F5`)
++ # Playlists (`F6`)
++ # Commands (or Settings and commands) (`F7`)
++ # Properties (`F8`)
++ # Assistant (`F9`)
++ # Results (`F10`)
++ # Output (`F11`)
++ # Note (`F12`)
+
- * autopeak (only partially, everything that has to do with clicking on the plot does not work)
- * genlist
- * loadlist
- * convfilt
- * flatfilt
++.. img:: img/gui_screenshot.jpg
+
- When you open or generate a playlist, Hooke seems to hang. This is
- actually not the case, just wait. Hooke loads all the curves into
- memory and applies all the plotmanipulators. In the future, there will
- be a progressbar to indicate the progress.
++Initially, the window will be rather small in order to work with small
++screen resolutions. Adjust the size and position to your liking.
+
++Above the windows you see the navigation toolbar to switch from one
++curve to another (next/previous).
++
++Plot area
++=========
++
++The plot area can be customised by setting `preferences` in the core plugin.
++
++* hide_curve_extension: hides the curve extension in the title of the
++ plot (and from the playlist in the playlists panel)
++* legend: show or hide the legend
++* use_zero: display `0` instead of e.g. `0.00` on the axes
++* decimals (x_decimals, y_decimals): set the decimal places for the x
++ and y axes
++* prefixes(x_prefix, y_prefix): set the prefix for the x and y axes
++
++These are global settings. Individual plots can be customised with the
++same options (except hide_curve_extension) by setting `preferences` in
++the plot plugin.
++
++Folders
++=======
++Here you can navigate your file system and double click on a saved
++playlist to open it. You can change the initial folder by modifying
++`workdir` in the `preferences` (core plugin).
++
++Playlists
++=========
++You can manage several playlists in this window. As the GUI is rather
++flexible, it is possible to display the curves from different
++playlists side by side to compare them (relatively handy when
++comparing different fit parameters). You can double-click a file in
++the playlist to display it in the plot area. Deleting entire playlists
++or single files can be accomplished by right-clicking and selecting
++`Delete`.
++
++Commands (or Settings and commands)
++===================================
++
++All available commands are listed under their corresponding plugin. In
++order to see a plugin and its commands, you have to edit
++:file:`hooke.conf` and enable th plugin in the plugins section.
++Selecting a plugin or command will display the associated help in the
++`Assistant`_ window. You can edit the properties of the selected
++command in the `Properties`_ window and click `Execute` to run the
++selected command. If you do not need to modify any properties, you can
++also double-click a command to run it.
++
++Properties
++==========
++The properties for the command selected in the `Commands`_ window are
++displayed here. Edit the properties to your satisfaction (some need to
++be confirmed by hitting enter, this seems to be a problem in
++wxPropertyGrid) and click the `Execute` button to run the selected
++command. Floating point values are limited to a certain number of
++decimals (limitation of wxPropertyGrid?) so be careful when using
++floating point values.
++
++Assistant
++=========
++Selecting a plugin or command in the `Commands`_ window will display the
++associated help here. The help for the plugin should give a general
++description of the plugin. The help for a command should describe the
++properties available for this command and suggest reasonable default
++values if possible. Feel free to point out missing help content.
++
++Results
++=======
++The results from the `autopeak` or `multidistance` commands are
++displayed here. Initially, all results are checked (i.e. visible). If
++you want to hide a result, simply uncheck it. Hidden curves will not
++be exported either. You can only display one type of fit result (WLC,
++FJC, etc.) at a time and you can switch between result types (results
++plugin - show_results).
++
++Output
++======
++The Output window serves as a log where pertinent information is
++displayed. If something does not work the way you expect it, have a
++look here to see if there is more information available.
++
++Note
++====
++A note can be added to every curve: enter your note and click
++`Update note`. With the copylog command (core plugin) you can copy all
++the files with a note to a different folder.
++
++General remarks
++===============
++Ignore the text on the `Welcome` tab. This tab is more like a proof of
++principle and will contain a short how-to in the future (once the
++howto is written).
++
++Hooke's GUI will remember the size and position of the main window
++(stored in ~/.hooke-gui.cfg). You can arrange the panels any which
++way you like and save this arrangement as a perspective.
++
++.. img:: img/gui_perspective.jpg
++
++Hooke will always start with the last used perspective and you can
++switch from one perspective to another by selecting a perspective from
++the perspectives menu. After deleting a perspective, the radio
++indicator in the perspectives menu disappears (known bug in
++wxPython). This is only a visual problem and does not affect anything
++else.
++
++In order to pan the plot, zoom in and out and export the plot of your
++force curves, use the plot toolbar under the plot. A more detailed
++description is available on the
++[http://matplotlib.sourceforge.net/users/navigation_toolbar.html
++matplotlib website].
++
++== Some plugins and commands ==
++ * replot (plot): replots the current force curve from scratch eliminating any secondary plots
++ * fjc/fjcPEG/wlc (fit): do not use any of these commands directly, they are not implemented properly yet. However, the properties you set for these commands are used for the autopeak command
++ * plotmanipulators (core): select the plotmanipulators you want to use and arrange them in the proper order
++ * test (test): use this for testing purposes. You find do_test in hooke.py
++ * clear_results (results): deletes all fitting results from the curve
++ * show_results (results): select which fitting results should be displayed on the plot
++ * overlay (export): exports all retraction curves in a playlist on the same scale. This is achieved by determining the maximum x window and adding x(max) and x(min) to all curves that are shorter than the maximum x window. Make sure to filter your playlist before running this command!
++
++== Basic analysis and autopeak ==
++Please follow the steps for basic analysis described [BasicAnalysis here]. Instead of typing in the command at the command-line, select it in the Commands window, set your properties in the Properties window and click on 'Execute'.
++
++The [Brief_Autopeak_HowTo autopeak] tutorial is also applicable. In Hooke(GUI) you need to setup the type of fit you want to use: in the Properties of the autopeak command (autopeak plugin) select wlc, fjc or fjcPEG from the dropdown list for the fit_function.
++
++If you run different fits (e.g. WLC and FJC) you can switch the display of the results with the show_results command (results plugin).
++
++== Brief plugin/Properties tutorial ==
++Have a look at the files in the _plugins_ folder. The python files contain the plotmanipulators (i.e. plotmanip_NAME), commands (i.e. do_COMMAND) and auxilliary methods. The ini files contain the information for the Properties window. You can already use a fair number of datatypes (e.g. integer, float, boolean, list, color, etc.) and more can be added. Be careful when using floats as there is a limit to the number of decimals (see above). The plotmanipulators and commands should read the properties directly from the ini file instead of having them passed to them as arguments. For the time being, accessor methods are located in hooke.py (e.g. GetBoolFromConfig()).
++A more detailed description will be made available.
- # Copyright (C) 2008-2010 Massimo Sandal <devicerandom@gmail.com>
- # W. Trevor King <wking@drexel.edu>
- #
- # This file is part of Hooke.
- #
- # Hooke is free software: you can redistribute it and/or
- # modify it under the terms of the GNU Lesser General Public
- # License as published by the Free Software Foundation, either
- # version 3 of the License, or (at your option) any later version.
- #
- # Hooke is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU Lesser General Public License for more details.
- #
- # You should have received a copy of the GNU Lesser General Public
- # License along with Hooke. If not, see
- # <http://www.gnu.org/licenses/>.
-#!/usr/bin/env python
++# Copyright
-'''
-csvdriver.py
-
-Simple driver to read general comma-separated values in Hooke
+"""Simple driver to read general comma-separated values in Hooke
Columns are read this way:
X1 , Y1 , X2 , Y2 , X3 , Y3 ...
If the number of columns is odd, the last column is ignored.
-
-Copyright 2008 by Massimo Sandal
-with modifications by Dr. Rolf Schmidt (Concordia University, Canada)
-
-This program is released under the GNU General Public License version 2.
-'''
+"""
- from .. import curve as lhc
- from .. import libhooke as lh
import csv
-
- class csvdriverDriver(lhc.Driver):
-
- def __init__(self, filename):
-
- self.filedata = open(filename,'r')
- self.data = list(self.filedata)
- self.filedata.close()
-
- self.filetype = 'generic'
- self.experiment = ''
-
- self.filename=filename
-
- def is_me(self):
- myfile=file(self.filename)
- headerline=myfile.readlines()[0]
- myfile.close()
-
- #using a custom header makes things much easier...
- #(looking for raw CSV data is at strong risk of confusion)
- if headerline[:-1]=='Hooke data':
- return True
- else:
- return False
-
- def close_all(self):
- self.filedata.close()
-
- def default_plots(self):
- rrows=csv.reader(self.data)
- rows=list(rrows) #transform the csv.reader iterator in a normal list
- columns=lh.transposed2(rows[1:])
-
- main_plot=lhc.PlotObject()
- main_plot.vectors=[]
-
- for index in range(0,len(columns),2):
- main_plot.vectors.append([])
- temp_x=columns[index]
- temp_y=columns[index+1]
-
- #convert to float (the csv gives strings)
- temp_x=[float(item) for item in temp_x]
- temp_y=[float(item) for item in temp_y]
-
- main_plot.vectors[-1].append(temp_x)
- main_plot.vectors[-1].append(temp_y)
-
- main_plot.units=['x','y']
- main_plot.title=self.filename
- main_plot.destination=0
-
- return [main_plot]
+ import os.path
+
+ import lib.curve
+ import lib.driver
+ import lib.libhooke
+ import lib.plot
+
+ class csvdriverDriver(lib.driver.Driver):
+
+ def __init__(self, filename):
+
+ self.filedata = open(filename,'r')
+ self.data = list(self.filedata)
+ self.filedata.close()
+
+ self.filetype = 'generic'
+ self.experiment = ''
+
+ self.filename=filename
+
+ def close_all(self):
+ self.filedata.close()
+
+ def default_plots(self):
+ rrows=csv.reader(self.data)
+ rows=list(rrows) #transform the csv.reader iterator into a normal list
+ columns=lib.libhooke.transposed2(rows[1:])
+
+ for index in range(0, len(columns), 2):
+ temp_x=columns[index]
+ temp_y=columns[index+1]
+ #convert to float (the csv gives strings)
+ temp_x=[float(item) for item in temp_x]
+ temp_y=[float(item) for item in temp_y]
+
+ curve = lib.curve.Curve()
+
+ curve.destination.row = index + 1
+ curve.label = 'curve ' + str(index)
+ curve.style = 'plot'
+ curve.units.x = 'x'
+ curve.units.y = 'y'
+ curve.x = temp_x
+ curve.y = temp_y
+
+ plot = lib.plot.Plot()
+ plot.title = os.path.basename(self.filename)
+ plot.curves.append(curve)
+
+ #TODO: is normalization helpful or detrimental here?
+ #plot.normalize()
+ return plot
+
+ def is_me(self):
+ myfile=file(self.filename)
+ headerline=myfile.readlines()[0]
+ myfile.close()
+
+ #using a custom header makes things much easier...
+ #(looking for raw CSV data is at strong risk of confusion)
+ if headerline[:-1]=='Hooke data':
+ return True
+ else:
+ return False
-
- # Copyright (C) 2009-2010 Allen Chen
- # Massimo Sandal <devicerandom@gmail.com>
- # W. Trevor King <wking@drexel.edu>
- #
- # This file is part of Hooke.
- #
- # Hooke is free software: you can redistribute it and/or
- # modify it under the terms of the GNU Lesser General Public
- # License as published by the Free Software Foundation, either
- # version 3 of the License, or (at your option) any later version.
- #
- # Hooke is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU Lesser General Public License for more details.
- #
- # You should have received a copy of the GNU Lesser General Public
- # License along with Hooke. If not, see
- # <http://www.gnu.org/licenses/>.
-
- """Driver for mcs fluorescence files
-#!/usr/bin/env python
++# Copyright
+
-'''
-mcs.py
-
-Driver for mcs fluorescence files.
-
-Copyright 2009 by Massimo Sandal, Allen Chen
-with modifications by Dr. Rolf Schmidt (Concordia University, Canada)
-
-This program is released under the GNU General Public License version 2.
-'''
++"""Driver for mcs fluorescence files.
+"""
- from .. import curve as lhc
- from .. import libhooke as lh
+ import os.path
+
+ import lib.curve
+ import lib.driver
+ import lib.plot
import struct
- class mcsDriver(lhc.Driver):
+ class mcsDriver(lib.driver.Driver):
def __init__(self, filename):
'''
--- /dev/null
- TODO: autopeak docstring.
+# Copyright (C) 2008-2010 Alberto Gomez-Casado
+# Fabrizio Benedetti
+# Marco Brucale
+# Massimo Sandal <devicerandom@gmail.com>
+# W. Trevor King <wking@drexel.edu>
+#
+# This file is part of Hooke.
+#
+# Hooke is free software: you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation, either
+# version 3 of the License, or (at your option) any later version.
+#
+# Hooke is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with Hooke. If not, see
+# <http://www.gnu.org/licenses/>.
+
+"""The autopeak module provides :class:`Autopeak`, a
+:class:`hooke.plugin.Plugin` for automatically extracting force peaks
+(unfolding events) from force curves.
+"""
+
+from hooke.libhooke import WX_GOOD
+
+import wxversion
+wxversion.select(WX_GOOD)
+from wx import PostEvent
+import numpy as np
+import scipy as sp
+import copy
+import os.path
+import time
+
+import warnings
+warnings.simplefilter('ignore',np.RankWarning)
+
+#from .. import ui.gui.results as results
+
+
+class autopeakCommands(object):
+ '''
++ Autopeak carries out force curve fitting with a chosen model:
++ - WLC
++ - FJC
++ - FJC-PEG
+ '''
+ def do_autopeak(self, args):
+ '''
+ AUTOPEAK
+ (autopeak.py)
+ Automatically performs a number of analyses on the peaks of the given curve.
+ Currently it automatically:
+ - fits peaks with WLC or FJC function (depending on how the fit_function variable is set)
+ - measures peak maximum forces with a baseline
+ - measures slope in proximity of peak maximum
+ Requires flatten plotmanipulator , fit.py plugin , flatfilts.py plugin with convfilt
+
+ Syntax:
+ autopeak [rebase] [pl=value] [t=value] [noauto] [reclick]
+
+ rebase : Re-asks baseline interval
+
+ pl=[value] : Use a fixed persistent length for the fit. If pl is not given,
+ the fit will be a 2-variable
+ fit. DO NOT put spaces between 'pl', '=' and the value.
+ The value must be in meters.
+ Scientific notation like 0.35e-9 is fine.
+
+ t=[value] : Use a user-defined temperature. The value must be in
+ kelvins; by default it is 293 K.
+ DO NOT put spaces between 't', '=' and the value.
+
+ noauto : allows for clicking the contact point by
+ hand (otherwise it is automatically estimated) the first time.
+ If subsequent measurements are made, the same contact point
+ clicked the first time is used
+
+ reclick : redefines by hand the contact point, if noauto has been used before
+ but the user is unsatisfied of the previously choosen contact point.
+
+ usepoints : fit interval by number of points instead than by nanometers
+
+ noflatten : does not use the "flatten" plot manipulator
+
+ When you first issue the command, it will ask for the filename. If you are giving the filename
+ of an existing file, autopeak will resume it and append measurements to it. If you are giving
+ a new filename, it will create the file and append to it until you close Hooke.
+
+
+ Useful variables (to set with SET command):
+ ---
+ fit_function = type of function to use for elasticity. If "wlc" worm-like chain is used, if "fjc" freely jointed
+ chain is used
+
+ temperature= temperature of the system for wlc/fjc fit (in K)
+
+ auto_slope_span = number of points on which measure the slope, for slope
+
+ auto_fit_nm = number of nm to fit before the peak maximum, for WLC/FJC (if usepoints false)
+ auto_fit_points = number of points to fit before the peak maximum, for WLC/FJC (if usepoints true)
+
+ baseline_clicks = -1: no baseline, f=0 at the contact point (whether hand-picked or automatically found)
+ 0: automatic baseline
+ 1: decide baseline with a single click and length defined in auto_left_baseline
+ 2: let user click points of baseline
+ auto_left_baseline = length in nm to use as baseline from the right point (if baseline_clicks=0 , 1)
+ auto_right_baseline = distance in nm of peak-most baseline point from last peak (if baseline_clicks = 0)
+
+ auto_min_p ; auto_max_p = Minimum and maximum persistence length (if using WLC) or Kuhn length (if using FJC)
+ outside of which the peak is automatically discarded (in nm)
+ '''
+
+ #default fit etc. variables
+ pl_value=None
+ T=self.config['temperature']
+
+ slope_span=int(self.config['auto_slope_span'])
+ delta_force=10
+ rebase=False #if true=we select rebase
+ noflatten=False #if true=we avoid flattening
+
+ #initialize output data vectors
+ c_lengths=[]
+ p_lengths=[]
+ sigma_c_lengths=[]
+ sigma_p_lengths=[]
+ forces=[]
+ slopes=[]
+
+ #pick up plot
+ displayed_plot=self._get_displayed_plot(0)
+
+ #COMMAND LINE PARSING
+ #--Using points instead of nm interval
+ if 'usepoints' in args.split():
+ fit_points=int(self.config['auto_fit_points'])
+ usepoints=True
+ else:
+ fit_points=None
+ usepoints=False
+ #--Recalculate baseline
+ if 'rebase' in args or (self.basecurrent != self.current.path):
+ rebase=True
+
+ if 'noflatten' in args:
+ noflatten=True
+
+ #--Custom persistent length / custom temperature
+ for arg in args.split():
+ #look for a persistent length argument.
+ if 'pl=' in arg:
+ pl_expression=arg.split('=')
+ pl_value=float(pl_expression[1]) #actual value
+ #look for a T argument. FIXME: spaces are not allowed between 'pl' and value
+ if ('t=' in arg[0:2]) or ('T=' in arg[0:2]):
+ t_expression=arg.split('=')
+ T=float(t_expression[1])
+ #--Contact point arguments
+ if 'reclick' in args.split():
+ print 'Click contact point'
+ contact_point, contact_point_index = self.pickup_contact_point()
+ elif 'noauto' in args.split():
+ if self.wlccontact_index==None or self.wlccurrent != self.current.path:
+ print 'Click contact point'
+ contact_point , contact_point_index = self.pickup_contact_point()
+ else:
+ contact_point=self.wlccontact_point
+ contact_point_index=self.wlccontact_index
+ else:
+ #Automatically find contact point
+ cindex=self.find_contact_point()
+ contact_point=self._clickize(displayed_plot.vectors[1][0], displayed_plot.vectors[1][1], cindex)
+ #--END COMMAND LINE PARSING--
+
+
+ peak_location, peak_size = self.find_current_peaks(noflatten)
+
+ if len(peak_location) == 0:
+ print 'No peaks to fit.'
+ return
+
+ fitplot=copy.deepcopy(displayed_plot)
+
+ #Pick up force baseline
+ if rebase:
+ self.basepoints=self.baseline_points(peak_location, displayed_plot)
+
+ boundaries=[self.basepoints[0].index, self.basepoints[1].index]
+ boundaries.sort()
+ to_average=displayed_plot.vectors[1][1][boundaries[0]:boundaries[1]] #y points to average
+ avg=np.mean(to_average)
+
+ clicks=self.config['baseline_clicks']
+ if clicks==-1:
+ try:
+ avg=displayed_plot.vectors[1][1][contact_point_index]
+ except:
+ avg=displayed_plot.vectors[1][1][cindex]
+
+ for peak in peak_location:
+ #WLC FITTING
+ #define fit interval
+ if not usepoints:
+ fit_points=self.fit_interval_nm(peak, displayed_plot, self.config['auto_fit_nm'], True)
+ peak_point=self._clickize(displayed_plot.vectors[1][0],displayed_plot.vectors[1][1],peak)
+ other_fit_point=self._clickize(displayed_plot.vectors[1][0],displayed_plot.vectors[1][1],peak-fit_points)
+
+ #points for the fit
+ points=[contact_point, peak_point, other_fit_point]
+
+ if abs(peak_point.index-other_fit_point.index) < 2:
+ continue
+
+ if self.config['fit_function']=='wlc':
+
+ params, yfit, xfit, fit_errors = self.wlc_fit(points, displayed_plot.vectors[1][0], displayed_plot.vectors[1][1], pl_value, T, return_errors=True)
+ elif self.config['fit_function']=='fjc':
+ params, yfit, xfit, fit_errors = self.fjc_fit(points, displayed_plot.vectors[1][0], displayed_plot.vectors[1][1], pl_value, T, return_errors=True)
+ else:
+ print 'Unknown fit function'
+ print 'Please set fit_function as wlc or fjc'
+ return
+
+
+ #Measure forces
+ delta_to_measure=displayed_plot.vectors[1][1][peak-delta_force:peak+delta_force]
+ y=min(delta_to_measure)
+ #save force values (pN)
+ #Measure slopes
+ slope=self.linefit_between(peak-slope_span,peak)[0]
+
+
+ #check fitted data and, if right, add peak to the measurement
+ #FIXME: code duplication
+ if len(params)==1: #if we did choose 1-value fit
+ p_lengths.append(pl_value)
+ c_lengths.append(params[0]*(1.0e+9))
+ sigma_p_lengths.append(0)
+ sigma_c_lengths.append(fit_errors[0]*(1.0e+9))
+ forces.append(abs(y-avg)*(1.0e+12))
+ slopes.append(slope)
+ #Add WLC fit lines to plot
+ fitplot.add_set(xfit,yfit)
+ if len(fitplot.styles)==0:
+ fitplot.styles=[]
+ fitplot.colors=[]
+ else:
+ fitplot.styles.append(None)
+ fitplot.colors.append(None)
+ else: #2-value fit
+ p_leng=params[1]*(1.0e+9)
+ #check if persistent length makes sense. otherwise, discard peak.
+ if p_leng>self.config['auto_min_p'] and p_leng<self.config['auto_max_p']:
+ p_lengths.append(p_leng)
+ c_lengths.append(params[0]*(1.0e+9))
+ sigma_c_lengths.append(fit_errors[0]*(1.0e+9))
+ sigma_p_lengths.append(fit_errors[1]*(1.0e+9))
+ forces.append(abs(y-avg)*(1.0e+12))
+ slopes.append(slope)
+
+ #Add WLC fit lines to plot
+ fitplot.add_set(xfit,yfit)
+ if len(fitplot.styles)==0:
+ fitplot.styles=[]
+ fitplot.colors=[]
+ else:
+ fitplot.styles.append(None)
+ fitplot.colors.append(None)
+ else:
+ pass
+
+
+ #add basepoints to fitplot
+ fitplot.add_set([self.basepoints[0].graph_coords[0],self.basepoints[1].graph_coords[0]],[self.basepoints[0].graph_coords[1],self.basepoints[1].graph_coords[1]])
+ fitplot.styles.append('scatter')
+ fitplot.colors.append(None)
+
+ #Show wlc fits and peak locations
+ self._send_plot([fitplot])
+
+ print 'Using fit function: ',self.config['fit_function']
+ print 'Measurements for all peaks detected:'
+ print 'contour (nm)', c_lengths
+ print 'sigma contour (nm)',sigma_c_lengths
+ print 'p (nm)',p_lengths
+ print 'sigma p (nm)',sigma_p_lengths
+ print 'forces (pN)',forces
+ print 'slopes (N/m)',slopes
+
+ controller=False
+ while controller==False:
+ #Ask the user what peaks to ignore from analysis.
+ print 'Peaks to ignore (0,1...n from contact point,return to take all)'
+ print 'N to discard measurement'
+ exclude_raw=raw_input('Input:')
+ if exclude_raw=='N':
+ print 'Discarded.'
+ return
+ if exclude_raw=='':
+ controller=True
+ if not exclude_raw=='':
+ exclude=exclude_raw.split(',')
+ try:
+ exclude=[int(item) for item in exclude]
+ for i in exclude:
+ c_lengths[i]=None
+ p_lengths[i]=None
+ forces[i]=None
+ slopes[i]=None
+ sigma_c_lengths[i]=None
+ sigma_p_lengths[i]=None
+ controller=True
+ except:
+ print 'Bad input.'
+ controller=False
+
+ #Clean data vectors from ignored peaks
+ #FIXME:code duplication
+ c_lengths=[item for item in c_lengths if item != None]
+ p_lengths=[item for item in p_lengths if item != None]
+ forces=[item for item in forces if item != None]
+ slopes=[item for item in slopes if item != None]
+ sigma_c_lengths=[item for item in sigma_c_lengths if item != None]
+ sigma_p_lengths=[item for item in sigma_p_lengths if item != None]
+
+ print 'Measurements for chosen peaks:'
+ print 'contour (nm)',c_lengths
+ print 'sigma contour (nm)',sigma_c_lengths
+ print 'p (nm)',p_lengths
+ print 'sigma p (nm)',sigma_p_lengths
+ print 'forces (pN)',forces
+ print 'slopes (N/m)',slopes
+
+ #Save file info
+ if self.autofile=='':
+ self.autofile=raw_input('Autopeak filename? (return to ignore) ')
+ if self.autofile=='':
+ print 'Not saved.'
+ return
+
+ if not os.path.exists(self.autofile):
+ f=open(self.autofile,'w+')
+ f.write('Analysis started '+time.asctime()+'\n')
+ f.write('----------------------------------------\n')
+ f.write('; Contour length (nm) ; Persistence length (nm) ; Max.Force (pN) ; Slope (N/m) ; Sigma contour (nm) ; Sigma persistence (nm)\n')
+ f.close()
+
+ print 'Saving...'
+ f=open(self.autofile,'a+')
+
+ f.write(self.current.path+'\n')
+ for i in range(len(c_lengths)):
+ f.write(' ; '+str(c_lengths[i])+' ; '+str(p_lengths[i])+' ; '+str(forces[i])+' ; '+str(slopes[i])+' ; '+str(sigma_c_lengths[i])+' ; '+str(sigma_p_lengths[i])+'\n')
+
+ f.close()
+ self.do_note('autopeak')
+
--- /dev/null
-\r
+ #!/usr/bin/env python
+
+ '''
+ generalvclamp.py
+
+ Plugin regarding general velocity clamp measurements
+
+ Copyright 2008 by Massimo Sandal, Fabrizio Benedetti, Marco Brucale, Bruno Samori (University of Bologna, Italy),
+ and Alberto Gomez-Casado (University of Twente)
+ with modifications by Dr. Rolf Schmidt (Concordia University, Canada)
+
+ This program is released under the GNU General Public License version 2.
+ '''
+
+ import lib.libhooke as lh
+ import wxversion
+ wxversion.select(lh.WX_GOOD)
+
+ import numpy as np
+ import scipy as sp
+
+ import warnings
+ warnings.simplefilter('ignore', np.RankWarning)
+
+ import lib.curve
+ import lib.prettyformat
+
+ class generalvclampCommands:
+
+ def _plug_init(self):
+ self.basecurrent = ''
+ self.basepoints = []
+ #TODO: what is self.autofile for?
+ #self.autofile = ''
+
+ def do_distance(self):
+ '''
+ DISTANCE
+ (generalvclamp.py)
+ Measure the distance (in nm) between two points.
+ For a standard experiment this is the delta X distance.
+ For a force clamp experiment this is the delta Y distance (actually becomes
+ an alias of zpiezo)
+ -----------------
+ Syntax: distance
+ '''
+ color = self.GetColorFromConfig('generalvclamp', 'distance', 'color')
+ decimals = self.GetIntFromConfig('generalvclamp', 'distance', 'decimals')
+ prefix = self.GetStringFromConfig('generalvclamp', 'distance', 'prefix')
+ multiplier = 10 ** lib.prettyformat.get_exponent(prefix)
+ show = self.GetBoolFromConfig('generalvclamp', 'distance', 'show')
+ show_in_legend = self.GetBoolFromConfig('generalvclamp', 'distance', 'show_in_legend')
+ size = self.GetIntFromConfig('generalvclamp', 'distance', 'size')
+ whatset_str = self.GetStringFromConfig('generalvclamp', 'distance', 'whatset')
+ whatset = 'retraction'
+ if whatset_str == 'extension':
+ whatset = lh.EXTENSION
+ if whatset_str == 'retraction':
+ whatset = lh.RETRACTION
+
+ active_file = self.GetActiveFile()
+ if active_file.driver.experiment == 'clamp':
+ self.AppendToOutput('You wanted to use zpiezo perhaps?')
+ return
+ plugin = lib.plugin.Plugin()
+ plugin.name = 'generalvclamp'
+ plugin.section = 'distance'
+ delta = self._delta(message='Click 2 points to measure the distance.', whatset=whatset)
+
+ plot = self.GetDisplayedPlotCorrected()
+ if show:
+ #add the points to the plot
+ points = lib.curve.Curve()
+ points.color = color
+ if show_in_legend:
+ points.label = 'distance'
+ else:
+ points.label = '_nolegend_'
+ points.size = size
+ points.style = 'scatter'
+ points.units.x = delta.units.x
+ points.units.y = delta.units.y
+ points.x = [delta.point1.x, delta.point2.x]
+ points.y = [delta.point1.y, delta.point2.y]
+ plot.curves.append(points)
+
+ self.UpdatePlot(plot)
+
+ output_str = lib.prettyformat.pretty_format(abs(delta.get_delta_x()), delta.units.x, decimals, multiplier)
+ self.AppendToOutput(''.join(['Distance: ', output_str]))
+
+ def do_force(self):
+ '''
+ FORCE
+ (generalvclamp.py)
+ Measure the force difference (in pN) between two points
+ ---------------
+ Syntax: force
+ '''
+ color = self.GetColorFromConfig('generalvclamp', 'force', 'color')
+ decimals = self.GetIntFromConfig('generalvclamp', 'force', 'decimals')
+ prefix = self.GetStringFromConfig('generalvclamp', 'force', 'prefix')
+ multiplier = 10 ** lib.prettyformat.get_exponent(prefix)
+ show = self.GetBoolFromConfig('generalvclamp', 'force', 'show')
+ show_in_legend = self.GetBoolFromConfig('generalvclamp', 'force', 'show_in_legend')
+ size = self.GetIntFromConfig('generalvclamp', 'force', 'size')
+ whatset_str = self.GetStringFromConfig('generalvclamp', 'force', 'whatset')
+ whatset = 'retraction'
+ if whatset_str == 'extension':
+ whatset = lh.EXTENSION
+ if whatset_str == 'retraction':
+ whatset = lh.RETRACTION
+
+ active_file = self.GetActiveFile()
+ if active_file.driver.experiment == 'clamp':
+ self.AppendToOutput('This command makes no sense for a force clamp experiment.')
+ return
+ plugin = lib.plugin.Plugin()
+ plugin.name = 'generalvclamp'
+ plugin.section = 'force'
+ delta = self._delta(message='Click 2 points to measure the force.', whatset=whatset)
+
+ plot = self.GetDisplayedPlotCorrected()
+ if show:
+ #add the points to the plot
+ points = lib.curve.Curve()
+ points.color = color
+ if show_in_legend:
+ points.label = 'force'
+ else:
+ points.label = '_nolegend_'
+ points.size = size
+ points.style = 'scatter'
+ points.units.x = delta.units.x
+ points.units.y = delta.units.y
+ points.x = [delta.point1.x, delta.point2.x]
+ points.y = [delta.point1.y, delta.point2.y]
+ plot.curves.append(points)
+
+ self.UpdatePlot(plot)
+
+ output_str = lib.prettyformat.pretty_format(abs(delta.get_delta_y()), delta.units.y, decimals, multiplier)
+ self.AppendToOutput(''.join(['Force: ', output_str]))
+
+ def do_forcebase(self):
+ '''
+ FORCEBASE
+ (generalvclamp.py)
+ Measures the difference in force (in pN) between a point and a baseline
+ taken as the average between two points.
+
+ The baseline is fixed once for a given curve and different force measurements,
+ unless the user wants it to be recalculated
+ ------------
+ Syntax: forcebase [rebase]
+ rebase: Forces forcebase to ask again the baseline
+ max: Instead of asking for a point to measure, asks for two points and use
+ the maximum peak in between
+ '''
+ baseline_color = self.GetColorFromConfig('generalvclamp', 'forcebase', 'baseline_color')
+ baseline_show = self.GetBoolFromConfig('generalvclamp', 'forcebase', 'baseline_show')
+ baseline_show_in_legend = self.GetBoolFromConfig('generalvclamp', 'forcebase', 'baseline_show_in_legend')
+ baseline_size = self.GetIntFromConfig('generalvclamp', 'forcebase', 'baseline_size')
+ decimals = self.GetIntFromConfig('generalvclamp', 'forcebase', 'decimals')
+ maximum_color = self.GetColorFromConfig('generalvclamp', 'forcebase', 'maximum_color')
+ maximum_show = self.GetBoolFromConfig('generalvclamp', 'forcebase', 'maximum_show')
+ maximum_show_in_legend = self.GetBoolFromConfig('generalvclamp', 'forcebase', 'maximum_show_in_legend')
+ maximum_size = self.GetIntFromConfig('generalvclamp', 'forcebase', 'maximum_size')
+ maximumrange_color = self.GetColorFromConfig('generalvclamp', 'forcebase', 'maximumrange_color')
+ maximumrange_show = self.GetBoolFromConfig('generalvclamp', 'forcebase', 'maximumrange_show')
+ maximumrange_show_in_legend = self.GetBoolFromConfig('generalvclamp', 'forcebase', 'maximumrange_show_in_legend')
+ maximumrange_size = self.GetIntFromConfig('generalvclamp', 'forcebase', 'maximumrange_size')
+ maxpoint = self.GetBoolFromConfig('generalvclamp', 'forcebase', 'max')
+ prefix = self.GetStringFromConfig('generalvclamp', 'forcebase', 'prefix')
+ multiplier = 10 ** lib.prettyformat.get_exponent(prefix)
+ rebase = self.GetBoolFromConfig('generalvclamp', 'forcebase', 'rebase')
+ whatset_str = self.GetStringFromConfig('generalvclamp', 'forcebase', 'whatset')
+ whatset = 'retraction'
+ if whatset_str == 'extension':
+ whatset = lh.EXTENSION
+ if whatset_str == 'retraction':
+ whatset = lh.RETRACTION
+
+ plot = self.GetDisplayedPlotCorrected()
+
+ filename = self.GetActiveFile().name
+ if rebase or (self.basecurrent != filename):
+ self.basepoints = self._measure_N_points(N=2, message='Click on 2 points to select the baseline.', whatset=whatset)
+ self.basecurrent = filename
+
+ #TODO: maxpoint does not seem to be picking up the 'real' maximum (at least not with test.hkp/default.000)
+ maximumrange_points = []
+ maximum_point = []
+ if maxpoint:
+ maximumrange_points = self._measure_N_points(N=2, message='Click 2 points to select the range for maximum detection.', whatset=whatset)
+ boundpoints = [maximumrange_points[0].index, maximumrange_points[1].index]
+ boundpoints.sort()
+ try:
+ vector_x = plot.curves[whatset].x[boundpoints[0]:boundpoints[1]]
+ vector_y = plot.curves[whatset].y[boundpoints[0]:boundpoints[1]]
+ y = min(vector_y)
+ index = vector_y.index(y)
+ maximum_point = [self._clickize(vector_x, vector_y, index)]
+ except ValueError:
+ self.AppendToOutput('Chosen interval not valid. Try picking it again. Did you pick the same point as begin and end of the interval?')
+ return
+ else:
+ maximum_point = self._measure_N_points(N=1, message='Click on the point to measure.', whatset=whatset)
+ y = maximum_point[0].graph_coords[1]
+
+ boundaries = [self.basepoints[0].index, self.basepoints[1].index]
+ boundaries.sort()
+ to_average = plot.curves[whatset].y[boundaries[0]:boundaries[1]] #y points to average
+
+ avg = np.mean(to_average)
+ forcebase = abs(y - avg)
+
+ curve = plot.curves[whatset]
+ if self.basepoints and baseline_show:
+ #add the baseline points to the plot
+ baseline = lib.curve.Curve()
+ baseline.color = baseline_color
+ if baseline_show_in_legend:
+ baseline.label = 'baseline'
+ else:
+ baseline.label = '_nolegend_'
+ baseline.size = baseline_size
+ baseline.style = 'scatter'
+ baseline.units.x = curve.units.x
+ baseline.units.y = curve.units.y
+ for point in self.basepoints:
+ baseline.x += [point.graph_coords[0]]
+ baseline.y += [point.graph_coords[1]]
+ plot.curves.append(baseline)
+
+ if maximumrange_points and maximumrange_show:
+ #add the range points to the plot
+ maximumrange = lib.curve.Curve()
+ maximumrange.color = maximumrange_color
+ if maximumrange_show_in_legend:
+ maximumrange.label = 'maximumrange'
+ else:
+ maximumrange.label = '_nolegend_'
+ maximumrange.size = maximumrange_size
+ maximumrange.style = 'scatter'
+ maximumrange.units.x = curve.units.x
+ maximumrange.units.y = curve.units.y
+ for point in maximumrange_points:
+ maximumrange.x += [point.graph_coords[0]]
+ maximumrange.y += [point.graph_coords[1]]
+ plot.curves.append(maximumrange)
+
+ if maximum_show:
+ #add the maximum to the plot
+ maximum = lib.curve.Curve()
+ maximum.color = maximum_color
+ if maximum_show_in_legend:
+ maximum.label = 'maximum'
+ else:
+ maximum.label = '_nolegend_'
+ maximum.size = maximum_size
+ maximum.style = 'scatter'
+ maximum.units.x = curve.units.x
+ maximum.units.y = curve.units.y
+ maximum.x = [maximum_point[0].graph_coords[0]]
+ maximum.y = [maximum_point[0].graph_coords[1]]
+ plot.curves.append(maximum)
+
+ self.UpdatePlot(plot)
+
+ unit_str = plot.curves[whatset].units.y
+ output_str = lib.prettyformat.pretty_format(forcebase, unit_str, decimals, multiplier)
+ self.AppendToOutput(''.join(['Force: ', output_str]))
- Multiplies all the Y values of an SMFS curve by a value stored in the 'force_multiplier'\r
++
+ def plotmanip_multiplier(self, plot, current, customvalue=False):
+ '''
- return plot\r
++ Multiplies all the Y values of an SMFS curve by a value stored in the 'force_multiplier'
+ configuration variable. Useful for calibrations and other stuff.
+ '''
+
+ #not a smfs curve...
+ if current.driver.experiment != 'smfs':
+ return plot
+
+ force_multiplier = self.GetFloatFromConfig('generalvclamp', 'force_multiplier')
+ if force_multiplier == 1:
-\r
- return plot\r
++ return plot
+
+ plot.curves[lh.EXTENSION].y = [element * force_multiplier for element in plot.curves[lh.EXTENSION].y]
+ plot.curves[lh.RETRACTION].y = [element * force_multiplier for element in plot.curves[lh.RETRACTION].y]
++
++ return plot
+
+ def plotmanip_flatten(self, plot, current, customvalue=0):
+ '''
+ Subtracts a polynomial fit to the non-contact part of the curve, as to flatten it.
+ the best polynomial fit is chosen among polynomials of degree 1 to n, where n is
+ given by the configuration file or by the customvalue.
+
+ customvalue = int (>0) --> starts the function even if config says no (default=0)
+ '''
+
+ #not a smfs curve...
+ if current.driver.experiment != 'smfs':
+ return current
+
+ #config is not flatten, and customvalue flag is false too
+ #if (not self.config['generalvclamp']['flatten'].as_bool('value')) and (customvalue == 0):
+ ##TODO: do we need this?
+ #if (not self.GetBoolFromConfig('generalvclamp', 'flatten')) and (customvalue == 0):
+ #return plot
+
+ max_exponent = 12
+ delta_contact = 0
+
+ if customvalue > 0:
+ max_cycles = customvalue
+ else:
+ #Using > 1 usually doesn't help and can give artefacts. However, it could be useful too.
+ max_cycles = self.GetIntFromConfig('generalvclamp', 'max_cycles')
+
+ contact_index = self.find_contact_point(plot)
+
+ valn = [[] for item in range(max_exponent)]
+ yrn = [0.0 for item in range(max_exponent)]
+ errn = [0.0 for item in range(max_exponent)]
+
+ for i in range(int(max_cycles)):
+ x_ext = plot.curves[lh.EXTENSION].x[contact_index + delta_contact:]
+ y_ext = plot.curves[lh.EXTENSION].y[contact_index + delta_contact:]
+ x_ret = plot.curves[lh.RETRACTION].x[contact_index + delta_contact:]
+ y_ret = plot.curves[lh.RETRACTION].y[contact_index + delta_contact:]
+ for exponent in range(max_exponent):
+ try:
+ valn[exponent] = sp.polyfit(x_ext, y_ext, exponent)
+ yrn[exponent] = sp.polyval(valn[exponent], x_ret)
+ errn[exponent] = sp.sqrt(sum((yrn[exponent] - y_ext) ** 2) / float(len(y_ext)))
+ except Exception, e:
+ print 'Cannot flatten!'
+ print e
+ return current
+
+ best_exponent = errn.index(min(errn))
+
+ #extension
+ ycorr_ext = y_ext - yrn[best_exponent] + y_ext[0] #noncontact part
+ yjoin_ext = np.array(plot.curves[lh.EXTENSION].y[0:contact_index + delta_contact]) #contact part
+ #retraction
+ ycorr_ret = y_ret - yrn[best_exponent] + y_ext[0] #noncontact part
+ yjoin_ret = np.array(plot.curves[lh.RETRACTION].y[0:contact_index + delta_contact]) #contact part
+
+ ycorr_ext = np.concatenate((yjoin_ext, ycorr_ext))
+ ycorr_ret = np.concatenate((yjoin_ret, ycorr_ret))
+
+ plot.curves[lh.EXTENSION].y = list(ycorr_ext)
+ plot.curves[lh.RETRACTION].y = list(ycorr_ret)
+
+ return plot
+
+ #---SLOPE---
+ def do_slope(self):
+ '''
+ SLOPE
+ (generalvclamp.py)
+ Measures the slope of a delimited chunk on the return trace.
+ The chunk can be delimited either by two manual clicks, or have
+ a fixed width, given as an argument.
+ ---------------
+ Syntax: slope [width]
+ The facultative [width] parameter specifies how many
+ points will be considered for the fit. If [width] is
+ specified, only one click will be required.
+ Copyright 2008 by Marco Brucale, Massimo Sandal
+ '''
+
+ decimals = self.GetIntFromConfig('generalvclamp', 'slope', 'decimals')
+ fitspan = self.GetIntFromConfig('generalvclamp', 'slope', 'fitspan')
+ point_color = self.GetColorFromConfig('generalvclamp', 'slope', 'point_color')
+ point_show = self.GetBoolFromConfig('generalvclamp', 'slope', 'point_show')
+ point_show_in_legend = self.GetBoolFromConfig('generalvclamp', 'slope', 'point_show_in_legend')
+ point_size = self.GetIntFromConfig('generalvclamp', 'slope', 'point_size')
+ slope_color = self.GetColorFromConfig('generalvclamp', 'slope', 'slope_color')
+ slope_linewidth = self.GetIntFromConfig('generalvclamp', 'slope', 'slope_linewidth')
+ slope_show = self.GetBoolFromConfig('generalvclamp', 'slope', 'slope_show')
+ slope_show_in_legend = self.GetBoolFromConfig('generalvclamp', 'slope', 'slope_show_in_legend')
+ whatset_str = self.GetStringFromConfig('generalvclamp', 'slope', 'whatset')
+ whatset = 'retraction'
+ if whatset_str == 'extension':
+ whatset = lh.EXTENSION
+ if whatset_str == 'retraction':
+ whatset = lh.RETRACTION
+
+ # Decides between the two forms of user input
+ #TODO: add an option 'mode' with options 'chunk' and 'point'
+ if fitspan == 0:
+ # Gets the Xs of two clicked points as indexes on the curve curve vector
+ clicked_points = []
+ points = self._measure_N_points(N=2, message='Click 2 points to select the chunk.', whatset=whatset)
+ clicked_points = [points[0].index, points[1].index]
+ clicked_points.sort()
+ else:
+ clicked_points = []
+ points = self._measure_N_points(N=1, message='Click on the leftmost point of the chunk (i.e.usually the peak).', whatset=whatset)
+ clicked_points = [points[0].index - fitspan, points[0].index]
+
+ # Calls the function linefit_between
+ parameters = [0, 0, [], []]
+ try:
+ parameters = self.linefit_between(clicked_points[0], clicked_points[1], whatset=whatset)
+ except:
+ self.AppendToOutput('Cannot fit. Did you click the same point twice?')
+ return
+
+ plot = self.GetDisplayedPlotCorrected()
+ # Makes a vector with the fitted parameters and sends it to the GUI
+ xtoplot=parameters[2]
+ ytoplot=[]
+ x = 0
+ for x in xtoplot:
+ ytoplot.append((x * parameters[0]) + parameters[1])
+
+ clickvector_x = []
+ clickvector_y = []
+ for item in points:
+ clickvector_x.append(item.graph_coords[0])
+ clickvector_y.append(item.graph_coords[1])
+
+ if point_show:
+ #add the clicked point to the plot
+ point = lib.curve.Curve()
+ point.color = point_color
+ if point_show_in_legend:
+ point.label = 'clicked point'
+ else:
+ point.label = '_nolegend_'
+ point.size = point_size
+ point.style = 'scatter'
+ point.x = clickvector_x
+ point.y = clickvector_y
+ plot.curves.append(point)
+
+ if slope_show:
+ #add the slope to the plot
+ slope = lib.curve.Curve()
+ slope.color = slope_color
+ if slope_show_in_legend:
+ slope.label = 'slope'
+ else:
+ slope.label = '_nolegend_'
+ slope.linewidth = slope_linewidth
+ slope.style = 'plot'
+ slope.units.x = plot.curves[whatset].units.x
+ slope.units.y = plot.curves[whatset].units.y
+ slope.x = xtoplot
+ slope.y = ytoplot
+ plot.curves.append(slope)
+
+ self.UpdatePlot(plot)
+
+ # Outputs the relevant slope parameter
+ unit_str = plot.curves[whatset].units.x + '/' + plot.curves[whatset].units.y
+ output_str = lib.prettyformat.pretty_format(parameters[0], unit_str, decimals, 1)
+ self.AppendToOutput(''.join(['Slope: ', output_str]))
+
+ def linefit_between(self, index1, index2, whatset=lh.RETRACTION):
+ '''
+ Creates two vectors (xtofit, ytofit) slicing out from the
+ curve return trace a portion delimited by the two indeces
+ given as arguments.
+ Then does a least squares linear fit on that slice.
+ Finally returns [0]=the slope, [1]=the intercept of the
+ fitted 1st grade polynomial, and [2,3]=the actual (x,y) vectors
+ used for the fit.
+ Copyright 2008 by Marco Brucale, Massimo Sandal
+ '''
+ # Translates the indeces into two vectors containing the x, y data to fit
+ plot = self.displayed_plot
+ xtofit = plot.corrected_curves[whatset].x[index1:index2]
+ ytofit = plot.corrected_curves[whatset].y[index1:index2]
+
+ # Does the actual linear fitting (simple least squares with numpy.polyfit)
+ linefit = np.polyfit(xtofit, ytofit, 1)
+
+ return (linefit[0], linefit[1], xtofit, ytofit)
+
+
+
--- /dev/null
-#!/usr/bin/env python\r
-\r
-'''\r
-plot.py\r
-\r
-Global settings for plots\r
-\r
-Copyright 2010 by Dr. Rolf Schmidt (Concordia University, Canada)\r
-\r
-This program is released under the GNU General Public License version 2.\r
-'''\r
-\r
-class plotCommands:\r
-\r
- def do_preferences(self):\r
- active_file = self.GetActiveFile()\r
- for curve in active_file.plot.curves:\r
- curve.decimals.x = self.GetIntFromConfig('plot', 'preferences', 'x_decimals')\r
- curve.decimals.y = self.GetIntFromConfig('plot', 'preferences', 'y_decimals')\r
- curve.legend = self.GetBoolFromConfig('plot', 'preferences', 'legend')\r
- curve.prefix.x = self.GetStringFromConfig('plot', 'preferences', 'x_prefix')\r
- curve.prefix.y = self.GetStringFromConfig('plot', 'preferences', 'y_prefix')\r
-\r
- self.UpdatePlot();\r
++#!/usr/bin/env python
++
++'''
++plot.py
++
++Global settings for plots
++
++Copyright 2010 by Dr. Rolf Schmidt (Concordia University, Canada)
++
++This program is released under the GNU General Public License version 2.
++'''
++
++class plotCommands:
++
++ def do_preferences(self):
++ active_file = self.GetActiveFile()
++ for curve in active_file.plot.curves:
++ curve.decimals.x = self.GetIntFromConfig('plot', 'preferences', 'x_decimals')
++ curve.decimals.y = self.GetIntFromConfig('plot', 'preferences', 'y_decimals')
++ curve.legend = self.GetBoolFromConfig('plot', 'preferences', 'legend')
++ curve.prefix.x = self.GetStringFromConfig('plot', 'preferences', 'x_prefix')
++ curve.prefix.y = self.GetStringFromConfig('plot', 'preferences', 'y_prefix')
++
++ self.UpdatePlot();
- # Copyright (C) 2009-2010 Rolf Schmidt <rschmidt@alcor.concordia.ca>
- # W. Trevor King <wking@drexel.edu>
- #
- # This file is part of Hooke.
- #
- # Hooke is free software: you can redistribute it and/or
- # modify it under the terms of the GNU Lesser General Public
- # License as published by the Free Software Foundation, either
- # version 3 of the License, or (at your option) any later version.
- #
- # Hooke is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU Lesser General Public License for more details.
- #
- # You should have received a copy of the GNU Lesser General Public
- # License along with Hooke. If not, see
- # <http://www.gnu.org/licenses/>.
-
- """Format values with nice prefixes.
- History:
-
- * 2009 07 16:
-
- * added negative number support
- * added decimal-formatted output
- """
- __version__ = "1.0.1"
-
- import math
- from numpy import isnan
-
- def pretty_format(fValue, sUnit='', iDecimals=-1, iMultiplier=1, bLeadingSpaces=False):
- if fValue != 0:
- iLeadingSpaces = 0
- if bLeadingSpaces:
- iLeadingSpaces = 5
- if iMultiplier == 1:
- iMultiplier=get_multiplier(fValue)
- sUnitString = ''
- if sUnit != '':
- sUnitString = ' ' + get_prefix(iMultiplier) + sUnit
- if iDecimals >= 0:
- formatString = '% ' + repr(iLeadingSpaces + iDecimals) + '.' + repr(iDecimals) + 'f'
- return formatString % (fValue / iMultiplier) + sUnitString
- else:
- return str(fValue / iMultiplier) + sUnitString
- else:
- return '0'
- return str(fValue / iMultiplier) + ' ' + get_prefix(fValue / iMultiplier) + sUnit
-
- def get_multiplier(fValue):
- return pow(10, get_power(fValue))
-
- def get_power(fValue):
- if fValue != 0 and not isnan(fValue):
- #get the log10 from fValue (make sure the value is not negative)
- dHelp = math.floor(math.log10(math.fabs(fValue)))
- #reduce the log10 to a multiple of 3 and return it
- return dHelp-(dHelp % 3)
- else:
- return 0
-
- def get_prefix(fValue):
- #set up a dictionary to find the prefix
- prefix = {
- 24: lambda: 'Y',
- 21: lambda: 'Z',
- 18: lambda: 'E',
- 15: lambda: 'P',
- 12: lambda: 'T',
- 9: lambda: 'G',
- 6: lambda: 'M',
- 3: lambda: 'k',
- 0: lambda: '',
- -3: lambda: 'm',
- -6: lambda: u'\u00B5',
- -9: lambda: 'n',
- -12: lambda: 'p',
- -15: lambda: 'f',
- -18: lambda: 'a',
- -21: lambda: 'z',
- -24: lambda: 'y',
- }
- if fValue != 0 and not isnan(fValue):
- #get the log10 from fValue
- dHelp = math.floor(math.log10(math.fabs(fValue)))
- else:
- dHelp = 0
- #reduce the log10 to a multiple of 3 and create the return string
- return prefix.get(dHelp - (dHelp % 3))()
-
- '''
- dTestValue=-2.4115665714484597e-008
- print 'Value: '+str(dTestValue)+')'
- print 'pretty_format example (value, unit)'
- print pretty_format(dTestValue, 'N')
- print'-----------------------'
- print 'pretty_format example (value, unit, decimals)'
- print pretty_format(dTestValue, 'N', 3)
- print'-----------------------'
- print 'pretty_format example (value, unit, decimals, multiplier)'
- print pretty_format(dTestValue, 'N', 5, 0.000001)
- print'-----------------------'
- print 'pretty_format example (value, unit, decimals, multiplier, leading spaces)'
- print pretty_format(0.0166276297705, 'N', 3, 0.001, True)
- print pretty_format(0.00750520813323, 'N', 3, 0.001, True)
- print pretty_format(0.0136453282825, 'N', 3, 0.001, True)
- '''
- '''
- #example use autoFormatValue
- dTestValue=0.00000000567
- print 'autoFormatValue example ('+str(dTestValue)+')'
- print autoFormatValue(dTestValue, 'N')
- #outputs 5.67 nN
- '''
- '''
- #example use of decimalFormatValue(fValue, iDecimals, sUnit):
- dTestValue=-2.4115665714484597e-008
- iDecimals=3
- print 'decimalFormatValue example ('+str(dTestValue)+')'
- print decimalFormatValue(dTestValue, iDecimals, 'N')
- #outputs -24.116 nN
- #change iDecimals to see the effect
- '''
- '''
- #example use formatValue
- dTestValue=0.000000000567
- print 'formatValue example ('+str(dTestValue)+')'
- #find the (common) multiplier
- iMultiplier=get_multiplier(dTestValue)
- #use the multiplier and a unit to format the value
- print formatValue(dTestValue, iMultiplier, 'N')
- #outputs 567.0 pN
- '''
- '''
- #to output a scale:
- #choose any value on the axis and find the multiplier and prefix for it
- #use those to format the rest of the scale
- #as values can span several orders of magnitude, you have to decide what units to use
-
- #tuple of values:
- scaleValues=0.000000000985, 0.000000001000, 0.000000001015
- #use this element (change to 1 or 2 to see the effect on the scale and label)
- iIndex=0
- #get the multiplier from the value at iIndex
- iMultiplier=get_multiplier(scaleValues[iIndex])
- print '\nScale example'
- iDecimals=3
- #print the scale
- for aValue in scaleValues: print decimalFormat(aValue/iMultiplier, iDecimals),
- #print the scale label using the value at iIndex
- print '\n'+get_prefix(scaleValues[iIndex])+'N'
- '''
-#!/usr/bin/env python\r
++# Copyright\r
+ \r
-'''\r
-prettyformat.py\r
-\r
-Simple Python function to format values with nice prefixes\r
-Version 1.0.1\r
-\r
-History\r
-2009 07 16: added negative number support\r
- added decimal-formatted output\r
-2010 02 25: renamed variables to a more pythonic style\r
- added whitespace stripping option to prettyformat()\r
- added get_multiplier()\r
- added get_exponent()\r
- updated examples\r
-\r
-Copyright 2009 by Dr. Rolf Schmidt (Concordia University, Canada)\r
-\r
-This program is released under the GNU General Public License version 2.\r
-'''\r
++"""Simple Python function to format values with nice prefixes.\r
++"""\r
+ \r
+ import math\r
+ from numpy import isnan\r
+ \r
++\r
+ def pretty_format(value, unit='', decimals=-1, multiplier=0, leading_spaces=False):\r
+ if value == 0:\r
+ return '0'\r
+ if isnan(value):\r
+ return 'NaN'\r
+ \r
+ output_str = ''\r
+ leading_spaces_int = 0\r
+ if leading_spaces:\r
+ leading_spaces_int = 5\r
+ #automatic setting of multiplier\r
+ if multiplier == 0:\r
+ multiplier=get_multiplier(value)\r
+ unit_str = ''\r
+ if unit:\r
+ unit_str = ' ' + get_prefix(multiplier) + unit\r
+ if decimals >= 0:\r
+ format_str = '% ' + repr(leading_spaces_int + decimals) + '.' + repr(decimals) + 'f'\r
+ output_str = format_str % (value / multiplier) + unit_str\r
+ else:\r
+ output_str = str(value / multiplier) + unit_str\r
+ \r
+ if decimals < 0:\r
+ output_str = str(value / multiplier) + ' ' + get_prefix(value / multiplier) + unit\r
+ \r
+ if leading_spaces_int == 0:\r
+ output_str = output_str.lstrip()\r
+ \r
+ return output_str\r
+ \r
+ def get_multiplier(value):\r
+ return pow(10, get_power(value))\r
+ \r
+ def get_power(value):\r
+ if value != 0 and not isnan(value):\r
+ #get the log10 from value (make sure the value is not negative)\r
+ value_temp = math.floor(math.log10(math.fabs(value)))\r
+ #reduce the log10 to a multiple of 3 and return it\r
+ return value_temp - (value_temp % 3)\r
+ else:\r
+ return 0\r
+ \r
+ def get_exponent(prefix):\r
+ #set up a dictionary to find the exponent\r
+ exponent = {\r
+ 'Y': 24,\r
+ 'Z': 21,\r
+ 'E': 18,\r
+ 'P': 15,\r
+ 'T': 12,\r
+ 'G': 9,\r
+ 'M': 6,\r
+ 'k': 3,\r
+ '': 0,\r
+ 'm': -3,\r
+ u'\u00B5': -6,\r
+ 'n': -9,\r
+ 'p': -12,\r
+ 'f': -15,\r
+ 'a': -18,\r
+ 'z': -21,\r
+ 'y': -24,\r
+ }\r
+ if exponent.has_key(prefix):\r
+ return exponent[prefix]\r
+ else:\r
+ return 1\r
+ \r
+ def get_prefix(value):\r
+ #set up a dictionary to find the prefix\r
+ prefix = {\r
+ 24: lambda: 'Y',\r
+ 21: lambda: 'Z',\r
+ 18: lambda: 'E',\r
+ 15: lambda: 'P',\r
+ 12: lambda: 'T',\r
+ 9: lambda: 'G',\r
+ 6: lambda: 'M',\r
+ 3: lambda: 'k',\r
+ 0: lambda: '',\r
+ -3: lambda: 'm',\r
+ -6: lambda: u'\u00B5',\r
+ -9: lambda: 'n',\r
+ -12: lambda: 'p',\r
+ -15: lambda: 'f',\r
+ -18: lambda: 'a',\r
+ -21: lambda: 'z',\r
+ -24: lambda: 'y',\r
+ }\r
+ if value != 0 and not isnan(value):\r
+ #get the log10 from value\r
+ value_temp = math.floor(math.log10(math.fabs(value)))\r
+ else:\r
+ value_temp = 0\r
+ #reduce the log10 to a multiple of 3 and create the return string\r
+ return prefix.get(value_temp - (value_temp % 3))()\r
+ \r
+ '''\r
+ test_value=-2.4115665714484597e-008\r
+ print 'Value: '+str(test_value)+')'\r
+ print 'pretty_format example (value, unit)'\r
+ print pretty_format(test_value, 'N')\r
+ print'-----------------------'\r
+ print 'pretty_format example (value, unit, decimals)'\r
+ print pretty_format(test_value, 'N', 3)\r
+ print'-----------------------'\r
+ print 'pretty_format example (value, unit, decimals, multiplier)'\r
+ print pretty_format(test_value, 'N', 5, 0.000001)\r
+ print'-----------------------'\r
+ print 'pretty_format example (value, unit, decimals, multiplier, leading spaces)'\r
+ print pretty_format(0.0166276297705, 'N', 3, 0.001, True)\r
+ print pretty_format(0.00750520813323, 'N', 3, 0.001, True)\r
+ print pretty_format(0.0136453282825, 'N', 3, 0.001, True)\r
+ '''\r
+ '''\r
+ #to output a scale:\r
+ #choose any value on the axis and find the multiplier and prefix for it\r
+ #use those to format the rest of the scale\r
+ #as values can span several orders of magnitude, you have to decide what units to use\r
+ \r
+ #tuple of values:\r
+ scale_values=0.000000000985, 0.000000001000, 0.000000001015\r
+ #use this element (change to 1 or 2 to see the effect on the scale and label)\r
+ index=0\r
+ #get the multiplier from the value at index\r
+ multiplier=get_multiplier(scale_values[index])\r
+ print '\nScale example'\r
+ decimals=3\r
+ #print the scale\r
+ for aValue in scale_values: print decimalFormat(aValue/multiplier, decimals),\r
+ #print the scale label using the value at index\r
+ print '\n'+get_prefix(scale_values[index])+'N'\r
-'''
++'''\r