(fit.py) WLC and FJC now aliases of fit command
[hooke.git] / flatfilts.py
index f7e729ed935e98dfee72d961d2177773750438f3..3e9f9c8979b287a096140de64ead608ee8f207eb 100755 (executable)
@@ -147,11 +147,15 @@ class flatfiltsCommands:
     #-----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.
@@ -170,7 +174,7 @@ class flatfiltsCommands:
         #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)):
@@ -223,7 +227,8 @@ class flatfiltsCommands:
         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
         
@@ -253,8 +258,10 @@ class flatfiltsCommands:
         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])