1 | #!/usr/bin/python
|
---|
2 | #
|
---|
3 | # Dominik Neise
|
---|
4 | # TU Dortmund
|
---|
5 | #
|
---|
6 | # test for freshly implemented methods in pyfact.
|
---|
7 | # subject to frequent change!
|
---|
8 |
|
---|
9 | from pyfact import *
|
---|
10 | #from savecam import *
|
---|
11 |
|
---|
12 |
|
---|
13 | dfname = '/data00/fact-construction/raw/2011/11/24/20111124_081.fits.gz'
|
---|
14 | outfname = '20111124_081.npz'
|
---|
15 | calfname = '/data00/fact-construction/raw/2011/11/24/20111124_071.drs.fits.gz'
|
---|
16 |
|
---|
17 | # access the data
|
---|
18 | rd = rawdata( dfname, calfname )
|
---|
19 |
|
---|
20 | print 'dfname: ', dfname
|
---|
21 | print 'calfname:', calfname
|
---|
22 | print 'NEvents: ', rd.NEvents
|
---|
23 |
|
---|
24 | def loop_acal( Neve = 1000 ):
|
---|
25 | """
|
---|
26 | bla
|
---|
27 | """
|
---|
28 | if rd.NEvents < Neve:
|
---|
29 | print 'data file contains not enough events'
|
---|
30 | exit( 0 )
|
---|
31 | else:
|
---|
32 | for i in range( Neve ):
|
---|
33 | if (np.mod(i,100)==0) :
|
---|
34 | print 'Event: ', i
|
---|
35 | rd.next()
|
---|
36 |
|
---|
37 | rd.filterSlidingAverage()
|
---|
38 | # print rd.smoothData
|
---|
39 | rd.filterCFD()
|
---|
40 | # print rd.cfdData
|
---|
41 | rd.findPeak()
|
---|
42 | list_maxPos.append(rd.maxPos)
|
---|
43 | list_maxAmp.append(rd.maxAmp)
|
---|
44 | rd.sumAroundPeak()
|
---|
45 | list_integral.append(rd.integral)
|
---|
46 | # plotincam(rd.integral, 'evt_'+str(i)+'.pdf')
|
---|
47 | #print len(rd.maxPos)
|
---|
48 | #print len(rd.maxAmp)
|
---|
49 | # print 'Trigger Type', rd.trigType
|
---|
50 |
|
---|
51 | #print (rd.filterSlidingAverage.__doc__)
|
---|
52 | #print (rd.filterCFD.__doc__)
|
---|
53 | #print (rd.findPeak.__doc__)
|
---|
54 | #print (rd.sumAroundPeak.__doc__)
|
---|
55 |
|
---|
56 | list_maxPos = []
|
---|
57 | list_maxAmp = []
|
---|
58 | list_integral = []
|
---|
59 | loop_acal(rd.NEvents)
|
---|
60 | maxAmp = np.vstack(list_maxAmp)
|
---|
61 | maxPos = np.vstack(list_maxPos)
|
---|
62 | integ = np.vstack(list_integral)
|
---|
63 |
|
---|
64 | np.savez(outfname, amplitude=maxAmp, time=maxPos, integral=integ)
|
---|