A correction on autopeak.py due to the add of curvetools.py (a self. was missing)
authorfabrizio.benedetti.82 <devnull@localhost>
Fri, 5 Mar 2010 11:44:09 +0000 (11:44 +0000)
committerfabrizio.benedetti.82 <devnull@localhost>
Fri, 5 Mar 2010 11:44:09 +0000 (11:44 +0000)
autopeak.py
fit.py
hooke.py
pcluster.py

index 49f2646f5b25287f7f9aab4a2b4169716e54259c..c6f5ee54646c520b606b5e260e577c62c7d8cba1 100644 (file)
@@ -131,11 +131,11 @@ class autopeakCommands:
         #--Contact point arguments
         if 'reclick' in args.split():
             print 'Click contact point'
-            contact_point, contact_point_index = pickup_contact_point()
+            contact_point, contact_point_index = self.pickup_contact_point()
         elif 'noauto' in args.split():
             if self.wlccontact_index==None or self.wlccurrent != self.current.path:
                 print 'Click contact point'
-                contact_point , contact_point_index = pickup_contact_point()
+                contact_point , contact_point_index = self.pickup_contact_point()
             else:
                 contact_point=self.wlccontact_point
                 contact_point_index=self.wlccontact_index
diff --git a/fit.py b/fit.py
index b883ef10edcde74cee8ccd445fb943598c245efa..f18ea73f416894c26f58c1e47adee92c96e0d57a 100755 (executable)
--- a/fit.py
+++ b/fit.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 
 '''
 FIT
@@ -49,8 +50,6 @@ class fitCommands:
         '''
     
         #STEP 1: Prepare the vectors to apply the fit.
-        
-        
         if pl_value is not None:
             pl_value=pl_value/(10**9)
         
index 6bceecbd5d6043c30c2f971b0821d2f01c609a17..6a8a921949474b23473e91a3965335225e66d19b 100755 (executable)
--- a/hooke.py
+++ b/hooke.py
@@ -688,12 +688,15 @@ class MainWindow(wx.Frame):
             '''\r
         if dest==None:\r
             dest=self.current_plot_dest\r
-\r
-        plot=None\r
-        for aplot in self.plots:\r
-            if aplot.destination == dest:\r
-                plot=aplot\r
-        return plot\r
+        try:\r
+          plot=None\r
+          for aplot in self.plots:\r
+              if aplot.destination == dest:\r
+                  plot=aplot\r
+          return plot\r
+        except:\r
+           print "No curve available"\r
+           return None\r
 \r
     def _replot(self):\r
         '''\r
index 5084b83ed31adeee853cf813f1cee12866cba794..2ab469d12c2dd797ada96c5c28e032175ea8088c 100644 (file)
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 
 from mdp import pca
 from libhooke import WX_GOOD, ClickedPoint
@@ -76,30 +77,6 @@ class pclusterCommands:
         f.write('; Peak number  ;  1 peak Length (nm) ; 1 peak Force (pN) ;  2 peak Length (nm) ; 2 peak Force (pN) ;  3 peak Length (nm) ; 3 peak Force (pN) ;  4 peak Length (nm) ; 4 peak Force (pN) ;  5 peak Length (nm) ; 5 peak Force (pN) ;  6 peak Length (nm) ; 6 peak Force (pN) ;  7 peak Length (nm) ; 7 peak Force (pN) ;  8 peak Length (nm) ; 8 peak Force (pN)\n')
         f.close()
         
-        # ------ FUNCTION ------
-        def fit_interval_nm(start_index,plot,nm,backwards):
-            '''
-            Calculates the number of points to fit, given a fit interval in nm
-            start_index: index of point
-            plot: plot to use
-            backwards: if true, finds a point backwards.
-            '''
-            whatset=1 #FIXME: should be decidable
-            x_vect=plot.vectors[1][0]
-            
-            c=0
-            i=start_index
-            start=x_vect[start_index]
-            maxlen=len(x_vect)
-            while abs(x_vect[i]-x_vect[start_index])*(10**9) < nm:
-                if i==0 or i==maxlen-1: #we reached boundaries of vector!
-                    return c
-                if backwards:
-                    i-=1
-                else:
-                    i+=1
-                c+=1
-            return c
 
         def plot_informations(itplot,pl_value):
             '''
@@ -118,9 +95,9 @@ class pclusterCommands:
             cindex=self.find_contact_point(itplot[0]) #Automatically find contact point <158, libhooke.ClickedPoint>
             contact_point=self._clickize(itplot[0].vectors[1][0], itplot[0].vectors[1][1], cindex)
             self.basepoints=[]
-            base_index_0=peak_location[-1]+fit_interval_nm(peak_location[-1], itplot[0], self.config['auto_right_baseline'],False)
+            base_index_0=peak_location[-1]+self.fit_interval_nm(peak_location[-1], itplot[0], self.config['auto_right_baseline'],False)
             self.basepoints.append(self._clickize(itplot[0].vectors[1][0],itplot[0].vectors[1][1],base_index_0))
-            base_index_1=self.basepoints[0].index+fit_interval_nm(self.basepoints[0].index, itplot[0], self.config['auto_left_baseline'],False)
+            base_index_1=self.basepoints[0].index+self.fit_interval_nm(self.basepoints[0].index, itplot[0], self.config['auto_left_baseline'],False)
             self.basepoints.append(self._clickize(itplot[0].vectors[1][0],itplot[0].vectors[1][1],base_index_1))
             self.basecurrent=self.current.path
             boundaries=[self.basepoints[0].index, self.basepoints[1].index]