From a25ae8eb3d1372bd2b9202c8808ed410e6a6ca46 Mon Sep 17 00:00:00 2001 From: "fabrizio.benedetti.82" Date: Fri, 5 Mar 2010 11:44:09 +0000 Subject: [PATCH] A correction on autopeak.py due to the add of curvetools.py (a self. was missing) --- autopeak.py | 4 ++-- fit.py | 3 +-- hooke.py | 15 +++++++++------ pcluster.py | 29 +++-------------------------- 4 files changed, 15 insertions(+), 36 deletions(-) diff --git a/autopeak.py b/autopeak.py index 49f2646..c6f5ee5 100644 --- a/autopeak.py +++ b/autopeak.py @@ -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 b883ef1..f18ea73 100755 --- 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) diff --git a/hooke.py b/hooke.py index 6bceecb..6a8a921 100755 --- a/hooke.py +++ b/hooke.py @@ -688,12 +688,15 @@ class MainWindow(wx.Frame): ''' if dest==None: dest=self.current_plot_dest - - plot=None - for aplot in self.plots: - if aplot.destination == dest: - plot=aplot - return plot + try: + plot=None + for aplot in self.plots: + if aplot.destination == dest: + plot=aplot + return plot + except: + print "No curve available" + return None def _replot(self): ''' diff --git a/pcluster.py b/pcluster.py index 5084b83..2ab469d 100644 --- a/pcluster.py +++ b/pcluster.py @@ -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] -- 2.26.2