source: fact/tools/pyscripts/examples/for_patrick.py@ 15063

Last change on this file since 15063 was 13300, checked in by neise, 13 years ago
example ...
  • Property svn:executable set to *
File size: 1.3 KB
Line 
1#!/usr/bin/python -tt
2#
3# Example
4# * looping over RawData class object
5#
6
7from pyfact import RawData
8from plotters import Plotter
9from drs_spikes import DRSSpikes
10
11
12#define filenames
13data_filename = 'data/20120223_210.fits.gz'
14calib_filename = 'data/20120223_206.drs.fits.gz'
15
16#make a RawData object
17run = RawData(data_filename, calib_filename, return_dict = True)
18
19#make a Plotter class ... this is an easy way for plotting ... but there are
20# many was to plot data ... without this class ... it was written for convenience, but there is no strong reason to use it...
21myplotter = Plotter('titel of the plot', xlabel='time in slices', ylabel='amplitude calibrated data ... in mV')
22
23# make a DRSSpike object ... this object is
24#DRS_spike_remover = DRSSpikes()
25
26
27for event in run:
28 print 'event id:', event['event_id']
29 print 'trigger type', int(event['trigger_type'].value)
30 data = event['acal_data']
31
32
33
34 #if you like to have also the DRS spikes removed ... do:
35 #data = DRS_spike_remover( data )
36
37 myplotter( data[23] , 'pixel 23' )
38
39 #if you like to skip the first 12slices and the last 12slices this can be done like this
40 #myplotter( data[23, 12:-12] , 'pixel 23 skiped first 12 and last 12 slices :-)' )
41
42 answer = raw_input('hit <Enter> to go on .... hit "q" to quit')
43 if 'q' in answer:
44 break
Note: See TracBrowser for help on using the repository browser.