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 "Event ID: ", caltest.event_id
|
---|
32 | print "Trigger type: ", caltest.event_triggertype
|
---|
33 | print "Uncalibrated data: ", caltest.event_data
|
---|
34 | print "Calibrated data: ", caltest.event_caldata
|
---|
35 | print "Board times: ", caltest.event_boardtimes
|
---|
36 | print "Trigger offsets: ", caltest.event_offset
|
---|
37 | print
|
---|
38 |
|
---|
39 | print "Examples of other information"
|
---|
40 | print "Calibfile ROI: ", caltest.calib_nroi
|
---|
41 | print "Column size BaselineMean: ", caltest.calibfile.GetN("BaselineMean")
|
---|
42 | print "Datafile ROI: ", caltest.data_nroi
|
---|
43 | print "Data: ", caltest.datafile.GetN("Data")
|
---|
44 | print "StartCellData: ", caltest.datafile.GetN("StartCellData")
|
---|
45 | print "Direct datafile access: ", caltest.datafile.GetN("StartCellData")
|
---|
46 | print
|
---|
47 | print "Columns of the datafile: "
|
---|
48 | caltest.datafile.PrintColumns()
|
---|
49 |
|
---|
50 | #while caltest.GetCalEvent():
|
---|
51 | # if caltest.event_id>10:
|
---|
52 | # break
|
---|
53 | # print caltest.event_id, caltest.event_triggertype, caltest.event_caldata[10]
|
---|
54 | #print
|
---|
55 |
|
---|
56 | del caltest
|
---|