Ugly fix for contact point freeze; some copyright notices updated.
authordevicerandom <devnull@localhost>
Fri, 30 May 2008 10:42:56 +0000 (10:42 +0000)
committerdevicerandom <devnull@localhost>
Fri, 30 May 2008 10:42:56 +0000 (10:42 +0000)
fit.py
generalclamp.py
generalvclamp.py
hemingclamp.py
hooke.conf

diff --git a/fit.py b/fit.py
index b8f4717e6b9f60f1a566d6ea20269534b7e2e4e2..f70636f06786a0eff4e760769c4e53ad986f13d8 100755 (executable)
--- a/fit.py
+++ b/fit.py
@@ -305,6 +305,7 @@ class fitCommands:
         endlength=int(len(xret)/2)
     
         ok=False
+        
         while not ok:
             xchunk=yext[endlength:monlength]
             ychunk=yext[endlength:monlength]
@@ -316,6 +317,7 @@ class fitCommands:
             else:
                 ok=True  
                   
+        
         ymean=scipy.mean(ychunk) #baseline
     
         index=0
@@ -329,6 +331,8 @@ class fitCommands:
             except IndexError:
                 #The algorithm didn't find anything below the baseline! It should NEVER happen
                 index=0            
+                return index
+            
         return index
                         
     
@@ -366,6 +370,7 @@ class fitCommands:
         xchunk=xext[endlength:monlength]
         ychunk=yext[endlength:monlength]
         regr=scipy.polyfit(xchunk,ychunk,1)[0:2]
+        
         '''
         while not ok:
             xchunk=yext[endlength:monlength]
index 477454e0536e51b9d7b52623a6c0f1a01656b830..508d9a3d38ea2070bd78e1a802ecc8f5b8c9eaea 100644 (file)
@@ -3,69 +3,71 @@
 '''
 GENERALCLAMP.py
 
+(c) 2008 Marco Brucale, Massimo Sandal
+
 Plugin regarding general force clamp measurements
 '''
 from libhooke import WX_GOOD, ClickedPoint
-import wxversion\r
+import wxversion
 import libhookecurve as lhc
 wxversion.select(WX_GOOD)
-from wx import PostEvent\r
+from wx import PostEvent
+
+class generalclampCommands:
 
-class generalclampCommands:\r
-\r
     def plotmanip_clamp(self, plot, current, customvalue=False):
         '''
-        Handles some viewing options for the "force clamp" data format, depending on the state of these configuration variables:\r
-        (1) If self.config['fc_showphase'] != 0, the 'phase' data column (i.e. the 2nd) is shown in the 0th graph (else it isn't)\r
-        (2) If self.config['fc_showimposed'] != 0, the 'imposed deflection' data column (i.e. the 5th) is shown in the 1st graph (else it isn't)\r
+        Handles some viewing options for the "force clamp" data format, depending on the state of these configuration variables:
+        (1) If self.config['fc_showphase'] != 0, the 'phase' data column (i.e. the 2nd) is shown in the 0th graph (else it isn't)
+        (2) If self.config['fc_showimposed'] != 0, the 'imposed deflection' data column (i.e. the 5th) is shown in the 1st graph (else it isn't)
         (3) If self.config['fc_interesting'] == 0, the entire curve is shown in the graphs; if it has a non-zero value N, only phase N is shown.
-\r
-        NOTE - my implementation of point(3) feels quite awkward - someone smarter than me plz polish that!\r
-\r
+
+        NOTE - my implementation of point(3) feels quite awkward - someone smarter than me plz polish that!
+
         '''
         
         #not a fclamp curve...
         if current.curve.experiment != 'clamp':
-            return plot\r
-\r
-        if self.config['fc_interesting'] != 0 and plot.destination==0:\r
-            lower = int((self.config['fc_interesting'])-1)\r
-            upper = int((self.config['fc_interesting'])+1)\r
-            trim = current.curve.trimindexes()[lower:upper]\r
-            newtime = []\r
-            newzpiezo = []\r
-            newphase = []\r
-            for x in range(trim[0],trim[1]):\r
-                newtime.append(self.plots[0].vectors[0][0][x])\r
-                newzpiezo.append(self.plots[0].vectors[0][1][x])\r
-                newphase.append(self.plots[0].vectors[1][1][x])\r
-            self.plots[0].vectors[0][0] = newtime\r
-            self.plots[0].vectors[0][1] = newzpiezo\r
-            self.plots[0].vectors[1][0] = newtime\r
-            self.plots[0].vectors[1][1] = newphase\r
-\r
-        if self.config['fc_interesting'] != 0 and plot.destination==1:\r
-            lower = int((self.config['fc_interesting'])-1)\r
-            upper = int((self.config['fc_interesting'])+1)\r
-            trim = current.curve.trimindexes()[lower:upper]\r
-            newtime = []\r
-            newdefl = []\r
-            newimposed = []\r
-            for x in range(trim[0],trim[1]):\r
-                newtime.append(self.plots[1].vectors[0][0][x])\r
-                newdefl.append(self.plots[1].vectors[0][1][x])\r
-                newimposed.append(self.plots[1].vectors[1][1][x])\r
-            self.plots[1].vectors[0][0] = newtime\r
-            self.plots[1].vectors[0][1] = newdefl\r
-            self.plots[1].vectors[1][0] = newtime\r
-            self.plots[1].vectors[1][1] = newimposed            \r
-                        \r
-        if self.config['fc_showphase'] == 0 and plot.destination==0:\r
-            self.plots[0].remove_set(1)\r
-            \r
-        if self.config['fc_showimposed'] == 0 and plot.destination==1:\r
-            self.plots[1].remove_set(1)\r
-                         \r
+            return plot
+
+        if self.config['fc_interesting'] != 0 and plot.destination==0:
+            lower = int((self.config['fc_interesting'])-1)
+            upper = int((self.config['fc_interesting'])+1)
+            trim = current.curve.trimindexes()[lower:upper]
+            newtime = []
+            newzpiezo = []
+            newphase = []
+            for x in range(trim[0],trim[1]):
+                newtime.append(self.plots[0].vectors[0][0][x])
+                newzpiezo.append(self.plots[0].vectors[0][1][x])
+                newphase.append(self.plots[0].vectors[1][1][x])
+            self.plots[0].vectors[0][0] = newtime
+            self.plots[0].vectors[0][1] = newzpiezo
+            self.plots[0].vectors[1][0] = newtime
+            self.plots[0].vectors[1][1] = newphase
+
+        if self.config['fc_interesting'] != 0 and plot.destination==1:
+            lower = int((self.config['fc_interesting'])-1)
+            upper = int((self.config['fc_interesting'])+1)
+            trim = current.curve.trimindexes()[lower:upper]
+            newtime = []
+            newdefl = []
+            newimposed = []
+            for x in range(trim[0],trim[1]):
+                newtime.append(self.plots[1].vectors[0][0][x])
+                newdefl.append(self.plots[1].vectors[0][1][x])
+                newimposed.append(self.plots[1].vectors[1][1][x])
+            self.plots[1].vectors[0][0] = newtime
+            self.plots[1].vectors[0][1] = newdefl
+            self.plots[1].vectors[1][0] = newtime
+            self.plots[1].vectors[1][1] = newimposed            
+                        
+        if self.config['fc_showphase'] == 0 and plot.destination==0:
+            self.plots[0].remove_set(1)
+            
+        if self.config['fc_showimposed'] == 0 and plot.destination==1:
+            self.plots[1].remove_set(1)
+                         
         return plot
       
     def do_time(self,args):
@@ -76,9 +78,9 @@ class generalclampCommands:
         ----
         Syntax: time
         '''
-        if self.current.curve.experiment == 'clamp':\r
+        if self.current.curve.experiment == 'clamp':
             print 'Click two points.'
-            time=self._delta(set=0)[0]\r
+            time=self._delta(set=0)[0]
             print str(time*1000)+' ms'
         else:
             print 'This command makes no sense for a non-force clamp experiment.'
index 4a8cd66874ae598550b08f433875a0c9fd3ceb10..d3adefd9bd2d9211b70f62a0913360d178415f48 100644 (file)
@@ -146,11 +146,13 @@ class generalvclampCommands:
             max_cycles=self.config['flatten'] #Using > 1 usually doesn't help and can give artefacts. However, it could be useful too.
         
         contact_index=self.find_contact_point()
+        
         valn=[[] for item in range(max_exponent)]
         yrn=[0.0 for item in range(max_exponent)]
         errn=[0.0 for item in range(max_exponent)]
         
         for i in range(int(max_cycles)):
+            
             x_ext=plot.vectors[0][0][contact_index+delta_contact:]
             y_ext=plot.vectors[0][1][contact_index+delta_contact:]
             x_ret=plot.vectors[1][0][contact_index+delta_contact:]
index 780c5cb9b6e40850def787137bbc92341982ad95..881a789d244d62065b0e7c54ffb0d58f0bf124f3 100755 (executable)
@@ -5,7 +5,7 @@ libhemingclamp.py
 
 Library for interpreting Hemingway force spectroscopy files.
 
-Copyright (C) 2006 Massimo Sandal (University of Bologna, Italy) 
+Copyright (C) 2008 Massimo Sandal, Marco Brucale (University of Bologna, Italy) 
 
 This program is released under the GNU General Public License version 2.
 '''
@@ -69,26 +69,26 @@ class hemingclampDriver(lhc.Driver):
             return False
         
     def _getdata_all(self):
-        time = []\r
+        time = []
         phase = []
         zpiezo = []
-        defl = []\r
-        imposed = []\r
-        trim_indexes = []\r
-        trim_counter = 0.0\r
+        defl = []
+        imposed = []
+        trim_indexes = []
+        trim_counter = 0.0
                         
         for i in self.data:
             temp = string.split(i)
             #time.append(float(temp[0])*(1.0e-3)) # This is managed differently now, since each data point = 1ms: see below
-            phase.append(float(temp[1])*(1.0e-7)) # The nonsensical (e-7) multiplier is just there to make phase data nicely plottable along other data\r
+            phase.append(float(temp[1])*(1.0e-7)) # The nonsensical (e-7) multiplier is just there to make phase data nicely plottable along other data
             zpiezo.append(float(temp[2])*(1.0e-9))
-            defl.append(float(temp[3])*(1.0e-9))\r
-            imposed.append(float(temp[4])*(1.0e-9))\r
-\r
+            defl.append(float(temp[3])*(1.0e-9))
+            imposed.append(float(temp[4])*(1.0e-9))
+
         for x in range (0,len(phase)):
             if phase[x] != trim_counter:
                 trim_indexes.append(x)
-                trim_counter = phase[x]\r
+                trim_counter = phase[x]
        
         #we rebuild the time counter assuming 1 point = 1 millisecond
         c=0.0
@@ -100,21 +100,21 @@ class hemingclampDriver(lhc.Driver):
         
     def time(self):
         return DataChunk(self._getdata_all()[0])
-\r
+
     def phase(self):
-        return DataChunk(self._getdata_all()[1])\r
+        return DataChunk(self._getdata_all()[1])
     
     def zpiezo(self):
         return DataChunk(self._getdata_all()[2])
      
     def deflection(self):
         return DataChunk(self._getdata_all()[3])
-\r
+
     def imposed(self):
-        return DataChunk(self._getdata_all()[4])\r
-\r
-    def trimindexes(self):\r
-        return DataChunk(self._getdata_all()[5])\r
+        return DataChunk(self._getdata_all()[4])
+
+    def trimindexes(self):
+        return DataChunk(self._getdata_all()[5])
     
     def close_all(self):
         '''
@@ -126,11 +126,11 @@ class hemingclampDriver(lhc.Driver):
         main_plot=lhc.PlotObject()
         defl_plot=lhc.PlotObject()
         
-        time=self.time()\r
+        time=self.time()
         phase=self.phase()
         zpiezo=self.zpiezo()
-        deflection=self.deflection()\r
-        imposed=self.imposed()\r
+        deflection=self.deflection()
+        imposed=self.imposed()
                 
         main_plot.vectors=[[time,zpiezo],[time,phase]]
         main_plot.units=['seconds','meters']
@@ -139,7 +139,7 @@ class hemingclampDriver(lhc.Driver):
         
         defl_plot.vectors=[[time,deflection],[time,imposed]]
         defl_plot.units=['seconds','Newtons']
-        defl_plot.destination=1\r
+        defl_plot.destination=1
  
         return [main_plot, defl_plot]
     
\ No newline at end of file
index b6756469b33787a2a3209d1b51d2deb4eeec18b9..11b387561e0c00e73ce9468fb98bf1e3686cb0ee 100755 (executable)
@@ -2,7 +2,7 @@
 <!-- To comment something, put dashes and ! like here -->
 <config>
 <!-- Internal variabls. -->
-    <display ext="1" colour_ext="None" ret="1" colour_ret="None" correct="1" colour_correct="None" contact_point="0" medfilt="0" xaxes="0" yaxes="0" flatten="1" temperature="293" auto_fit_points="50" auto_slope_span="20" auto_delta_force="10" fc_showphase="0" fc_showimposed="0" fc_interesting="0"/>
+    <display ext="1" colour_ext="None" ret="1" colour_ret="None" correct="1" colour_correct="None" contact_point="0" medfilt="0" xaxes="0" yaxes="0" flatten="0" temperature="293" auto_fit_points="50" auto_slope_span="20" auto_delta_force="10" fc_showphase="0" fc_showimposed="0" fc_interesting="0"/>
 
 <!-- 
 The following section defines your own work directory. Substitute your work directory.
@@ -32,9 +32,9 @@ This section defines which drivers have to be loaded by Hooke.
     -->
 <drivers>
     <picoforce/>
-    <hemingclamp/>
+    <!-- hemingclamp/ -->
     <csvdriver/>
-    <tutorialdriver/>
+    <!-- tutorialdriver/ -->
 </drivers>
 
 <!--