source: fact/tools/pyscripts/produce_npz.py@ 12970

Last change on this file since 12970 was 12870, checked in by neise, 13 years ago
changed layout ... needs testing
File size: 1.6 KB
Line 
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
9from pyfact import *
10#from savecam import *
11
12
13dfname = '/data00/fact-construction/raw/2011/11/24/20111124_081.fits.gz'
14outfname = '20111124_081.npz'
15calfname = '/data00/fact-construction/raw/2011/11/24/20111124_071.drs.fits.gz'
16
17# access the data
18rd = rawdata( dfname, calfname )
19
20print 'dfname: ', dfname
21print 'calfname:', calfname
22print 'NEvents: ', rd.NEvents
23
24def 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
56list_maxPos = []
57list_maxAmp = []
58list_integral = []
59loop_acal(rd.NEvents)
60maxAmp = np.vstack(list_maxAmp)
61maxPos = np.vstack(list_maxPos)
62integ = np.vstack(list_integral)
63
64np.savez(outfname, amplitude=maxAmp, time=maxPos, integral=integ)
Note: See TracBrowser for help on using the repository browser.