(generalvclamp.py) fixed crash in autopeak due to too few points available for a fit
authordevicerandom <devnull@localhost>
Tue, 30 Sep 2008 16:03:37 +0000 (16:03 +0000)
committerdevicerandom <devnull@localhost>
Tue, 30 Sep 2008 16:03:37 +0000 (16:03 +0000)
generalvclamp.py

index fb0f793649b5e2fee1515b07de884710d4fa06ac..04271ccf5d35a9b78ccab366eec9146e4013b06a 100644 (file)
@@ -500,6 +500,11 @@ class generalvclampCommands:
             other_fit_point.find_graph_coords(displayed_plot.vectors[1][0], displayed_plot.vectors[1][1])    
             #do the fit
             points=[contact_point, peak_point, other_fit_point]
+            
+            #Check if we have enough points for a fit. If not, wlc_fit could crash
+            if abs(peak_point.index-other_fit_point.index) < 2:
+                continue
+            
             params, yfit, xfit = self.wlc_fit(points, displayed_plot.vectors[1][0], displayed_plot.vectors[1][1],pl_value,T)
             #save wlc values (nm)
             c_lengths.append(params[0]*(1.0e+9))