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 |
|
---|
10 | datafilename = '/fact/raw/2012/04/17/20120417_004.fits.gz'
|
---|
11 | calibfilename = '/fact/raw/2012/04/17/20120417_003.drs.fits.gz'
|
---|
12 |
|
---|
13 | import numpy as np
|
---|
14 |
|
---|
15 | from ROOT import gSystem
|
---|
16 | gSystem.Load("calfits_h.so")
|
---|
17 | from ROOT import *
|
---|
18 | print "Testing object creation: "
|
---|
19 | caltest = CalFits(datafilename,calibfilename)
|
---|
20 | npcalevent = np.empty( caltest.npix * caltest.nroi, np.float64) #.reshape(caltest.npix ,caltest.nroi)
|
---|
21 | caltest.SetNpcaldataPtr(npcalevent)
|
---|
22 |
|
---|
23 | print "Common variables:"
|
---|
24 | print "ROI: ", caltest.nroi
|
---|
25 | print "#Pix: ", caltest.npix
|
---|
26 | print "Number of events: ", caltest.nevents
|
---|
27 | print
|
---|
28 |
|
---|
29 | print "Information per Event:"
|
---|
30 | caltest.GetCalEvent()
|
---|
31 | print "Calibrated data in numpy array: ", npcalevent
|
---|
32 | print "Event ID: ", caltest.event_id
|
---|
33 | print "Trigger type: ", caltest.event_triggertype
|
---|
34 | print "Uncalibrated data: ", caltest.event_data
|
---|
35 | print "Calibrated data: ", caltest.npcaldata
|
---|
36 | print "Board times: ", caltest.event_boardtimes
|
---|
37 | print "Trigger offsets: ", caltest.event_offset
|
---|
38 | print
|
---|
39 |
|
---|
40 | print "Examples of other information"
|
---|
41 | print "Calibfile ROI: ", caltest.calib_nroi
|
---|
42 | print "Column size BaselineMean: ", caltest.calibfile.GetN("BaselineMean")
|
---|
43 | print "Datafile ROI: ", caltest.data_nroi
|
---|
44 | print "Data: ", caltest.datafile.GetN("Data")
|
---|
45 | print "StartCellData: ", caltest.datafile.GetN("StartCellData")
|
---|
46 | print "Direct datafile access: ", caltest.datafile.GetN("StartCellData")
|
---|
47 | print
|
---|
48 | print "Columns of the datafile: "
|
---|
49 | caltest.datafile.PrintColumns()
|
---|
50 |
|
---|
51 | #while caltest.GetCalEvent():
|
---|
52 | # if caltest.event_id>10:
|
---|
53 | # break
|
---|
54 | # print caltest.event_id, caltest.event_triggertype, caltest.event_caldata[10]
|
---|
55 | # pass
|
---|
56 | #print
|
---|
57 |
|
---|
58 | del caltest
|
---|