From 9f2289a5aefda972adb5e4d38022e26e1cfd6c87 Mon Sep 17 00:00:00 2001 From: marcobrucale Date: Thu, 30 Apr 2009 10:21:49 +0000 Subject: [PATCH] Added a small feature in the 'autopeak' command. If the variable 'baseline_clicks' is set to -1, no baseline is calculated. Rather, the ordinate of the contact point (either hand-picked or automatically found depending on other autopeak arguments) is taken as the zero force point. --- autopeak.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/autopeak.py b/autopeak.py index 2474add..1eabb18 100644 --- a/autopeak.py +++ b/autopeak.py @@ -66,9 +66,10 @@ class autopeakCommands: auto_fit_nm = number of nm to fit before the peak maximum, for WLC (if usepoints false) auto_fit_points = number of points to fit before the peak maximum, for WLC (if usepoints true) - baseline_clicks = 0: automatic baseline - 1: decide baseline with a single click and length defined in auto_left_baseline - 2: let user click points of baseline + baseline_clicks = -1: no baseline, f=0 at the contact point (whether hand-picked or automatically found) + 0: automatic baseline + 1: decide baseline with a single click and length defined in auto_left_baseline + 2: let user click points of baseline auto_left_baseline = length in nm to use as baseline from the right point (if baseline_clicks=0 , 1) auto_right_baseline = distance in nm of peak-most baseline point from last peak (if baseline_clicks = 0) ''' @@ -106,7 +107,7 @@ class autopeakCommands: contact_point_index=contact_point.index self.wlccontact_point=contact_point self.wlccontact_index=contact_point.index - self.wlccurrent=self.current.path + self.wlccurrent=self.current.path return contact_point, contact_point_index def find_current_peaks(): @@ -186,7 +187,7 @@ class autopeakCommands: #Pick up force baseline if rebase: - clicks=self.config['baseline_clicks'] + clicks=self.config['baseline_clicks'] if clicks==0: self.basepoints=[] base_index_0=peak_location[-1]+fit_interval_nm(peak_location[-1], displayed_plot, self.config['auto_right_baseline'],False) @@ -207,8 +208,14 @@ class autopeakCommands: boundaries=[self.basepoints[0].index, self.basepoints[1].index] boundaries.sort() to_average=displayed_plot.vectors[1][1][boundaries[0]:boundaries[1]] #y points to average - avg=np.mean(to_average) - + avg=np.mean(to_average) + + clicks=self.config['baseline_clicks'] + if clicks==-1: + try: + avg=displayed_plot.vectors[1][1][contact_point_index] + except: + avg=displayed_plot.vectors[1][1][cindex] for peak in peak_location: #WLC FITTING -- 2.26.2