From: devicerandom Date: Fri, 20 Mar 2009 16:26:38 +0000 (+0000) Subject: (autopeak.py, flatfilts.py, hooke_cli.py) various error checkings X-Git-Tag: 0.9.0~22 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=1bc94ecb3d2b11a0292aaf5675c8a55b693ecd30;p=hooke.git (autopeak.py, flatfilts.py, hooke_cli.py) various error checkings --- diff --git a/autopeak.py b/autopeak.py index fdce95e..2474add 100644 --- a/autopeak.py +++ b/autopeak.py @@ -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 diff --git a/flatfilts.py b/flatfilts.py index 660bcd4..b287527 100755 --- a/flatfilts.py +++ b/flatfilts.py @@ -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. diff --git a/hooke_cli.py b/hooke_cli.py index 6262cbe..65e9193 100755 --- a/hooke_cli.py +++ b/hooke_cli.py @@ -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.'