Added a small feature in the 'autopeak' command. If the variable 'baseline_clicks...
authormarcobrucale <devnull@localhost>
Thu, 30 Apr 2009 10:21:49 +0000 (10:21 +0000)
committermarcobrucale <devnull@localhost>
Thu, 30 Apr 2009 10:21:49 +0000 (10:21 +0000)
autopeak.py

index 2474add19db0ec51134e4bf2179baed3c16dadff..1eabb18ab9c990ab04cb583e262da4444c6b891c 100644 (file)
@@ -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)\r
+                           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\r
             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']\r
             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)\r
+        \r
+        clicks=self.config['baseline_clicks']\r
+        if clicks==-1:\r
+            try:\r
+                avg=displayed_plot.vectors[1][1][contact_point_index]
+            except:\r
+                avg=displayed_plot.vectors[1][1][cindex]
         
         for peak in peak_location:
             #WLC FITTING