print 'Using fit function: ',self.config['fit_function']
print 'Measurements for all peaks detected:'
- print 'contour (nm)', c_lengths
- print 'sigma contour (nm)',sigma_c_lengths
- print 'p (nm)',p_lengths
- print 'sigma p (nm)',sigma_p_lengths
- print 'forces (pN)',forces
- print 'slopes (N/m)',slopes
+ print 'contour (nm)', self.print_prec(c_lengths,1)
+ print 'sigma contour (nm)',self.print_prec(sigma_c_lengths,2)
+ print 'p (nm)',self.print_prec(p_lengths,3)
+ print 'sigma p (nm)',self.print_prec(sigma_p_lengths,3)
+ print 'forces (pN)',self.print_prec(forces,1)
+ print 'slopes (N/m)',self.print_prec(slopes,3)
controller=False
while controller==False:
sigma_p_lengths=[item for item in sigma_p_lengths if item != None]
print 'Measurements for chosen peaks:'
- print 'contour (nm)',c_lengths
- print 'sigma contour (nm)',sigma_c_lengths
- print 'p (nm)',p_lengths
- print 'sigma p (nm)',sigma_p_lengths
- print 'forces (pN)',forces
- print 'slopes (N/m)',slopes
+ print 'contour (nm)', self.print_prec(c_lengths,1)
+ print 'sigma contour (nm)',self.print_prec(sigma_c_lengths,2)
+ print 'p (nm)',self.print_prec(p_lengths,3)
+ print 'sigma p (nm)',self.print_prec(sigma_p_lengths,3)
+ print 'forces (pN)',self.print_prec(forces,1)
+ print 'slopes (N/m)',self.print_prec(slopes,3)
#Save file info
if self.autofile=='':
class curvetoolsCommands:
+ def print_prec(self, arr, prec):
+ try:
+ nparr=np.array(arr)
+ np.set_printoptions(precision=prec)
+ #we remove the parentesis if the array is longer that 1
+ if len(nparr)>1:
+ strvals=str(nparr)[1:-1]
+ return strvals
+ except:
+ return "Error in the array."
+
def fit_interval_nm(self,start_index,plot,nm,backwards):
'''
Calculates the number of points to fit, given a fit interval in nm
CUT
(cut.py)
Cut the selected signal between two points.
- With the first parameter you have to select the signal (for FS for example
+ The first parameters is useful to select the window, with a single window wichplot is "0" (zero).
+ With the second parameter you have to select the signal (for FS for example
you can select with "0" the approacing curve and 1 for the retracting
curve. This depend also on how many set of data you have on the graph).
With the second parameter you select the output name file for the selection.
The data is arranged in two simple column without a header, the first column
is the "x" data and the second the "y".
-----------------
- Syntax: distance "whatset" "namefile"
+ Syntax: cut "whichplot" "whatset" "namefile"
'''
if len(args)==0:
print "This command need the number of the graph that you want save and a name for the output file."
a=args.split()
-
- whatset=int(a[0])
- outfile=a[1]
+ whichplot=int(a[0])
+ whatset=int(a[1])
+ outfile=a[2]
plot=self._get_displayed_plot()
-
+ #print plot
+
print 'Select two points'
points=self._measure_N_points(N=2, whatset=whatset)
minbound=min(points[0].index, points[1].index)
maxbound=max(points[0].index, points[1].index)
- boundpoints=[minbound, maxbound]
- yarr=plot.vectors[whatset][1][boundpoints[0]:boundpoints[1]]
- xarr=plot.vectors[whatset][0][boundpoints[0]:boundpoints[1]]
+
+ xarr=[]
+ yarr=[]
+ try:
+ dataset=self.plots[whichplot].vectors[whatset]
+ except:
+ print "Invalid whichplot."
+ return
+
+ xarr=dataset[0][minbound:maxbound]
+ yarr=dataset[1][minbound:maxbound]
+
+
f=open(outfile,'w+')
for i in range(len(yarr)):
f.write(str(xarr[i])+";"+str(yarr[i])+"\n")
f.close()
-
-
#!/usr/bin/env python
-# -*- coding: iso-8859-1 -*-
+# -*- coding: utf-8 -*-
'''
generalvclamp.py
return
else:
dx,unitx,dy,unity=self._delta(set=1)
- print str(dx*(10**9))+' nm'
+ print "%.1f nm" %(dx*(10**9))
to_dump='distance '+self.current.path+' '+str(dx*(10**9))+' nm'
self.outlet.push(to_dump)
print 'This command makes no sense for a force clamp experiment.'
return
dx,unitx,dy,unity=self._delta(set=1)
- print str(dy*(10**12))+' pN'
+ print " %.1f pN"%(dy*(10**12))
to_dump='force '+self.current.path+' '+str(dy*(10**12))+' pN'
self.outlet.push(to_dump)
avg=np.mean(to_average)
forcebase=abs(y-avg)
- print str(forcebase*(10**12))+' pN'
+ print "%.1f pN"%(forcebase*(10**12))
to_dump='forcebase '+self.current.path+' '+str(forcebase*(10**12))+' pN'
self.outlet.push(to_dump)
<pcluster/>\r
<generaltccd/>\r
<multidistance/>\r
- <jumpstat/>
- <review/>
+ <jumpstat/>\r
+ <review/>\r
+ <cut/>\r
<multifit/> \r
</plugins>\r
\r
<!-- tutorialdriver/ -->\r
<jpk/>\r
<mfp1dexport/>\r
- <mcs/>
- <!-- hdf5/ -->
+ <mcs/>\r
+ <!-- hdf5/ -->\r
<mfp3d/> \r
</drivers>\r
\r
<multiplier/>\r
<clamp/>\r
<threshold/>\r
- <coincident/>
+ <coincident/>\r
<centerzero/>\r
</plotmanips>\r
\r
X1 , Y1 , X2 , Y2 , X3 , Y3 ...
-------------
-Syntax: txt [filename] {plot to export}
+Syntax: txt [filename] {plot to export} or
+ txt [filename] all
+ all : To save all the curves in different windows in a single file.
'''
def do_txt(self,args):
else:
filename=linp.checkalphainput(args[0],self.current.path+'.txt',[])
try:
- whichplot=int(args[1])
+ if args[1]=="all":
+ whichplot="all"
+ else:
+ whichplot=int(args[1])
except:
pass
+
+ if whichplot!="all":
+ try:
+ outofplot=self.plots[whichplot].vectors
+ except:
+ print "Plot index out of range."
+ return 0
+ columns=[]
+ for dataset in self.plots[whichplot].vectors:
+ for i in range(0,len(dataset)):
+ columns.append([])
+ for value in dataset[i]:
+ #columns[-1].append(str(value*(10**9)))
+ columns[-1].append(str(value))
+ rows=transposed2(columns, 'nan')
+ rows=[' , '.join(item) for item in rows]
+ text='\n'.join(rows)
+
+ txtfile=open(filename,'w+')
+ #Save units of measure in header
+ txtfile.write('X:'+self.plots[whichplot].units[0]+'\n')
+ txtfile.write('Y:'+self.plots[whichplot].units[1]+'\n')
+ txtfile.write(text)
+ txtfile.close()
- try:
- outofplot=self.plots[whichplot].vectors
- except:
- print "Plot index out of range."
- return 0
-
- columns=[]
- for dataset in self.plots[whichplot].vectors:
- for i in range(0,len(dataset)):
- columns.append([])
- for value in dataset[i]:
- columns[-1].append(str(value))
-
- rows=transposed2(columns, 'nan')
- rows=[' , '.join(item) for item in rows]
- text='\n'.join(rows)
-
- txtfile=open(filename,'w+')
- #Save units of measure in header
- txtfile.write('X:'+self.plots[whichplot].units[0]+'\n')
- txtfile.write('Y:'+self.plots[whichplot].units[1]+'\n')
- txtfile.write(text)
- txtfile.close()
+ else:
+ columns=[]
+ for wp in range(len(self.plots)):
+ for dataset in self.plots[wp].vectors:
+ for i in range(0,len(dataset)):
+ columns.append([])
+ for value in dataset[i]:
+ #columns[-1].append(str(value*(10**9)))
+ columns[-1].append(str(value))
+ rows=transposed2(columns, 'nan')
+ rows=[' , '.join(item) for item in rows]
+ text='\n'.join(rows)
+
+ txtfile=open(filename,'w+')
+ #Save units of measure in header
+ for i in range(len(self.plots)):
+ txtfile.write('X:'+self.plots[i].units[0]+'\n')
+ txtfile.write('Y:'+self.plots[i].units[1]+'\n')
+ txtfile.write(text)
+ txtfile.close()
#LOGGING, REPORTING, NOTETAKING