Removed sha-bang from non-executable python files + whitespace cleanups.
[hooke.git] / hooke / driver / hemingclamp.py
index e2f2e1c2ebaee147cf0500b020c3750be382a920..41e721a295c6e04df93f04fe62ae9ede49cf1e55 100755 (executable)
@@ -1,11 +1,9 @@
-#!/usr/bin/env python
-
 '''
 libhemingclamp.py
 
 Library for interpreting Hemingway force spectroscopy files.
 
-Copyright (C) 2008 Massimo Sandal, Marco Brucale (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.
 '''
@@ -16,35 +14,35 @@ __changelog__='''
 2007_02_07: Initial implementation
 '''
 import string
-import libhookecurve as lhc 
+import libhookecurve as lhc
 
 class DataChunk(list):
     '''Dummy class to provide ext and ret methods to the data list.
     In this case ext and self can be equal.
     '''
-    
+
     def ext(self):
         return self
-        
+
     def ret(self):
         return self
 
 class hemingclampDriver(lhc.Driver):
-    
+
     def __init__(self, filename):
-        
+
         self.filedata = open(filename,'r')
         self.data = self.filedata.readlines()[6:]
         self.filedata.close()
-        
+
         self.filetype = 'hemingclamp'
         self.experiment = 'clamp'
-        
+
         self.filename=filename
-       
+
     def __del__(self):
-        self.filedata.close()   
-    
+        self.filedata.close()
+
     def is_me(self):
         '''
         we define our magic heuristic for HemingClamp files
@@ -56,7 +54,7 @@ class hemingclampDriver(lhc.Driver):
             return True
         else:
             return False
-        
+
     def _getdata_all(self):
         time = []
         phase = []
@@ -65,7 +63,7 @@ class hemingclampDriver(lhc.Driver):
         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
@@ -78,24 +76,24 @@ class hemingclampDriver(lhc.Driver):
             if phase[x] != trim_counter:
                 trim_indexes.append(x)
                 trim_counter = phase[x]
-       
+
         #we rebuild the time counter assuming 1 point = 1 millisecond
         c=0.0
         for z in zpiezo:
             time.append(c)
-            c+=(1.0e-3)            
-            
+            c+=(1.0e-3)
+
         return time,phase,zpiezo,defl,imposed,trim_indexes
-        
+
     def time(self):
         return DataChunk(self._getdata_all()[0])
 
     def phase(self):
         return DataChunk(self._getdata_all()[1])
-    
+
     def zpiezo(self):
         return DataChunk(self._getdata_all()[2])
-     
+
     def deflection(self):
         return DataChunk(self._getdata_all()[3])
 
@@ -104,31 +102,31 @@ class hemingclampDriver(lhc.Driver):
 
     def trimindexes(self):
         return DataChunk(self._getdata_all()[5])
-    
+
     def close_all(self):
         '''
         Explicitly closes all files
         '''
         self.filedata.close()
-    
+
     def default_plots(self):
         main_plot=lhc.PlotObject()
         defl_plot=lhc.PlotObject()
-        
+
         time=self.time()
         phase=self.phase()
         zpiezo=self.zpiezo()
         deflection=self.deflection()
         imposed=self.imposed()
-                
+
         main_plot.vectors=[[time,zpiezo],[time,phase]]
         main_plot.units=['seconds','meters']
         main_plot.destination=0
         main_plot.title=self.filename
-        
+
         defl_plot.vectors=[[time,deflection],[time,imposed]]
         defl_plot.units=['seconds','Newtons']
         defl_plot.destination=1
+
         return [main_plot, defl_plot]
-    
\ No newline at end of file
+