From 6cdff1963965777641646bd02014562280a29ad3 Mon Sep 17 00:00:00 2001 From: devicerandom Date: Thu, 27 Nov 2008 11:55:39 +0000 Subject: [PATCH] (fit.py , flatfilts.py) fixed severe bug in convfilt; now contact point is correctly calculated for every curve --- fit.py | 16 ++++++++++------ flatfilts.py | 8 ++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/fit.py b/fit.py index bced87e..b843419 100755 --- a/fit.py +++ b/fit.py @@ -285,7 +285,7 @@ class fitCommands: self._send_plot([fitplot]) - def find_contact_point(self): + def find_contact_point(self,plot=False): ''' Finds the contact point on the curve. @@ -301,15 +301,19 @@ class fitCommands: FIXME: should be moved, probably to generalvclamp.py ''' + + if not plot: + plot=self.plots[0] + outplot=self.subtract_curves(1) xret=outplot.vectors[1][0] ydiff=outplot.vectors[1][1] + + xext=plot.vectors[0][0] + yext=plot.vectors[0][1] + xret2=plot.vectors[1][0] + yret=plot.vectors[1][1] - xext=self.plots[0].vectors[0][0] - yext=self.plots[0].vectors[0][1] - xret2=self.plots[0].vectors[1][0] - yret=self.plots[0].vectors[1][1] - #taking care of the picoforce trigger bug: we exclude portions of the curve that have too much #standard deviation. yes, a lot of magic is here. monster=True diff --git a/flatfilts.py b/flatfilts.py index e0283b5..f7e729e 100755 --- a/flatfilts.py +++ b/flatfilts.py @@ -158,8 +158,7 @@ class flatfiltsCommands: convoluted=lps.conv_dx(yret, self.convfilt_config['convolution']) #surely cut everything before the contact point - cut_index=self.find_contact_point() - + cut_index=self.find_contact_point(plot) #cut even more, before the blind window start_x=xret[cut_index] blind_index=0 @@ -168,7 +167,6 @@ class flatfiltsCommands: break blind_index+=1 cut_index+=blind_index - #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) @@ -222,8 +220,6 @@ class flatfiltsCommands: if len(args)==0: args=self.convfilt_config['mindeviation'] - - try: abs_devs=float(args) except: @@ -296,7 +292,6 @@ class flatfiltsCommands: print '(Please wait)' notflat_list=[] - c=0 for item in self.current_list: c+=1 @@ -334,6 +329,7 @@ class flatfiltsCommands: self.current=self.current_list[self.pointer] self.do_plot(0) + def do_setconv(self,args): ''' SETCONV -- 2.26.2