#-----Convolution-based peak recognition and filtering.
#Requires the libpeakspot.py library
- def has_peaks(self, plot, abs_devs):
+ def has_peaks(self, plot, abs_devs=None):
'''
Finds peak position in a force curve.
FIXME: should be moved in libpeakspot.py
'''
+ if abs_devs==None:
+ abs_devs=self.convfilt_config['mindeviation']
+
+
xret=plot.vectors[1][0]
yret=plot.vectors[1][1]
#Calculate convolution.
convoluted=lps.conv_dx(yret, self.convfilt_config['convolution'])
#surely cut everything before the contact point
- cut_index=self.find_contact_point()
-
+ cut_index=self.find_contact_point(plot)
#cut even more, before the blind window
start_x=xret[cut_index]
blind_index=0
break
blind_index+=1
cut_index+=blind_index
-
#do the dirty convolution-peak finding stuff
noise_level=lps.noise_absdev(convoluted[cut_index:], self.convfilt_config['positive'], self.convfilt_config['maxcut'], self.convfilt_config['stable'])
above=lps.abovenoise(convoluted,noise_level,cut_index,abs_devs)
- peak_location,peak_size=lps.find_peaks(above)
+ peak_location,peak_size=lps.find_peaks(above,seedouble=self.convfilt_config['seedouble'])
#take the maximum
for i in range(len(peak_location)):
if len(args)==0:
args=self.convfilt_config['mindeviation']
-
-
try:
abs_devs=float(args)
except:
- pass
+ print 'Wrong argument, using config value'
+ abs_devs=float(self.convfilt_config['mindeviation'])
defplots=self.current.curve.default_plots()[0] #we need the raw, uncorrected plots
recplot.vectors.append([xgood,ygood])
if recplot.styles==[]:
recplot.styles=[None,None,'scatter']
+ recplot.colors=[None,None,None]
else:
recplot.styles+=['scatter']
+ recplot.colors+=[None]
self._send_plot([recplot])
print '(Please wait)'
notflat_list=[]
-
c=0
for item in self.current_list:
c+=1
self.current=self.current_list[self.pointer]
self.do_plot(0)
+
def do_setconv(self,args):
'''
SETCONV