1 | <<<<<<< .mine |
---|
2 | # -*- coding: utf-8 -*- |
---|
3 | """ |
---|
4 | Created on Mon Feb 6 15:47:25 2017 |
---|
5 | |
---|
6 | @author: delerue |
---|
7 | """ |
---|
8 | |
---|
9 | |
---|
10 | import numpy as np |
---|
11 | import matplotlib.pyplot as plt |
---|
12 | #from time import sleep |
---|
13 | from shutil import copyfile |
---|
14 | import os.path |
---|
15 | |
---|
16 | |
---|
17 | def read_plot_data(filename): |
---|
18 | #Definitions |
---|
19 | nchannels=32 |
---|
20 | |
---|
21 | #electron_signal |
---|
22 | electrons_channel=26 |
---|
23 | electrons_signal_scaling=0.05 |
---|
24 | electrons_threshold=-50 |
---|
25 | electrons_half_width=1 |
---|
26 | |
---|
27 | data_start=1 |
---|
28 | data_length=7035 |
---|
29 | electron_pretrig=5 |
---|
30 | # electron_trig_stop=500 |
---|
31 | electron_trig_stop=20 |
---|
32 | electron_post_trig_integration_start=1 |
---|
33 | electron_post_trig_integration_stop=500 |
---|
34 | |
---|
35 | #position signal |
---|
36 | position_channel=28 |
---|
37 | |
---|
38 | #channels mapping |
---|
39 | #channels_mapping=[17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27] |
---|
40 | data_mapping=[ 0, 111, 83, 76, 48, |
---|
41 | 55, 104, 69, 62, 0, |
---|
42 | 97, 90, 0, 118, 0, |
---|
43 | 0, 125, 0, 0, 0, |
---|
44 | 0, 0, 0, 0, 0, |
---|
45 | 0, 0, 0, 0, 0, |
---|
46 | 0, 0 ] |
---|
47 | |
---|
48 | |
---|
49 | #code |
---|
50 | angles_sorted=[] |
---|
51 | idx_angles_sorted=[] |
---|
52 | idx_data_mapping=np.zeros(len(data_mapping),dtype=np.int) |
---|
53 | |
---|
54 | for angle in np.sort(data_mapping): |
---|
55 | if angle>0: |
---|
56 | if len(angles_sorted)==0: |
---|
57 | angles_sorted=[angle] |
---|
58 | idx_angles_sorted=[data_mapping.index(angle)] |
---|
59 | else: |
---|
60 | angles_sorted.append(angle) |
---|
61 | idx_angles_sorted.append(data_mapping.index(angle)) |
---|
62 | idx_data_mapping[data_mapping.index(angle)]=int(len(angles_sorted)) |
---|
63 | |
---|
64 | key_values={} |
---|
65 | if (len(os.path.dirname(filename))==0): |
---|
66 | filename="./"+filename |
---|
67 | |
---|
68 | with open(filename,'r') as fid: |
---|
69 | fileline=fid.readline() |
---|
70 | while (len(fileline)>0)and(fileline[0]=='#'): |
---|
71 | entries=fileline.replace('#','').replace(' ','').replace('\n','').split('=') |
---|
72 | key_values[entries[0]]=entries[1] |
---|
73 | fileline=fid.readline() |
---|
74 | fid.close() |
---|
75 | |
---|
76 | print(key_values) |
---|
77 | |
---|
78 | alldata=np.loadtxt(filename, dtype='int32', comments='#', delimiter=' ', usecols=range(0,nchannels), converters={ _:lambda s: int(s , 16) for _ in range(0,nchannels) }) |
---|
79 | |
---|
80 | #converting the data in the correct format |
---|
81 | alldata=alldata%(2**16) |
---|
82 | alldata=(2**15)-alldata |
---|
83 | data_scaling_factor=(float(key_values['amplitude'])*5.)/(2.**15) |
---|
84 | time_scaling_factor=(36./float(key_values['acquisition_rate']))*1.e-3 |
---|
85 | |
---|
86 | #Looking for electrons |
---|
87 | electrons_found=False |
---|
88 | if (min(alldata[:,electrons_channel])<electrons_threshold): |
---|
89 | elec=alldata[:,electrons_channel] |
---|
90 | pos_elec=elec.argmin() |
---|
91 | while ((pos_elec>100)and(elec[pos_elec]<electrons_threshold)): |
---|
92 | pos_elec=pos_elec-1 |
---|
93 | if ((elec[pos_elec+electrons_half_width]<electrons_threshold)or(elec[pos_elec-electrons_half_width]<electrons_threshold)): |
---|
94 | electrons_found=True |
---|
95 | electron_data_start=pos_elec-electron_pretrig |
---|
96 | electron_data_stop=pos_elec+electron_trig_stop |
---|
97 | print('electrons found') |
---|
98 | |
---|
99 | #Mean position value |
---|
100 | # mean_position=np.mean(alldata[:,electrons_channel]) |
---|
101 | # print('Mean position: ', mean_position) |
---|
102 | # filename_position=filename.replace('.txt','.pos') |
---|
103 | # fid=open(filename_position,'w') |
---|
104 | # fid.write("pos: "+str(round(mean_position,3))) |
---|
105 | # fid.close() |
---|
106 | |
---|
107 | |
---|
108 | #prepare the figures |
---|
109 | fig=plt.figure(1,figsize=(12, 8)) |
---|
110 | if electrons_found: |
---|
111 | figzoom=plt.figure(2,figsize=(12, 8)) |
---|
112 | figsignal=plt.figure(3,figsize=(12, 8)) |
---|
113 | datasignal=np.zeros(len(angles_sorted)) |
---|
114 | filename_zoom_txt=filename.replace('.txt','.zoom_txt') |
---|
115 | fidz=open(filename_zoom_txt,'w') |
---|
116 | for jdata in range(electron_data_start,electron_data_stop): |
---|
117 | fidz.write(str(jdata*time_scaling_factor)) |
---|
118 | fidz.write(" ") |
---|
119 | fidz.write("\n") |
---|
120 | |
---|
121 | |
---|
122 | for idata in range(0,nchannels-1): |
---|
123 | this_data_scaling_factor=data_scaling_factor*-1 |
---|
124 | txtline='r' |
---|
125 | if idata%12==0: |
---|
126 | txtline='b' |
---|
127 | if data_mapping[idata] >0: |
---|
128 | txtline='r' |
---|
129 | else: |
---|
130 | txtline='b' |
---|
131 | |
---|
132 | linestyle='-' |
---|
133 | if idata==electrons_channel: |
---|
134 | txtline='k' |
---|
135 | this_data_scaling_factor=this_data_scaling_factor*electrons_signal_scaling |
---|
136 | |
---|
137 | if ((idata!=position_channel)and(idata!=22)and(idata!=21)): |
---|
138 | # data_start=9022 |
---|
139 | # data_length=9035 |
---|
140 | plt.figure(1) |
---|
141 | plt.plot(np.arange(data_start,data_length)*time_scaling_factor,alldata[range(data_start,data_length),idata].astype(np.float)*this_data_scaling_factor, txtline+linestyle) |
---|
142 | # plt.show() |
---|
143 | |
---|
144 | if (electrons_found): |
---|
145 | plt.figure(2) |
---|
146 | this_channel_baseline=0 |
---|
147 | baseline_offset=100 |
---|
148 | baseline_length=100 |
---|
149 | if (pos_elec>1000): |
---|
150 | this_channel_baseline=np.mean(alldata[range(electron_data_start-baseline_offset-baseline_length,electron_data_stop-baseline_offset),idata]) |
---|
151 | this_channel_baseline_rms=np.std(alldata[range(electron_data_start-baseline_offset-baseline_length,electron_data_stop-baseline_offset),idata])*-1 |
---|
152 | else: |
---|
153 | this_channel_baseline=np.mean(alldata[range(electron_data_start+baseline_offset,electron_data_stop+baseline_offset+baseline_length),idata]) |
---|
154 | this_channel_baseline_rms=np.sqrt(np.std(alldata[range(electron_data_start+baseline_offset,electron_data_stop+baseline_offset+baseline_length),idata]))*-1 |
---|
155 | |
---|
156 | plt.plot(np.arange(electron_data_start,electron_data_stop)*time_scaling_factor,(alldata[range(electron_data_start,electron_data_stop),idata].astype(np.float)-this_channel_baseline)*this_data_scaling_factor, txtline+linestyle) |
---|
157 | plt.plot(np.arange(electron_data_start,electron_data_stop)*time_scaling_factor,np.zeros(len(range(electron_data_start,electron_data_stop)))+(this_channel_baseline_rms*this_data_scaling_factor), txtline+":") |
---|
158 | for jdata in range(electron_data_start,electron_data_stop): |
---|
159 | fidz.write('{:06.5e}'.format((alldata[jdata,idata].astype(np.float)-this_channel_baseline)*this_data_scaling_factor)) |
---|
160 | fidz.write(" ") |
---|
161 | fidz.write("\n") |
---|
162 | |
---|
163 | if data_mapping[idata]>0: |
---|
164 | plt.figure(3) |
---|
165 | txtline=txtline+'^' |
---|
166 | # datasignal[idx_data_mapping[idata]-1]=np.mean(alldata[range(pos_elec+electron_post_trig_integration_start,pos_elec+electron_post_trig_integration_stop),idata].astype(np.float)-this_channel_baseline)*this_data_scaling_factor |
---|
167 | datasignal[idx_data_mapping[idata]-1]=np.mean(alldata[range(pos_elec+electron_post_trig_integration_start,pos_elec+electron_post_trig_integration_stop),idata].astype(np.float)-this_channel_baseline)*this_data_scaling_factor |
---|
168 | plt.plot(data_mapping[idata], -1*datasignal[idx_data_mapping[idata]-1], txtline+linestyle) |
---|
169 | |
---|
170 | plt.figure(1) |
---|
171 | plt.title(key_values['date']+ ' --- Motor value: '+key_values['motor_value']+ ' --- Current: '+key_values['current_value']) |
---|
172 | plt.ylabel('Signal amplitude [V]') |
---|
173 | plt.xlabel('Time [ms]') |
---|
174 | plt.grid(True) |
---|
175 | imagename=filename.replace('.txt','.png') |
---|
176 | print(imagename) |
---|
177 | fig.savefig(imagename) |
---|
178 | plt.close(fig) |
---|
179 | imagename_no_path=os.path.basename(imagename) |
---|
180 | fid=open('list.html','a'); |
---|
181 | fid.write("<A HREF=") |
---|
182 | fid.write(imagename_no_path) |
---|
183 | fid.write("><IMG SRC=") |
---|
184 | fid.write(imagename_no_path) |
---|
185 | fid.write(" width=600>") |
---|
186 | fid.write("</A><BR/>") |
---|
187 | fid.write(imagename_no_path) |
---|
188 | fid.write("<BR/><BR/>\n") |
---|
189 | fid.close() |
---|
190 | copyfile(imagename,os.path.dirname(imagename)+'/last.png') |
---|
191 | |
---|
192 | if (electrons_found): |
---|
193 | fidz.close() |
---|
194 | plt.figure(2) |
---|
195 | plt.title(key_values['date']+ ' --- Motor value: '+key_values['motor_value']+ ' --- Current: '+key_values['current_value']) |
---|
196 | plt.ylabel('Signal amplitude [V] - pedestal removed') |
---|
197 | plt.xlabel('Time [ms]') |
---|
198 | plt.grid(True) |
---|
199 | imagenamezoom=filename.replace('.txt','_zoom.png') |
---|
200 | figzoom.savefig(imagenamezoom) |
---|
201 | plt.close(figzoom) |
---|
202 | copyfile(imagenamezoom,os.path.dirname(imagename)+'/last_zoom.png') |
---|
203 | |
---|
204 | imagenamezoom_no_path=os.path.basename(imagenamezoom) |
---|
205 | fid=open('zoom_list.html','a'); |
---|
206 | fid.write("<A HREF=") |
---|
207 | fid.write(imagenamezoom_no_path) |
---|
208 | fid.write("><IMG SRC=") |
---|
209 | fid.write(imagenamezoom_no_path) |
---|
210 | fid.write(" width=600>") |
---|
211 | fid.write("</A><BR/>") |
---|
212 | fid.write(imagenamezoom_no_path) |
---|
213 | fid.write("<BR/><BR/>\n") |
---|
214 | fid.close() |
---|
215 | |
---|
216 | plt.figure(3) |
---|
217 | plt.plot(angles_sorted,-1*datasignal,'b--') |
---|
218 | plt.title(key_values['date']+ ' --- Motor value: '+key_values['motor_value']+ ' --- Current: '+key_values['current_value']) |
---|
219 | plt.ylabel('Signal amplitude [V]') |
---|
220 | plt.xlabel('Detector angle (degree)') |
---|
221 | plt.grid(True) |
---|
222 | imagenamesignal=filename.replace('.txt','_signal.png') |
---|
223 | figsignal.savefig(imagenamesignal) |
---|
224 | plt.close(figsignal) |
---|
225 | copyfile(imagenamesignal,os.path.dirname(imagename)+'/last_signal.png') |
---|
226 | |
---|
227 | |
---|
228 | filenamesig=filename.replace('.txt','.sig') |
---|
229 | fid=open(filenamesig,'w'); |
---|
230 | for idata in range(0,len(datasignal)): |
---|
231 | fid.write(str(angles_sorted[idata])+" "+str(datasignal[idata])+"\n") |
---|
232 | fid.write("\n") |
---|
233 | fid.close() |
---|
234 | |
---|
235 | filenameval=filename.replace('.txt','.val') |
---|
236 | fid=open(filenameval,'w'); |
---|
237 | for key in key_values: |
---|
238 | fid.write(key+" = "+key_values[key]+" \n"); |
---|
239 | fid.close() |
---|
240 | |
---|
241 | imagenamesignal_no_path=os.path.basename(imagenamesignal) |
---|
242 | fid=open('signal_list.html','a'); |
---|
243 | fid.write("<A HREF=") |
---|
244 | fid.write(imagenamesignal_no_path) |
---|
245 | fid.write("><IMG SRC=") |
---|
246 | fid.write(imagenamesignal_no_path) |
---|
247 | fid.write(" width=600>") |
---|
248 | fid.write("</A><BR/>") |
---|
249 | fid.write(imagenamesignal_no_path) |
---|
250 | fid.write("<BR/><BR/>\n") |
---|
251 | fid.close() |
---|
252 | |
---|
253 | return; |
---|
254 | |
---|
255 | |
---|
256 | #read_plot_data('/Users/delerue/Downloads/CLIO/data_CLIO_2017-02-08_17-26-53.txt') |
---|
257 | #read_plot_data('/Users/delerue/Downloads/CLIO_tmp/20170227/data_CLIO_2017-02-27_12-01-14.txt') |
---|
258 | #read_plot_data('/Users/delerue/Downloads/CLIO_tmp/20170227/data_CLIO_2017-02-27_12-43-46.txt') |
---|
259 | #HWaddr 64:00:6a:3a:6f:1c |
---|
260 | ||||||| .r0 |
---|
261 | ======= |
---|
262 | # -*- coding: utf-8 -*- |
---|
263 | """ |
---|
264 | Created on Mon Feb 6 15:47:25 2017 |
---|
265 | |
---|
266 | @author: delerue |
---|
267 | """ |
---|
268 | |
---|
269 | |
---|
270 | import numpy as np |
---|
271 | import matplotlib.pyplot as plt |
---|
272 | #from time import sleep |
---|
273 | from shutil import copyfile |
---|
274 | import os.path |
---|
275 | |
---|
276 | |
---|
277 | def read_plot_data(filename): |
---|
278 | #Definitions |
---|
279 | nchannels=32 |
---|
280 | |
---|
281 | #electron_signal |
---|
282 | electrons_channel=30 |
---|
283 | electrons_signal_scaling=0.05 |
---|
284 | electrons_threshold=-5000 |
---|
285 | electrons_half_width=5 |
---|
286 | |
---|
287 | data_start=1 |
---|
288 | data_length=9035 |
---|
289 | electron_pretrig=5 |
---|
290 | # electron_trig_stop=500 |
---|
291 | electron_trig_stop=20 |
---|
292 | electron_post_trig_integration_start=1 |
---|
293 | electron_post_trig_integration_stop=5 |
---|
294 | |
---|
295 | #position signal |
---|
296 | position_channel=28 |
---|
297 | |
---|
298 | #channels mapping |
---|
299 | #channels_mapping=[17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27] |
---|
300 | data_mapping=[ 0, 0, 0, 0, 0, |
---|
301 | 0, 0, 0, 0, 0, |
---|
302 | 0, 0, 0, 0, 0, |
---|
303 | 30, 40, 50, 60, 70, |
---|
304 | 80, 90, 100, 110, 120, |
---|
305 | 130, 140, 0, 0, 0, |
---|
306 | 0, 0 ] |
---|
307 | |
---|
308 | |
---|
309 | #code |
---|
310 | key_values={} |
---|
311 | if (len(os.path.dirname(filename))==0): |
---|
312 | filename="./"+filename |
---|
313 | |
---|
314 | with open(filename,'r') as fid: |
---|
315 | fileline=fid.readline() |
---|
316 | while fileline[0]=='#': |
---|
317 | entries=fileline.replace('#','').replace(' ','').replace('\n','').split('=') |
---|
318 | key_values[entries[0]]=entries[1] |
---|
319 | fileline=fid.readline() |
---|
320 | fid.close() |
---|
321 | |
---|
322 | print(key_values) |
---|
323 | |
---|
324 | alldata=np.loadtxt(filename, dtype='int32', comments='#', delimiter=' ', usecols=range(0,nchannels), converters={ _:lambda s: int(s , 16) for _ in range(0,nchannels) }) |
---|
325 | |
---|
326 | #converting the data in the correct format |
---|
327 | alldata=alldata%(2**16) |
---|
328 | alldata=(2**15)-alldata |
---|
329 | data_scaling_factor=(float(key_values['amplitude'])*5.)/(2.**15) |
---|
330 | time_scaling_factor=(36./float(key_values['acquisition_rate']))*1.e-3 |
---|
331 | |
---|
332 | #Looking for electrons |
---|
333 | electrons_found=False |
---|
334 | if (min(alldata[:,electrons_channel])<electrons_threshold): |
---|
335 | elec=alldata[:,electrons_channel] |
---|
336 | pos_elec=elec.argmin() |
---|
337 | while ((pos_elec>100)and(elec[pos_elec]<electrons_threshold)): |
---|
338 | pos_elec=pos_elec-1 |
---|
339 | if ((elec[pos_elec+electrons_half_width]<electrons_threshold)or(elec[pos_elec-electrons_half_width]<electrons_threshold)): |
---|
340 | electrons_found=True |
---|
341 | electron_data_start=pos_elec-electron_pretrig |
---|
342 | electron_data_stop=pos_elec+electron_trig_stop |
---|
343 | print('electrons found') |
---|
344 | print elec[pos_elec] |
---|
345 | print pos_elec |
---|
346 | |
---|
347 | |
---|
348 | |
---|
349 | #Mean position value |
---|
350 | mean_position=np.mean(alldata[:,electrons_channel]) |
---|
351 | print('Mean position: ', mean_position) |
---|
352 | filename_position=filename.replace('.txt','.pos') |
---|
353 | fid=open(filename_position,'w') |
---|
354 | fid.write("pos: "+str(round(mean_position,3))) |
---|
355 | fid.close() |
---|
356 | |
---|
357 | |
---|
358 | #prepare the figures |
---|
359 | fig=plt.figure(1,figsize=(12, 8)) |
---|
360 | if electrons_found: |
---|
361 | figzoom=plt.figure(2,figsize=(12, 8)) |
---|
362 | figsignal=plt.figure(3,figsize=(12, 8)) |
---|
363 | datasignal=np.zeros(11) |
---|
364 | filename_zoom_txt=filename.replace('.txt','.zoom_txt') |
---|
365 | fidz=open(filename_zoom_txt,'w') |
---|
366 | for jdata in range(electron_data_start,electron_data_stop): |
---|
367 | fidz.write(str(jdata*time_scaling_factor)) |
---|
368 | fidz.write(" ") |
---|
369 | fidz.write("\n") |
---|
370 | |
---|
371 | |
---|
372 | for idata in range(17,nchannels): |
---|
373 | this_data_scaling_factor=data_scaling_factor*-1 |
---|
374 | txtline='r' |
---|
375 | if idata%6==0: |
---|
376 | txtline='b' |
---|
377 | if idata%6==1: |
---|
378 | txtline='g' |
---|
379 | if idata%6==2: |
---|
380 | txtline='k' |
---|
381 | if idata%6==3: |
---|
382 | txtline='c' |
---|
383 | if idata%6==4: |
---|
384 | txtline='m' |
---|
385 | if idata%6==5: |
---|
386 | txtline='y' |
---|
387 | if idata==17: |
---|
388 | txtline='r' |
---|
389 | if idata==20: |
---|
390 | txtline='r' |
---|
391 | if idata==22: |
---|
392 | txtline='r' |
---|
393 | if idata==30: |
---|
394 | txtline='bs' |
---|
395 | linestyle='-' |
---|
396 | if idata==electrons_channel: |
---|
397 | this_data_scaling_factor=this_data_scaling_factor*electrons_signal_scaling |
---|
398 | |
---|
399 | if ((idata!=position_channel)): |
---|
400 | # data_start=9022 |
---|
401 | # data_length=9035 |
---|
402 | plt.figure(1) |
---|
403 | plt.plot(np.arange(data_start,data_length)*time_scaling_factor,alldata[range(data_start,data_length),idata].astype(np.float)*this_data_scaling_factor, txtline+linestyle) |
---|
404 | # plt.show() |
---|
405 | |
---|
406 | if (electrons_found): |
---|
407 | plt.figure(2) |
---|
408 | this_channel_baseline=0 |
---|
409 | baseline_offset=100 |
---|
410 | baseline_length=100 |
---|
411 | if (pos_elec>1000): |
---|
412 | this_channel_baseline=np.mean(alldata[range(electron_data_start-baseline_offset-baseline_length,electron_data_stop-baseline_offset),idata]) |
---|
413 | this_channel_baseline_rms=np.std(alldata[range(electron_data_start-baseline_offset-baseline_length,electron_data_stop-baseline_offset),idata])*-1 |
---|
414 | else: |
---|
415 | this_channel_baseline=np.mean(alldata[range(electron_data_start+baseline_offset,electron_data_stop+baseline_offset+baseline_length),idata]) |
---|
416 | this_channel_baseline_rms=np.sqrt(np.std(alldata[range(electron_data_start+baseline_offset,electron_data_stop+baseline_offset+baseline_length),idata]))*-1 |
---|
417 | |
---|
418 | plt.plot(np.arange(electron_data_start,electron_data_stop)*time_scaling_factor,(alldata[range(electron_data_start,electron_data_stop),idata].astype(np.float)-this_channel_baseline)*this_data_scaling_factor, txtline+linestyle) |
---|
419 | plt.plot(np.arange(electron_data_start,electron_data_stop)*time_scaling_factor,np.zeros(len(range(electron_data_start,electron_data_stop)))+(this_channel_baseline_rms*this_data_scaling_factor), txtline+":") |
---|
420 | for jdata in range(electron_data_start,electron_data_stop): |
---|
421 | fidz.write('{:06.5e}'.format((alldata[jdata,idata].astype(np.float)-this_channel_baseline)*this_data_scaling_factor)) |
---|
422 | fidz.write(" ") |
---|
423 | fidz.write("\n") |
---|
424 | |
---|
425 | if data_mapping[idata]>0: |
---|
426 | plt.figure(3) |
---|
427 | txtline=txtline+'^' |
---|
428 | datasignal[(data_mapping[idata]/10)-4]=np.mean(alldata[range(pos_elec+electron_post_trig_integration_start,pos_elec+electron_post_trig_integration_stop),idata].astype(np.float)-this_channel_baseline)*this_data_scaling_factor |
---|
429 | plt.plot(data_mapping[idata], datasignal[(data_mapping[idata]/10)-4], txtline+linestyle) |
---|
430 | |
---|
431 | plt.figure(1) |
---|
432 | plt.title(key_values['date']+ ' --- Position: '+str(round(mean_position,2))) |
---|
433 | plt.ylabel('Signal amplitude [V]') |
---|
434 | plt.xlabel('Time [ms]') |
---|
435 | plt.grid(True) |
---|
436 | imagename=filename.replace('.txt','.png') |
---|
437 | print(imagename) |
---|
438 | fig.savefig(imagename) |
---|
439 | plt.close(fig) |
---|
440 | imagename_no_path=os.path.basename(imagename) |
---|
441 | fid=open('list.html','a'); |
---|
442 | fid.write("<A HREF=") |
---|
443 | fid.write(imagename_no_path) |
---|
444 | fid.write("><IMG SRC=") |
---|
445 | fid.write(imagename_no_path) |
---|
446 | fid.write(" width=600>") |
---|
447 | fid.write("</A><BR/>") |
---|
448 | fid.write(imagename_no_path) |
---|
449 | fid.write("<BR/><BR/>\n") |
---|
450 | fid.close() |
---|
451 | copyfile(imagename,os.path.dirname(imagename)+'/last.png') |
---|
452 | |
---|
453 | if (electrons_found): |
---|
454 | fidz.close() |
---|
455 | plt.figure(2) |
---|
456 | plt.title(key_values['date']+ ' --- Position: '+str(round(mean_position,2))) |
---|
457 | plt.ylabel('Signal amplitude [V] - pedestal removed') |
---|
458 | plt.xlabel('Time [ms]') |
---|
459 | plt.grid(True) |
---|
460 | imagenamezoom=filename.replace('.txt','_zoom.png') |
---|
461 | figzoom.savefig(imagenamezoom) |
---|
462 | plt.close(figzoom) |
---|
463 | copyfile(imagenamezoom,os.path.dirname(imagename)+'/last_zoom.png') |
---|
464 | |
---|
465 | imagenamezoom_no_path=os.path.basename(imagenamezoom) |
---|
466 | fid=open('zoom_list.html','a'); |
---|
467 | fid.write("<A HREF=") |
---|
468 | fid.write(imagenamezoom_no_path) |
---|
469 | fid.write("><IMG SRC=") |
---|
470 | fid.write(imagenamezoom_no_path) |
---|
471 | fid.write(" width=600>") |
---|
472 | fid.write("</A><BR/>") |
---|
473 | fid.write(imagenamezoom_no_path) |
---|
474 | fid.write("<BR/><BR/>\n") |
---|
475 | fid.close() |
---|
476 | |
---|
477 | plt.figure(3) |
---|
478 | plt.plot(range(40,150,10),datasignal,'b--') |
---|
479 | plt.title(key_values['date']+ ' --- Position: '+str(round(mean_position,2))) |
---|
480 | plt.ylabel('Signal amplitude [V]') |
---|
481 | plt.xlabel('Detector angle (degree)') |
---|
482 | plt.grid(True) |
---|
483 | imagenamesignal=filename.replace('.txt','_signal.png') |
---|
484 | figsignal.savefig(imagenamesignal) |
---|
485 | plt.close(figsignal) |
---|
486 | copyfile(imagenamesignal,os.path.dirname(imagename)+'/last_signal.png') |
---|
487 | |
---|
488 | filenamesig=filename.replace('.txt','.sig') |
---|
489 | fid=open(filenamesig,'w'); |
---|
490 | fid.write(str(datasignal)) |
---|
491 | fid.close() |
---|
492 | |
---|
493 | imagenamesignal_no_path=os.path.basename(imagenamesignal) |
---|
494 | fid=open('signal_list.html','a'); |
---|
495 | fid.write("<A HREF=") |
---|
496 | fid.write(imagenamesignal_no_path) |
---|
497 | fid.write("><IMG SRC=") |
---|
498 | fid.write(imagenamesignal_no_path) |
---|
499 | fid.write(" width=600>") |
---|
500 | fid.write("</A><BR/>") |
---|
501 | fid.write(imagenamesignal_no_path) |
---|
502 | fid.write("<BR/><BR/>\n") |
---|
503 | fid.close() |
---|
504 | |
---|
505 | return; |
---|
506 | |
---|
507 | |
---|
508 | #read_plot_data('/Users/delerue/Downloads/CLIO/data_CLIO_2017-02-08_17-26-53.txt') |
---|
509 | #read_plot_data('/Users/delerue/Downloads/CLIO_tmp/20170227/data_CLIO_2017-02-27_12-01-14.txt') |
---|
510 | #read_plot_data('/Users/delerue/Downloads/CLIO_tmp/20170227/data_CLIO_2017-02-27_12-43-46.txt') |
---|
511 | #HWaddr 64:00:6a:3a:6f:1c |
---|
512 | >>>>>>> .r690 |
---|