Merged with trunk
[hooke.git] / hooke / plugin / multidistance.py
similarity index 95%
rename from multidistance.py
rename to hooke/plugin/multidistance.py
index 903ba4f0d170763bb8ec9b579e24e54b8deb9166..e2370b6859ce453bbf493be68b0af2820c95093d 100644 (file)
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
-from libhooke import WX_GOOD, ClickedPoint
+from hooke.libhooke import WX_GOOD, ClickedPoint
+
 import wxversion
 wxversion.select(WX_GOOD)
 from wx import PostEvent
@@ -13,8 +14,8 @@ import warnings
 warnings.simplefilter('ignore',np.RankWarning)
 
 
-class multidistanceCommands:
-    
+class multidistanceCommands(object):
+
     def do_multidistance(self,args):
      '''
      MULTIDISTANCE
@@ -25,7 +26,7 @@ class multidistanceCommands:
      of an existing file, autopeak will resume it and append measurements to it. If you are giving
      a new filename, it will create the file and append to it until you close Hooke.
      You can also define a minimun deviation of the peaks.
-     
+
      Syntax:
      multidistance [deviation]
      deviation = number of times the convolution signal is above the noise absolute deviation.
@@ -38,13 +39,13 @@ class multidistanceCommands:
      #if no peaks, we have nothing to plot. exit.
      if len(peaks_location)==0:
             return
-        
+
      #otherwise, we plot the peak locations.
      xplotted_ret=self.plots[0].vectors[1][0]
      yplotted_ret=self.plots[0].vectors[1][1]
      xgood=[xplotted_ret[index] for index in peaks_location]
      ygood=[yplotted_ret[index] for index in peaks_location]
-        
+
      recplot=self._get_displayed_plot()
      recplot.vectors.append([xgood,ygood])
      if recplot.styles==[]:
@@ -62,7 +63,7 @@ class multidistanceCommands:
      if exclude_raw=='N':
         print 'Discarded.'
         return
-     
+
      if not exclude_raw=='':
         exclude=exclude_raw.split(',')
        #we convert in numbers the input
@@ -83,13 +84,13 @@ class multidistanceCommands:
              peaks_location=  peaks_location[0:new_a]+peaks_location[new_a+1:]
              peak_size=            peak_size[0:new_a]+peak_size[new_a+1:]
           count+=1
-     
+
      #we calculate the distance vector
      dist=[]
      for i in range(len(peaks_location)-1):
          dist.append(xplotted_ret[peaks_location[i]]-xplotted_ret[peaks_location[i+1]])
-     
-     
+
+
 
 
 
@@ -99,7 +100,7 @@ class multidistanceCommands:
             if self.autofile=='':
                 print 'Not saved.'
                 return
-        
+
      if not os.path.exists(self.autofile):
             f=open(self.autofile,'w+')
             f.write('Analysis started '+time.asctime()+'\n')
@@ -111,14 +112,14 @@ class multidistanceCommands:
               f.write(str(o))
             f.write("\n")
             f.close()
-            
+
      print 'Saving...'
      f=open(self.autofile,'a+')
-        
+
      f.write(self.current.path+'\n')
      for i in dist:
           f.write(";")
           f.write(str(i))
 
-     f.write("\n")            
+     f.write("\n")
      f.close()