# -*- 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
warnings.simplefilter('ignore',np.RankWarning)
-class multidistanceCommands:
-
+class multidistanceCommands(object):
+
def do_multidistance(self,args):
'''
MULTIDISTANCE
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.
#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==[]:
if exclude_raw=='N':
print 'Discarded.'
return
-
+
if not exclude_raw=='':
exclude=exclude_raw.split(',')
#we convert in numbers the input
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]])
-
-
+
+
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')
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()