(autopeak.py, flatfilts.py, hooke_cli.py) various error checkings
authordevicerandom <devnull@localhost>
Fri, 20 Mar 2009 16:26:38 +0000 (16:26 +0000)
committerdevicerandom <devnull@localhost>
Fri, 20 Mar 2009 16:26:38 +0000 (16:26 +0000)
autopeak.py
flatfilts.py
hooke_cli.py

index fdce95efb5dacb16e979e069253907bc66b75e0c..2474add19db0ec51134e4bf2179baed3c16dadff 100644 (file)
@@ -178,6 +178,10 @@ class autopeakCommands:
         
         peak_location, peak_size = find_current_peaks()
         
+        if len(peak_location) == 0:
+            print 'No peaks to fit.'
+            return
+        
         fitplot=copy.deepcopy(displayed_plot)
         
         #Pick up force baseline
index 660bcd45755700398a99d9eceb3151993ca0ad7b..b287527efb0212e512290e962d714460461ce4a1 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.
index 6262cbe04d9a5d7d8be7d65862d4a5119a7f0892..65e91936a2de5b48a59c2bf3349b828ee8bdc937 100755 (executable)
@@ -450,7 +450,13 @@ If we are at the last curve, we come back to the first.
 Syntax: next, n
         '''
     def do_next(self,args):
-        self.current.curve.close_all()
+        try:
+            self.current.curve.close_all()
+        except:
+            print 'No curve file loaded, currently!'
+            print 'This should not happen, report to http://code.google.com/p/hooke'
+            return
+        
         if self.pointer == (len(self.current_list)-1):
             self.pointer=0
             print 'Playlist finished; back to first curve.'
@@ -475,7 +481,12 @@ If we are at the first curve, we jump to the last.
 Syntax: previous, p
     '''
     def do_previous(self,args):
-        self.current.curve.close_all()
+        try:
+            self.current.curve.close_all()
+        except:
+            print 'No curve file loaded, currently!'
+            print 'This should not happen, report to http://code.google.com/p/hooke'
+            return
         if self.pointer == 0:
             self.pointer=(len(self.current_list)-1)
             print 'Start of playlist; jump to last curve.'