Changeset 748 in ETALON
- Timestamp:
- Nov 29, 2017, 8:27:37 AM (6 years ago)
- Location:
- CLIO/control
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
CLIO/control/CLIO_graphical_interface.py
r744 r748 22 22 global FILE_STOP 23 23 global FILE_PAUSE 24 global FILE_REF 25 global FILE_COMPARE 24 26 global data_directory 25 27 global code_directory … … 98 100 self.latestFileWithSignal.pack(side=TOP) 99 101 102 self.frameDataRefs = Frame(self.frameStatus) 103 self.frameDataRefs.pack(side=BOTTOM) 104 self.buttonSetRef = Button(self.frameDataRefs, text="Ref", command=self.onButtonRef) 105 self.buttonSetRef.pack(side=LEFT) 106 self.buttonSetCompare = Button(self.frameDataRefs, text="Compare", command=self.onButtonCompare) 107 self.buttonSetCompare.pack(side=LEFT) 108 self.buttonSetClearCompare = Button(self.frameDataRefs, text="Clr comp.", command=self.onButtonClearCompare) 109 self.buttonSetClearCompare.pack(side=LEFT) 110 100 111 #data acquisition 101 112 self.frameAcquisition = Frame(self.frameAllControls, borderwidth=10, relief=SUNKEN) … … 202 213 bgcolortxt='red' 203 214 fgcolortxt='black' 204 self.latestFileAcquired.config(text=os.path.basename(latest_file_acquired ),bg=bgcolortxt,fg=fgcolortxt)215 self.latestFileAcquired.config(text=os.path.basename(latest_file_acquired.replace("data_CLIO_","").replace(".sig","")),bg=bgcolortxt,fg=fgcolortxt) 205 216 206 217 list_of_files_processed = glob.glob(data_directory+"data_CLIO*.png") … … 219 230 bgcolortxt='red' 220 231 fgcolortxt='black' 221 self.latestFileProcessed.config(text=os.path.basename(latest_file_processed ),bg=bgcolortxt,fg=fgcolortxt)232 self.latestFileProcessed.config(text=os.path.basename(latest_file_processed.replace("data_CLIO_","").replace(".sig","")),bg=bgcolortxt,fg=fgcolortxt) 222 233 imageNames[0]=latest_file_processed; 223 234 … … 227 238 if (len(list_of_files_with_signal)>0): 228 239 #latest_file_with_signal = max(list_of_files_with_signal, key=os.path.getctime) 229 latest_file_with_signal = max(sorted(list_of_files_with_signal))230 filetime=os.path.getctime( latest_file_with_signal)240 self.latest_file_with_signal = max(sorted(list_of_files_with_signal)) 241 filetime=os.path.getctime(self.latest_file_with_signal) 231 242 if (time.time()-filetime)<threshold_recent: 232 243 bgcolortxt='green' … … 238 249 bgcolortxt='red' 239 250 fgcolortxt='black' 240 self.latestFileWithSignal.config(text=os.path.basename(latest_file_with_signal),bg=bgcolortxt,fg=fgcolortxt) 241 242 imageNames[0]=latest_file_with_signal.replace(".sig",".png") 243 imageNames[1]=latest_file_with_signal.replace(".sig","_zoom.png") 244 imageNames[2]=latest_file_with_signal.replace(".sig","_signal.png") 251 self.latestFileWithSignal.config(text=os.path.basename(self.latest_file_with_signal.replace("data_CLIO_","").replace(".sig","")),bg=bgcolortxt,fg=fgcolortxt) 252 253 imageNames[0]=self.latest_file_with_signal.replace(".sig",".png") 254 imageNames[1]=self.latest_file_with_signal.replace(".sig","_zoom.png") 255 imageNames[2]=self.latest_file_with_signal.replace(".sig","_signal.png") 256 imageNames[3]=self.latest_file_with_signal.replace(".sig","_amplitude.png") 257 imageNames[4]="/var/www/html/CLIO/data_comparison.png" 258 imageNames[5]="/var/www/html/CLIO/data_comparison_with_reference.png" 245 259 time.sleep(0.1) 246 260 … … 413 427 self.labelPositionCurrent.config(bg='cyan'); 414 428 self.labelPositionStep.config(bg='cyan'); 415 429 416 430 #---------------- 417 431 def onButtonBkd20k(self): … … 467 481 fid.write("stop") 468 482 fid.close() 483 484 def onButtonRef(self): 485 print "Set Ref "+ self.latest_file_with_signal 486 filename=FILE_REF 487 fid=open(filename,'w') 488 fid.write(self.latest_file_with_signal) 489 fid.close() 490 491 def onButtonCompare(self): 492 print "Compare "+ self.latest_file_with_signal 493 filename=FILE_COMPARE 494 fid=open(filename,'a') 495 fid.write(self.latest_file_with_signal) 496 fid.write("\n") 497 fid.close() 498 499 def onButtonClearCompare(self): 500 print "Clear Compare " 501 filename=FILE_COMPARE 502 fid=open(filename,'w') 503 fid.write("\n") 504 fid.close() 505 506 469 507 470 508 #---------------- -
CLIO/control/backup_data.sh
r745 r748 2 2 3 3 cd /var/www/html/CLIO/ 4 gzip -9 201*/*.txt 5 rm 201*/*.done 4 gzip -9 201*/*.txt & 5 rm 201*/*.done & 6 6 7 rsync -rv --append --exclude datajuly/ --exclude processed/ --exclude 20170???/--exclude new/ /var/www/html/CLIO/ delerue@lx3.lal.in2p3.fr:/sps/sera/delerue/smith-purcell/CLIO/7 rsync -rv --append --exclude datajuly/ --exclude processed/ --exclude '20170???/' --exclude '*/*.txt' --exclude new/ /var/www/html/CLIO/ delerue@lx3.lal.in2p3.fr:/sps/sera/delerue/smith-purcell/CLIO/ -
CLIO/control/clio_constants.py
r744 r748 13 13 global FILE_STOP 14 14 global FILE_PAUSE 15 global FILE_REF 16 global FILE_COMPARE 15 17 global data_directory 16 18 global data_dir … … 49 51 data_directory_base="/var/www/html/CLIO/" 50 52 FILE_ACQ_INFO=basedir+'acquisition_data/acquisition_info.txt' 53 FILE_REF=basedir+'acquisition_data/reference.txt'; 54 FILE_COMPARE=basedir+'acquisition_data/compare.txt'; 51 55 # data_dir="/home/etalon-admin/acquisition_data" 52 56 … … 96 100 97 101 data_dir=data_directory 102 103 def grating_pitch_mm(date): 104 return 6 105 -
CLIO/control/compare_spectrums_from_list.py
r691 r748 9 9 10 10 import glob 11 import math 11 12 import os 12 13 import numpy as np … … 17 18 from clio_constants import * 18 19 20 #Definitions 21 nchannels=32 22 23 19 24 filemask="data_CLIO*.sig" 20 25 list_of_files = [] 26 list_of_names = [] 21 27 22 ilist=3 28 ilist=1 29 23 30 24 31 if (ilist==1): 25 #list at position 3M 26 comment='Comparison at 3M steps' 27 list_of_files.append('data_CLIO_2017-04-13_15-40-58.sig') 28 list_of_files.append('data_CLIO_2017-04-13_15-41-00.sig') 29 list_of_files.append('data_CLIO_2017-04-13_15-41-02.sig') 30 list_of_files.append('data_CLIO_2017-04-13_15-51-58.sig') 31 list_of_files.append('data_CLIO_2017-04-13_15-51-59.sig') 32 list_of_files.append('data_CLIO_2017-04-13_17-05-43.sig') 33 list_of_files.append('data_CLIO_2017-04-13_17-05-47.sig') 34 list_of_files.append('data_CLIO_2017-04-13_17-24-04.sig') 35 list_of_files.append('data_CLIO_2017-04-13_17-24-06.sig') 36 list_of_files.append('data_CLIO_2017-04-13_17-49-43.sig') 37 list_of_files.append('data_CLIO_2017-04-13_17-49-46.sig') 38 list_of_files.append('data_CLIO_2017-04-13_17-49-48.sig') 39 list_of_files.append('data_CLIO_2017-04-13_18-18-32.sig') 40 list_of_files.append('data_CLIO_2017-04-13_18-18-33.sig') 41 list_of_files.append('data_CLIO_2017-04-13_18-18-35.sig') 42 list_of_files.append('data_CLIO_2017-04-13_18-41-19.sig') 43 list_of_files.append('data_CLIO_2017-04-13_18-41-20.sig') 44 list_of_files.append('data_CLIO_2017-04-13_18-41-24.sig') 45 list_of_files.append('data_CLIO_2017-04-13_19-03-49.sig') 46 list_of_files.append('data_CLIO_2017-04-13_19-03-57.sig') 47 list_of_files.append('data_CLIO_2017-04-13_19-04-03.sig') 48 list_of_files.append('data_CLIO_2017-04-13_19-27-25.sig') 49 list_of_files.append('data_CLIO_2017-04-13_19-27-31.sig') 50 list_of_files.append('data_CLIO_2017-04-13_19-27-39.sig') 51 list_of_files.append('data_CLIO_2017-04-13_19-48-55.sig') 52 list_of_files.append('data_CLIO_2017-04-13_19-57-48.sig') 32 data_directory=data_directory+'../20171031/' 33 comment='Change of current' 34 list_of_files.append('data_CLIO_2017-10-31_15-18-49.sig') 35 list_of_names.append('940mV') 36 list_of_files.append('data_CLIO_2017-10-31_15-19-37.sig') 37 list_of_names.append('940mV') 38 list_of_files.append('data_CLIO_2017-10-31_15-22-58.sig') 39 list_of_names.append('910mV') 40 list_of_files.append('data_CLIO_2017-10-31_15-23-28.sig') 41 list_of_names.append('910mV') 42 list_of_files.append('data_CLIO_2017-10-31_15-26-10.sig') 43 list_of_names.append('750mV') 44 list_of_files.append('data_CLIO_2017-10-31_15-27-17.sig') 45 list_of_names.append('750mV') 46 list_of_files.append('data_CLIO_2017-10-31_15-29-38.sig') 47 list_of_names.append('992mV (fin)') 48 list_of_files.append('data_CLIO_2017-10-31_15-30-06.sig') 49 list_of_names.append('992mV (fin)') 53 50 elif (ilist==2): 54 51 comment='Comparison at 5M steps' 55 52 list_of_files.append('data_CLIO_2017-04-13_17-20-05.sig') 56 53 list_of_files.append('data_CLIO_2017-04-13_17-20-07.sig') 57 list_of_files.append('data_CLIO_2017-04-13_17-20-08.sig')58 list_of_files.append('data_CLIO_2017-04-13_17-20-10.sig')59 list_of_files.append('data_CLIO_2017-04-13_17-20-12.sig')60 list_of_files.append('data_CLIO_2017-04-13_17-20-13.sig')61 list_of_files.append('data_CLIO_2017-04-13_17-20-15.sig')62 list_of_files.append('data_CLIO_2017-04-13_17-20-17.sig')63 list_of_files.append('data_CLIO_2017-04-13_17-20-20.sig')64 list_of_files.append('data_CLIO_2017-04-13_17-20-21.sig')65 list_of_files.append('data_CLIO_2017-04-13_17-45-37.sig')66 list_of_files.append('data_CLIO_2017-04-13_17-45-40.sig')67 list_of_files.append('data_CLIO_2017-04-13_17-45-43.sig')68 list_of_files.append('data_CLIO_2017-04-13_17-45-45.sig')69 list_of_files.append('data_CLIO_2017-04-13_17-45-47.sig')70 list_of_files.append('data_CLIO_2017-04-13_17-45-48.sig')71 list_of_files.append('data_CLIO_2017-04-13_17-45-50.sig')72 list_of_files.append('data_CLIO_2017-04-13_17-45-52.sig')73 list_of_files.append('data_CLIO_2017-04-13_17-45-53.sig')74 list_of_files.append('data_CLIO_2017-04-13_17-45-55.sig')75 list_of_files.append('data_CLIO_2017-04-13_18-14-12.sig')76 list_of_files.append('data_CLIO_2017-04-13_18-14-13.sig')77 list_of_files.append('data_CLIO_2017-04-13_18-14-15.sig')78 list_of_files.append('data_CLIO_2017-04-13_18-14-17.sig')79 list_of_files.append('data_CLIO_2017-04-13_18-14-20.sig')80 list_of_files.append('data_CLIO_2017-04-13_18-14-23.sig')81 list_of_files.append('data_CLIO_2017-04-13_18-14-25.sig')82 list_of_files.append('data_CLIO_2017-04-13_18-14-27.sig')83 list_of_files.append('data_CLIO_2017-04-13_18-14-30.sig')84 list_of_files.append('data_CLIO_2017-04-13_18-36-59.sig')85 list_of_files.append('data_CLIO_2017-04-13_18-37-01.sig')86 list_of_files.append('data_CLIO_2017-04-13_18-37-03.sig')87 list_of_files.append('data_CLIO_2017-04-13_18-37-08.sig')88 list_of_files.append('data_CLIO_2017-04-13_18-37-14.sig')89 list_of_files.append('data_CLIO_2017-04-13_18-59-02.sig')90 list_of_files.append('data_CLIO_2017-04-13_18-59-05.sig')91 list_of_files.append('data_CLIO_2017-04-13_18-59-06.sig')92 list_of_files.append('data_CLIO_2017-04-13_18-59-08.sig')93 list_of_files.append('data_CLIO_2017-04-13_18-59-10.sig')94 list_of_files.append('data_CLIO_2017-04-13_18-59-13.sig')95 list_of_files.append('data_CLIO_2017-04-13_18-59-15.sig')96 list_of_files.append('data_CLIO_2017-04-13_19-23-07.sig')97 list_of_files.append('data_CLIO_2017-04-13_19-23-08.sig')98 list_of_files.append('data_CLIO_2017-04-13_19-23-10.sig')99 list_of_files.append('data_CLIO_2017-04-13_19-23-11.sig')100 list_of_files.append('data_CLIO_2017-04-13_19-23-16.sig')101 list_of_files.append('data_CLIO_2017-04-13_19-23-18.sig')102 list_of_files.append('data_CLIO_2017-04-13_19-23-20.sig')103 list_of_files.append('data_CLIO_2017-04-13_19-44-33.sig')104 list_of_files.append('data_CLIO_2017-04-13_19-44-36.sig')105 list_of_files.append('data_CLIO_2017-04-13_19-44-44.sig')106 list_of_files.append('data_CLIO_2017-04-13_19-44-47.sig')107 list_of_files.append('data_CLIO_2017-04-13_20-12-36.sig')108 list_of_files.append('data_CLIO_2017-04-13_20-12-38.sig')109 list_of_files.append('data_CLIO_2017-04-13_20-12-41.sig')110 list_of_files.append('data_CLIO_2017-04-13_20-12-44.sig')111 list_of_files.append('data_CLIO_2017-04-13_20-12-47.sig')112 elif (ilist==3):113 comment='Comparison at 5.4M steps'114 list_of_files.append('data_CLIO_2017-04-13_17-22-31.sig')115 list_of_files.append('data_CLIO_2017-04-13_17-22-33.sig')116 list_of_files.append('data_CLIO_2017-04-13_17-22-35.sig')117 list_of_files.append('data_CLIO_2017-04-13_17-22-36.sig')118 list_of_files.append('data_CLIO_2017-04-13_17-22-39.sig')119 list_of_files.append('data_CLIO_2017-04-13_17-22-41.sig')120 list_of_files.append('data_CLIO_2017-04-13_17-22-43.sig')121 list_of_files.append('data_CLIO_2017-04-13_17-22-44.sig')122 list_of_files.append('data_CLIO_2017-04-13_17-22-46.sig')123 list_of_files.append('data_CLIO_2017-04-13_17-48-05.sig')124 list_of_files.append('data_CLIO_2017-04-13_17-48-07.sig')125 list_of_files.append('data_CLIO_2017-04-13_17-48-09.sig')126 list_of_files.append('data_CLIO_2017-04-13_17-48-10.sig')127 list_of_files.append('data_CLIO_2017-04-13_17-48-12.sig')128 list_of_files.append('data_CLIO_2017-04-13_17-48-15.sig')129 list_of_files.append('data_CLIO_2017-04-13_17-48-19.sig')130 list_of_files.append('data_CLIO_2017-04-13_18-16-37.sig')131 list_of_files.append('data_CLIO_2017-04-13_18-16-39.sig')132 list_of_files.append('data_CLIO_2017-04-13_18-16-41.sig')133 list_of_files.append('data_CLIO_2017-04-13_18-16-44.sig')134 list_of_files.append('data_CLIO_2017-04-13_18-16-45.sig')135 list_of_files.append('data_CLIO_2017-04-13_18-16-47.sig')136 list_of_files.append('data_CLIO_2017-04-13_18-16-49.sig')137 list_of_files.append('data_CLIO_2017-04-13_18-16-50.sig')138 list_of_files.append('data_CLIO_2017-04-13_18-16-52.sig')139 list_of_files.append('data_CLIO_2017-04-13_18-16-54.sig')140 list_of_files.append('data_CLIO_2017-04-13_18-16-55.sig')141 list_of_files.append('data_CLIO_2017-04-13_18-39-21.sig')142 list_of_files.append('data_CLIO_2017-04-13_18-39-29.sig')143 list_of_files.append('data_CLIO_2017-04-13_18-39-33.sig')144 list_of_files.append('data_CLIO_2017-04-13_18-39-37.sig')145 list_of_files.append('data_CLIO_2017-04-13_19-01-30.sig')146 list_of_files.append('data_CLIO_2017-04-13_19-01-32.sig')147 list_of_files.append('data_CLIO_2017-04-13_19-01-40.sig')148 list_of_files.append('data_CLIO_2017-04-13_19-25-40.sig')149 list_of_files.append('data_CLIO_2017-04-13_19-25-43.sig')150 list_of_files.append('data_CLIO_2017-04-13_19-25-47.sig')151 list_of_files.append('data_CLIO_2017-04-13_19-25-48.sig')152 list_of_files.append('data_CLIO_2017-04-13_19-47-12.sig')153 list_of_files.append('data_CLIO_2017-04-13_20-15-05.sig')154 list_of_files.append('data_CLIO_2017-04-13_20-15-08.sig')155 list_of_files.append('data_CLIO_2017-04-13_20-15-11.sig')156 54 157 55 … … 162 60 for filename in list_of_files: 163 61 print os.path.basename(filename) 164 filedata=np.loadtxt(data_directory+filename) 165 filedata[:,1]=filedata[:,1]*-1 166 62 #read parameters 167 63 key_values={} 168 with open(data_directory+filename .replace(".sig",".val"),'r') as fid:64 with open(data_directory+filename,'r') as fid: 169 65 fileline=fid.readline() 170 while (len(fileline)>0) :171 entries=fileline.replace(' ','').replace('\n','').split('=')66 while (len(fileline)>0)and(fileline[0]=='#'): 67 entries=fileline.replace('#','').replace(' ','').replace('\n','').split('=') 172 68 key_values[entries[0]]=entries[1] 173 69 fileline=fid.readline() 174 fid.close() 175 176 if (nfiles==0): 177 alldata=np.array([filedata[:,1]]) 178 current_values_list=[key_values['current_value']] 179 motor_values_list=[key_values['motor_value']] 180 angles=filedata[:,0] 181 filenames=[filename] 70 fid.close() 71 72 filedata=np.loadtxt(data_directory+filename, dtype='float', comments='#', delimiter='\t') 73 print filedata 74 print repr(filedata) 75 76 if (nfiles==0): 77 alldata=np.array([filedata[:,1]]) 78 current_values_list=[key_values['current_value']] 79 motor_values_list=[key_values['motor_value']] 80 angles=filedata[:,0] 81 filenames=[filename] 82 else: 83 if len(filedata)!=alldata.shape[1]: 84 print "Incorrect data size in "+filename 85 nfiles-=1 86 elif not((angles==filedata[:,0]).all()): 87 print "Incorrect angles in "+filename 88 nfiles-=1 182 89 else: 183 if len(filedata)!=alldata.shape[1]: 184 print "Incorrect data size in "+filename 185 nfiles-=1 186 elif not((angles==filedata[:,0]).all()): 187 print "Incorrect angles in "+filename 188 nfiles-=1 189 else: 190 alldata=np.append(alldata,[filedata[:,1]],axis=0) 191 current_values_list.append(key_values['current_value']) 192 motor_values_list.append(key_values['motor_value']) 193 filenames.append(filename) 194 nfiles+=1 195 90 alldata=np.append(alldata,[filedata[:,1]],axis=0) 91 current_values_list.append(key_values['current_value']) 92 motor_values_list.append(key_values['motor_value']) 93 filenames.append(filename) 94 nfiles+=1 95 196 96 197 97 #prepare the figures 198 98 #we do not need the loops but we keep them for now 199 fig=plt.figure(1,figsize=( 12, 8))99 fig=plt.figure(1,figsize=(8,6),dpi=100) 200 100 plt.figure(1) 201 101 ax=plt.subplot(111) 102 103 fig.subplots_adjust(bottom=0.2) 104 202 105 plt.ylabel('Signal amplitude [V]') 203 106 plt.xlabel('Angles [degrees]') … … 207 110 #print len(alldata[range(0,nfiles),1]) 208 111 for idata in range(0,len(list_of_files)): 209 plt.plot(angles,alldata[idata,:],'*-',label=(filenames[idata]).replace("data_CLIO_","").replace(".sig","")) 112 if len(list_of_names)>0: 113 labeltxt=list_of_names[idata] 114 else: 115 labeltxt=(filenames[idata]).replace("data_CLIO_","").replace("2017-10-31_15-","").replace(".sig","") 116 plt.plot(angles,alldata[idata,:],'*-',label=labeltxt) 117 plt.title('Compare files --- '+comment) 118 119 (angle_min,angle_max)=ax.get_xlim() 210 120 211 121 box=ax.get_position() 212 122 ax.set_position([box.x0,box.y0,box.width*0.8,box.height]) 123 ax2=ax.twiny() 124 ax2.set_position([box.x0,box.y0*0.5,box.width*0.8,box.height]) 213 125 ax.legend(loc='center left',fancybox=True,shadow=True,bbox_to_anchor=(1,0.5)) 214 plt.title('Compare files --- '+comment) 126 127 #creating second bottom axis 128 def tick_function(X,angle_min,angle_max): 129 #X is an array 130 V=[ float(grating_pitch_mm('20171031'))*(1-math.cos((angle_min+z*(angle_max-angle_min))*math.pi/180.)) for z in X] 131 return ["%.1f" % z for z in V] 132 133 new_tick_locations= np.array([0.,.25,.5,.75,1.]) 134 135 ax2.xaxis.set_ticks_position("bottom") 136 ax2.xaxis.set_label_position("bottom") 137 #ax2.spines["bottom"].set_position(("axes",-0.15)) 138 139 ax2.set_frame_on(True) 140 ax2.patch.set_visible(False) 141 142 for sp in ax2.spines.itervalues(): 143 sp.set_visible(False) 144 ax2.spines["bottom"].set_visible(True) 145 146 ax2.set_xticks(new_tick_locations) 147 ax2.set_xticklabels(tick_function(new_tick_locations,angle_min,angle_max)) 148 ax2.set_xlabel(r"Wavelength [mm]") 149 215 150 imagename=data_directory+"compare_"+str(ilist)+".png" 216 151 fig.savefig(imagename) -
CLIO/control/popup_example.py
r746 r748 40 40 class Application(ttk.Frame): 41 41 42 def retrieve_input(self): 43 print "hello" 44 inputValue=self.button_value.get("1.0","end-1c") 45 print inputValue 46 42 47 def __init__(self, master): 43 48 ttk.Frame.__init__(self, master) … … 59 64 self.button_lsshell.pack() 60 65 66 self.button_rti = ttk.Button(self, text ="Ret.", command = self.retrieve_input) 67 self.button_rti.pack() 68 69 self.button_value = tk.Text(self, height=1, width=5) 70 self.button_value.pack() 71 72 self.button_ok = ttk.Button(self, text ="OK", command = lambda: self.retrieve_input()) 73 self.button_ok.pack() 74 75 61 76 62 77 root = tk.Tk() -
CLIO/control/read_plot_data.py
r744 r748 14 14 from scipy.fftpack import fft, ifft 15 15 from scipy import signal 16 from clio_constants import * 16 17 17 18 def read_plot_data(filename): … … 68 69 idx_angles_sorted.append(data_mapping.index(angle)) 69 70 idx_data_mapping[data_mapping.index(angle)]=int(len(angles_sorted)) 71 70 72 #Check if the filename contains the path or not 71 73 if (len(os.path.dirname(filename))==0): … … 159 161 move(filename,target_filename) 160 162 161 #print Sig_mean, Sig_std163 print Sig_mean, Sig_std 162 164 163 165 … … 205 207 imagename_no_path=os.path.basename(imagename) 206 208 207 208 fid=open(target_directory+'list.html','a');209 fid.write("<A HREF=")210 fid.write(imagename_no_path)211 fid.write("><IMG SRC=")212 fid.write(imagename_no_path)213 fid.write(" width=600>")214 fid.write("</A><BR/>")215 fid.write(imagename_no_path)216 fid.write("<BR/><BR/>\n")217 fid.close()218 copyfile(imagename,os.path.dirname(imagename)+'/last.png')209 ## We no longer create an HTML list 210 # fid=open(target_directory+'list.html','a'); 211 # fid.write("<A HREF=") 212 # fid.write(imagename_no_path) 213 # fid.write("><IMG SRC=") 214 # fid.write(imagename_no_path) 215 # fid.write(" width=600>") 216 # fid.write("</A><BR/>") 217 # fid.write(imagename_no_path) 218 # fid.write("<BR/><BR/>\n") 219 # fid.close() 220 # copyfile(imagename,os.path.dirname(imagename)+'/last.png') 219 221 220 222 if (electrons_found): … … 227 229 figzoom.savefig(imagenamezoom) 228 230 plt.close(figzoom) 229 copyfile(imagenamezoom,os.path.dirname(imagename)+'/last_zoom.png')231 # copyfile(imagenamezoom,os.path.dirname(imagename)+'/last_zoom.png') 230 232 231 233 imagenamezoom_no_path=os.path.basename(imagenamezoom) 232 fid=open('zoom_list.html','a'); 233 fid.write("<A HREF=") 234 fid.write(imagenamezoom_no_path) 235 fid.write("><IMG SRC=") 236 fid.write(imagenamezoom_no_path) 237 fid.write(" width=600>") 238 fid.write("</A><BR/>") 239 fid.write(imagenamezoom_no_path) 240 fid.write("<BR/><BR/>\n") 241 fid.close() 242 234 235 ## We no longer create an HTML list 236 # fid=open('zoom_list.html','a'); 237 # fid.write("<A HREF=") 238 # fid.write(imagenamezoom_no_path) 239 # fid.write("><IMG SRC=") 240 # fid.write(imagenamezoom_no_path) 241 # fid.write(" width=600>") 242 # fid.write("</A><BR/>") 243 # fid.write(imagenamezoom_no_path) 244 # fid.write("<BR/><BR/>\n") 245 # fid.close() 246 247 243 248 plt.figure(3) 244 plt.plot(range(48,132,7), Sig_mean,'r^-') 249 plt.plot(angles_sorted, Sig_mean,'r^-',label='Data') 250 refdata=load_reference_signal() 251 if (len(refdata)>0): 252 # print refdata[:,0] 253 # print refdata[:,1] 254 plt.plot(refdata[:,0],refdata[:,1],'go:',label='Reference') 245 255 plt.title(key_values['date']+ ' --- Motor value: '+key_values['motor_value']+ ' --- Current: '+key_values['current_value']) 246 256 plt.ylabel('Signal amplitude [a.u.]') 247 257 plt.xlabel('Detector angle [deg.]') 248 plt.grid(True) 258 plt.grid(True) 259 plt.legend() 249 260 imagenamesignal=target_filename.replace('.txt','_signal.png') 250 261 figsignal.savefig(imagenamesignal) 251 262 plt.close(figsignal) 252 copyfile(imagenamesignal,os.path.dirname(imagename)+'/last_signal.png') 263 264 if (len(refdata)>0): 265 figref=plt.figure(4,figsize=figure_size,dpi=figure_dpi) 266 plt.figure(4) 267 diffdata=np.zeros((len(angles_sorted),2)) 268 for angle in angles_sorted: 269 idx=angles_sorted.index(angle) 270 idxref=np.where(refdata == angle) 271 diffdata[idx,0]=angle 272 diffdata[idx,1]=Sig_mean[idx]-refdata[idxref[0],1] 273 #print diffdata 274 plt.plot(diffdata[:,0], diffdata[:,1],'r^-') 275 plt.title('Diff --- ' +key_values['date']+ ' --- Motor value: '+key_values['motor_value']+ ' --- Current: '+key_values['current_value']) 276 plt.ylabel('Signal amplitude above reference [a.u.]') 277 plt.xlabel('Detector angle [deg.]') 278 plt.grid(True) 279 imagenamesignal=target_filename.replace('.txt','_amplitude.png') 280 figref.savefig(imagenamesignal) 281 plt.close(figref) 282 283 284 285 # copyfile(imagenamesignal,os.path.dirname(imagename)+'/last_signal.png') 253 286 254 287 imagenamesignal_no_path=os.path.basename(imagenamesignal) 255 fid=open('signal_list.html','a'); 256 fid.write("<A HREF=") 257 fid.write(imagenamesignal_no_path) 258 fid.write("><IMG SRC=") 259 fid.write(imagenamesignal_no_path) 260 fid.write(" width=600>") 261 fid.write("</A><BR/>") 262 fid.write(imagenamesignal_no_path) 263 fid.write("<BR/><BR/>\n") 264 fid.close() 288 289 ## We no longer create an HTML list 290 # fid=open('signal_list.html','a'); 291 # fid.write("<A HREF=") 292 # fid.write(imagenamesignal_no_path) 293 # fid.write("><IMG SRC=") 294 # fid.write(imagenamesignal_no_path) 295 # fid.write(" width=600>") 296 # fid.write("</A><BR/>") 297 # fid.write(imagenamesignal_no_path) 298 # fid.write("<BR/><BR/>\n") 299 # fid.close() 265 300 266 301 filenamesig=target_filename.replace('.txt','.sig') … … 282 317 return; 283 318 319 320 def load_reference_signal(): 321 global FILE_REF 322 323 try: 324 fid=open(FILE_REF) 325 refname=fid.readline().rstrip() 326 fid.close() 327 except: 328 print "Unable to read reference file" 329 refname="" 330 331 if (len(refname)>0): 332 #read refrence parameters 333 ref_key_values={} 334 with open(refname,'r') as fid: 335 fileline=fid.readline() 336 while (len(fileline)>0)and(fileline[0]=='#'): 337 entries=fileline.replace('#','').replace(' ','').replace('\n','').split('=') 338 ref_key_values[entries[0]]=entries[1] 339 fileline=fid.readline() 340 fid.close() 341 342 #for p in ref_key_values: print p,'=', ref_key_values[p] 343 344 allrefdata=np.loadtxt(refname, comments='#', delimiter='\t', usecols=range(0,3)) 345 # print allrefdata 346 return allrefdata -
CLIO/control/run_all.sh
r744 r748 23 23 24 24 if [ -eq `ps -edf | grep run_makefile_recent | grep -cv grep ` 0 ]; 25 echo "To start the files process type /home/etalon-admin/control/run_makefile_recent.sh "25 echo "To start the files processing type /home/etalon-admin/control/run_makefile_recent.sh " 26 26 exit -1 27 27 fi … … 35 35 36 36 37 echo "To backup the data type control/backup_data.sh " -
CLIO/control/run_read_data.py
r638 r748 1 1 from read_plot_data import read_plot_data 2 2 import sys 3 3 import subprocess 4 import os 4 5 #print 'Number of arguments:', len(sys.argv), 'arguments.' 5 6 #print 'Argument List:', str(sys.argv) 6 read_plot_data(sys.argv[1]) 7 filename=sys.argv[1] 8 fname,fext=os.path.splitext(filename) 9 if (fext==".gz"): 10 print "Gzipped file" 11 gzipok=0 12 try: 13 response=subprocess.check_output("gzip -d "+filename,shell=True) 14 gzipok=1 15 except: 16 print "gzip -d failed" 17 gzipok=0 18 if (gzipok==1): 19 read_plot_data(fname) 20 try: 21 response=subprocess.check_output("gzip -9 "+fname,shell=True) 22 except: 23 print "gzip -9 failed" 24 if (fext==".txt"): 25 read_plot_data(filename)
Note: See TracChangeset
for help on using the changeset viewer.