2 class Plotmanip (object):
3 #-----PLOT MANIPULATORS
4 def plotmanip_median(self, plot, current, customvalue=None):
6 does the median of the y values of a plot
9 median_filter=customvalue
11 median_filter=self.config['medfilt']
16 if float(median_filter)/2 == int(median_filter)/2:
19 nplots=len(plot.vectors)
22 plot.vectors[c][1]=scipy.signal.medfilt(plot.vectors[c][1],median_filter)
28 def plotmanip_correct(self, plot, current, customvalue=None):
30 does the correction for the deflection for a force spectroscopy curve.
32 - the current plot has a deflection() method that returns a vector of values
33 - the deflection() vector is as long as the X of extension + the X of retraction
34 - plot.vectors[0][0] is the X of extension curve
35 - plot.vectors[1][0] is the X of retraction curve
37 FIXME: both this method and the picoforce driver have to be updated, deflection() must return
38 a more senseful data structure!
40 #use only for force spectroscopy experiments!
41 if current.curve.experiment != 'smfs':
44 if customvalue != None:
45 execute_me=customvalue
47 execute_me=self.config['correct']
51 defl_ext,defl_ret=current.curve.deflection()
52 #halflen=len(deflall)/2
54 plot.vectors[0][0]=[(zpoint-deflpoint) for zpoint,deflpoint in zip(plot.vectors[0][0],defl_ext)]
55 plot.vectors[1][0]=[(zpoint-deflpoint) for zpoint,deflpoint in zip(plot.vectors[1][0],defl_ret)]
60 def plotmanip_centerzero(self, plot, current, customvalue=None):
62 Centers the force curve so the median (the free level) corresponds to 0 N
64 - plot.vectors[0][1] is the Y of extension curve
65 - plot.vectors[1][1] is the Y of retraction curve
69 #use only for force spectroscopy experiments!
70 if current.curve.experiment != 'smfs':
73 if customvalue != None:
74 execute_me=customvalue
76 execute_me=self.config['centerzero']
82 #levelapp=float(np.median(plot.vectors[0][1]))
83 levelret=float(np.median(plot.vectors[1][1][-300:-1]))
87 approach=[i-level for i in plot.vectors[0][1]]
88 retract=[i-level for i in plot.vectors[1][1]]
90 plot.vectors[0][1]=approach
91 plot.vectors[1][1]=retract