source: fact/tools/pyscripts/examples/produce_npz.py@ 12867

Last change on this file since 12867 was 12867, checked in by neise, 13 years ago
one can use this script to produce npz files containing amplitude,integral and time of a pulse. this may be used for simple plotting or further studies
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
12name='20111124_081'
13dfname = '/data03/fact-construction/raw/2011/11/24/'+name+'.fits'
14calfname = '/data03/fact-construction/raw/2011/11/24/20111124_071.drs.fits'
15# access the data
16rd = rawdata( dfname, calfname )
17
18print 'dfname: ', dfname
19print 'calfname:', calfname
20print 'NEvents: ', rd.NEvents
21
22def loop_acal( Neve = 1000 ):
23 """
24 bla
25 """
26 if rd.NEvents < Neve:
27 print 'data file contains not enough events'
28 exit( 0 )
29 else:
30 for i in range( Neve ):
31 if (np.mod(i,100)==0) :
32 print 'Event: ', i
33 rd.next()
34
35 rd.filterSlidingAverage()
36# print rd.smoothData
37 rd.filterCFD()
38# print rd.cfdData
39 rd.findPeak()
40 list_maxPos.append(rd.maxPos)
41 list_maxAmp.append(rd.maxAmp)
42 rd.sumAroundPeak()
43 list_integral.append(rd.integral)
44# plotincam(rd.integral, 'evt_'+str(i)+'.pdf')
45 #print len(rd.maxPos)
46 #print len(rd.maxAmp)
47# print 'Trigger Type', rd.trigType
48
49#print (rd.filterSlidingAverage.__doc__)
50#print (rd.filterCFD.__doc__)
51#print (rd.findPeak.__doc__)
52#print (rd.sumAroundPeak.__doc__)
53
54list_maxPos = []
55list_maxAmp = []
56list_integral = []
57loop_acal(rd.NEvents)
58maxAmp = np.vstack(list_maxAmp)
59maxPos = np.vstack(list_maxPos)
60integ = np.vstack(list_integral)
61
62np.savez(name+'.npz', amplitude=maxAmp, time=maxPos, integral=integ)
Note: See TracBrowser for help on using the repository browser.