Changeset 13400 for fact/tools/pyscripts/sandbox/kraehenb/CalFitsTest.py
- Timestamp:
- 04/20/12 14:41:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/pyscripts/sandbox/kraehenb/CalFitsTest.py
r13397 r13400 1 #!/usr/bin/python -tt 2 # ******************************** 3 # Test script for the CalFits class 4 # 5 # written by Thomas Kraehenbuehl, ETH Zurich 6 # tpk@phys.ethz.ch, +41 44 633 3973 7 # April 2012 8 # ******************************** 9 1 10 datafilename = '/fact/raw/2012/04/17/20120417_004.fits.gz' 2 11 calibfilename = '/fact/raw/2012/04/17/20120417_003.drs.fits.gz' 3 #data_filename = '/fact/raw/2012/01/31/20120131_018.fits.gz'4 #calib_filename = '/fact/raw/2012/01/31/20120131_014.drs.fits.gz'5 12 6 DoCalFits=True 13 from ROOT import gSystem 14 gSystem.Load("calfits_h.so") 15 from ROOT import * 16 print "Testing object creation: " 17 caltest = CalFits(datafilename,calibfilename) 7 18 8 if DoCalFits: 9 from ROOT import gSystem 10 gSystem.Load("CalFits_h.so") 11 from ROOT import * 12 print "Testing object creation: " 13 caltest = CalFits(datafilename,calibfilename) 14 print "Testing the python access to the function: " 15 print caltest.data_npix 19 print "Common variables:" 20 print "ROI: ", caltest.nroi 21 print "#Pix: ", caltest.npix 22 print "Number of events: ", caltest.nevents 23 print 16 24 17 print "Calibfile ROI: ", caltest.calib_nroi 18 print "BaselineMean: ", caltest.calibfile.GetN("BaselineMean") 19 print "GainMean: ", caltest.calibfile.GetN("GainMean") 20 print "TriggerOffsetMean: ", caltest.calibfile.GetN("TriggerOffsetMean") 21 print "Datafile ROI: ", caltest.data_nroi 22 print "Data: ", caltest.datafile.GetN("Data") 23 print "StartCellData: ", caltest.datafile.GetN("StartCellData") 24 print "Direct datafile access: ", caltest.datafile.GetN("StartCellData") 25 print "Information per Event:" 26 caltest.GetCalEvent() 27 print "Event ID: ", caltest.event_id 28 print "Trigger type: ", caltest.event_triggertype 29 print "Uncalibrated data: ", caltest.event_data 30 print "Calibrated data: ", caltest.event_caldata 31 print "Board times: ", caltest.event_boardtimes 32 print "Trigger offsets: ", caltest.event_offset 33 print 25 34 26 # print caltest.GetCalEvent() 27 for i in range(1000): 28 caltest.GetCalEvent() 29 print caltest.data_eventid 30 print 35 print "Examples of other information" 36 print "Calibfile ROI: ", caltest.calib_nroi 37 print "Column size BaselineMean: ", caltest.calibfile.GetN("BaselineMean") 38 print "Datafile ROI: ", caltest.data_nroi 39 print "Data: ", caltest.datafile.GetN("Data") 40 print "StartCellData: ", caltest.datafile.GetN("StartCellData") 41 print "Direct datafile access: ", caltest.datafile.GetN("StartCellData") 42 print 43 print "Columns of the datafile: " 44 caltest.datafile.PrintColumns() 31 45 32 del caltest 46 while caltest.GetCalEvent(): 47 print caltest.event_id, caltest.event_triggertype, caltest.event_caldata[0] 48 print 33 49 34 else: 35 from pyfact import RawData 36 pyfacttest = RawData(datafilename, calibfilename, return_dict = True) 37 for i,event in enumerate(pyfacttest): 38 if i>0: 39 break 40 print event['acal_data'][0][0:5] 50 del caltest
Note:
See TracChangeset
for help on using the changeset viewer.