6 (c) 2008 Marco Brucale, Massimo Sandal
8 Plugin regarding general force clamp measurements
10 from libhooke import WX_GOOD, ClickedPoint
12 import libhookecurve as lhc
13 wxversion.select(WX_GOOD)
14 from wx import PostEvent
16 class generalclampCommands:
18 def plotmanip_clamp(self, plot, current, customvalue=False):
20 Handles some viewing options for the "force clamp" data format, depending on the state of these configuration variables:
21 (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)
22 (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)
23 (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.
25 NOTE - my implementation of point(3) feels quite awkward - someone smarter than me plz polish that!
29 #not a fclamp curve...
30 if current.curve.experiment != 'clamp':
33 if self.config['fc_interesting'] != 0 and plot.destination==0:
34 lower = int((self.config['fc_interesting'])-1)
35 upper = int((self.config['fc_interesting'])+1)
36 trim = current.curve.trimindexes()[lower:upper]
40 for x in range(trim[0],trim[1]):
41 newtime.append(self.plots[0].vectors[0][0][x])
42 newzpiezo.append(self.plots[0].vectors[0][1][x])
43 newphase.append(self.plots[0].vectors[1][1][x])
44 self.plots[0].vectors[0][0] = newtime
45 self.plots[0].vectors[0][1] = newzpiezo
46 self.plots[0].vectors[1][0] = newtime
47 self.plots[0].vectors[1][1] = newphase
49 if self.config['fc_interesting'] != 0 and plot.destination==1:
50 lower = int((self.config['fc_interesting'])-1)
51 upper = int((self.config['fc_interesting'])+1)
52 trim = current.curve.trimindexes()[lower:upper]
56 for x in range(trim[0],trim[1]):
57 newtime.append(self.plots[1].vectors[0][0][x])
58 newdefl.append(self.plots[1].vectors[0][1][x])
59 newimposed.append(self.plots[1].vectors[1][1][x])
60 self.plots[1].vectors[0][0] = newtime
61 self.plots[1].vectors[0][1] = newdefl
62 self.plots[1].vectors[1][0] = newtime
63 self.plots[1].vectors[1][1] = newimposed
65 if self.config['fc_showphase'] == 0 and plot.destination==0:
66 self.plots[0].remove_set(1)
68 if self.config['fc_showimposed'] == 0 and plot.destination==1:
69 self.plots[1].remove_set(1)
73 def do_time(self,args):
76 Measure the time difference (in seconds) between two points
77 Implemented only for force clamp
81 if self.current.curve.experiment == 'clamp':
82 print 'Click two points.'
83 time=self._delta(set=0)[0]
84 print str(time*1000)+' ms'
86 print 'This command makes no sense for a non-force clamp experiment.'
88 def do_zpiezo(self,args):
91 Measure the zpiezo difference (in nm) between two points
92 Implemented only for force clamp
96 if self.current.curve.experiment == 'clamp':
97 print 'Click two points.'
98 points=self._measure_N_points(N=2)
99 zpiezo=abs(points[0].graph_coords[1]-points[1].graph_coords[1])
100 print str(zpiezo*(10**9))+' nm'
101 to_dump='zpiezo '+self.current.path+' '+str(zpiezo*(10**9))+' nm'
102 self.outlet.push(to_dump)
104 print 'This command makes no sense for a non-force clamp experiment.'
106 def do_defl(self,args):
109 Measure the deflection difference (in nm) between two points
110 Implemented only for force clamp
111 NOTE: It makes sense only on the time VS defl plot; it is still not masked for the other plot...
115 if self.current.curve.experiment == 'clamp':
116 print 'Click two points.'
117 points=self._measure_N_points(N=2)
118 defl=abs(points[0].graph_coords[1]-points[1].graph_coords[1])
119 print str(defl*(10**12))+' pN'
120 to_dump='deflection '+self.current.path+' '+str(defl*(10**12))+' pN'
121 self.outlet.push(to_dump)
123 print 'This command makes no sense for a non-force clamp experiment.'
125 def do_step(self,args):
129 Measures the length and time duration of a time-Z step
133 if self.current.curve.experiment == 'clamp':
134 print 'Click three points in this fashion:'
135 print ' (0)-------(1)'
138 print ' (2)----------'
139 points=self._measure_N_points(N=3,whatset=0)
140 dz=abs(points[2].graph_coords[1]-points[1].graph_coords[1])*(10e+8)
141 dt=abs(points[1].graph_coords[0]-points[0].graph_coords[0])
142 print 'dZ: ',dz,' nm'
144 to_dump='step '+self.current.path+' '+'dZ: '+str(dz)+' nm'+' dT: '+str(dt)+' s'
145 self.outlet.push(to_dump)
148 print 'This command makes no sense for a non-force clamp experiment.'