Changeset 17802 for fact/tools
- Timestamp:
- 05/07/14 20:20:51 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/new_pyfact/pyfact.py
r17801 r17802 5 5 # 6 6 import os 7 import sys 7 8 import ctypes 8 9 from ctypes import * … … 13 14 import ROOT 14 15 hostname = ROOT.gSystem.HostName() 15 if 'isdc' in hostname: 16 ROOT.gSystem.Load("/usr/lib64/libz.so") 17 elif ('neiseLenovo' in hostname or 'factcontrol' in hostname): 18 ROOT.gSystem.Load("/usr/lib/libz.so") 19 elif ("max-K50AB" in hostname or "watz" in hostname): 20 ROOT.gSystem.Load("/usr/lib/x86_64-linux-gnu/libz.so") 21 elif ("grolsch" in hostname): 22 ROOT.gSystem.Load("/usr/lib/i386-linux-gnu/libz.so") 23 else: 24 print "Error,Warning,Whatever libz stuff makes me crazy." 16 17 libz_path_dict = { 18 # hostname : /path/to/libz.so 19 'isdc' : "/usr/lib64/libz.so", 20 'neiseLenovo' : "/usr/lib/libz.so", 21 'factcontrol' : "/usr/lib/libz.so", 22 "max-K50AB" : "/usr/lib/x86_64-linux-gnu/libz.so", 23 "watz" : "/usr/lib/x86_64-linux-gnu/libz.so", 24 "grolsch" : "/usr/lib/i386-linux-gnu/libz.so", 25 } 26 libz_loaded = False 27 for my_hostname in libz_path_dict: 28 if my_hostname in hostname: 29 ROOT.gSystem.Load(libz_path_dict[my_hostname]) 30 libz_loaded = True 31 if not libz_loaded: 32 print """Warning - Warning - Warning - Warning - Warning - Warning - Warning 33 I most probably need to load libz.so but I don't know where it is. 34 35 Please edit pyfact.py around line 16-24 and insert your hostname and your 36 path to your libz.so 37 Sorry for the inconvenience. 38 """ 39 sys.exit(-1) 40 25 41 26 42 root_make_string = ROOT.gSystem.GetMakeSharedLib() … … 174 190 if __name__ == '__main__': 175 191 """ tests """ 176 import sys 177 if len(sys.argv) == 2: 178 print "Example for aux-file or uncalibrated raw-file" 179 f = Fits(sys.argv[1]) 180 elif len(sys.argv) == 3: 181 print "Example for calibrated raw-file" 182 f = RawData(sys.argv[1], sys.argv[2]) 183 else: 184 f = None 185 192 if len(sys.argv) < 3: 193 print """ Usage: 194 ---------------------------------------------------------------------- 195 To just build the shared object libs call: 196 python pyfact.py 197 198 To build (if necessary) and open an example file 199 python -i pyfact.py /path/to/data_file.zfits /path/to/calib_file.drs.fits.gz 200 201 Any of the 3 file 'types': fits.gz zfits fits 202 should be supported. 203 204 To clean all of automatically built files, do something like: 205 rm *.so *.d AutoDict_* extern_Mars_mcore/*.so extern_Mars_mcore/*.d 206 ---------------------------------------------------------------------- 207 """ 208 sys.exit(1) 209 print "Example for calibrated raw-file" 210 f = RawData(sys.argv[1], sys.argv[2]) 211 186 212 print "number of events:", f.header['NAXIS2'] 187 213 print "date of observation:", f.header['DATE'] … … 204 230 print "Event Id:", f.cols['EventNum'] 205 231 206 i f len(sys.argv) == 3:207 import matplotlib.pyplot as plt208 plt.ion()209 for i in range(f.header['NPIX']):210 plt.cla()211 212 213 214 215 216 232 import matplotlib.pyplot as plt 233 plt.ion() 234 for i in range(f.header['NPIX']): 235 plt.cla() 236 plt.title("Event %d"%(f.cols['EventNum'])) 237 plt.plot(f.cols['CalibData2D'][i], '.:', label='pixel %d'%i) 238 plt.legend() 239 answer = raw_input('anykey for next pixel; "q" to quit. :') 240 if 'q' in answer.lower(): 241 break 242
Note:
See TracChangeset
for help on using the changeset viewer.