6 Process plots plugin for force curves.
9 with modifications by Dr. Rolf Schmidt (Concordia University, Canada)
11 This program is released under the GNU General Public License version 2.
14 import lib.libhooke as lh
16 wxversion.select(lh.WX_GOOD)
19 from numpy import arange, diff, fft, median
20 from scipy.signal import medfilt
22 from lib.peakspot import conv_dx
23 import lib.prettyformat
25 class procplotsCommands:
27 #-----PLOT MANIPULATORS
28 def plotmanip_median(self, plot, current, customvalue=False):
30 does the median of the y values of a plot
32 median_filter = self.GetIntFromConfig('procplots', 'median')
33 if median_filter == 0:
36 if float(median_filter) / 2 == int(median_filter) / 2:
39 for curve in plot.curves:
40 curve.y = medfilt(curve.y, median_filter).tolist()
44 def plotmanip_correct(self, plot, current, customvalue=False):
46 does the correction for the deflection for a force spectroscopy curve.
48 - the current plot has a deflection() method that returns a vector of values
49 - the deflection() vector is as long as the X of extension + the X of retraction
50 - plot.vectors[0][0] is the X of extension curve
51 - plot.vectors[1][0] is the X of retraction curve
53 FIXME: both this method and the picoforce driver have to be updated, deflection() must return
54 a more sensible data structure!
56 #use only for force spectroscopy experiments!
57 if current.driver.experiment != 'smfs':
61 customvalue = self.GetBoolFromConfig('procplots', 'correct')
65 defl_ext, defl_ret = current.driver.deflection()
67 plot.curves[lh.EXTENSION].x = [(zpoint - deflpoint) for zpoint,deflpoint in zip(plot.curves[lh.EXTENSION].x, defl_ext)]
68 plot.curves[lh.RETRACTION].x = [(zpoint - deflpoint) for zpoint,deflpoint in zip(plot.curves[lh.RETRACTION].x, defl_ret)]