source: fact/tools/pyscripts/examples/hillas_test.py@ 13188

Last change on this file since 13188 was 13177, checked in by neise, 13 years ago
initial commit of a script using the pyafact/image_extractors ...
  • Property svn:executable set to *
File size: 1.5 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 plotters import CamPlotter
10
11from drs_spikes import DRSSpikes
12from fir_filter import SlidingAverage
13from extractor import GlobalMaxFinder
14from cleaners import AmplitudeCleaner
15from image_extractors import HillasParameter
16from image_extractors import SimpleArea
17from image_extractors import SimpleSize
18import sys
19
20data_filename = 'data/20120223_210.fits.gz'
21calib_filename = 'data/20120223_206.drs.fits.gz'
22
23run = RawData(data_filename, calib_filename, return_dict = True)
24despike = DRSSpikes()
25sa = SlidingAverage(8)
26gmf = GlobalMaxFinder(30,230)
27clean = AmplitudeCleaner(45,18)
28clean.return_bool_mask = False
29hillas = HillasParameter()
30
31p = CamPlotter('cleaned')
32#p2 = CamPlotter('not')
33
34
35for event in run:
36 if event['trigger_type'].value == 4:
37 #if True:
38 print event['event_id']
39 data = event['acal_data']
40 unspiked_data = despike(data)
41 data = sa(data)
42 amp, time = gmf(data)
43 survivors, num_islands = clean(amp)
44 #if num_islands == 1 and len(survivors) < 10:
45 if True:
46 print 'num_islands', num_islands
47 print 'calling HillasParameter'
48 hillas(survivors, amp)
49
50
51 p ( amp, survivors )
52 #p2 (amp)
53
54 #sys.exit(0)
55
56 answer = raw_input('hit <Enter> to go on .... hit "q" to quit')
57 if 'q' in answer:
58 break
59print 'good bye'
Note: See TracBrowser for help on using the repository browser.