1 | #!/usr/bin/python -tt
|
---|
2 | #
|
---|
3 | # Example
|
---|
4 | # * looping over RawData class object
|
---|
5 | #
|
---|
6 |
|
---|
7 | from pyfact import RawData
|
---|
8 | from plotters import Plotter
|
---|
9 | from plotters import CamPlotter
|
---|
10 |
|
---|
11 | from drs_spikes import DRSSpikes
|
---|
12 | from fir_filter import SlidingAverage
|
---|
13 | from extractor import GlobalMaxFinder
|
---|
14 | from cleaners import AmplitudeCleaner
|
---|
15 | from image_extractors import HillasParameter
|
---|
16 | from image_extractors import SimpleArea
|
---|
17 | from image_extractors import SimpleSize
|
---|
18 | import sys
|
---|
19 |
|
---|
20 | data_filename = 'data/20120223_210.fits.gz'
|
---|
21 | calib_filename = 'data/20120223_206.drs.fits.gz'
|
---|
22 |
|
---|
23 | run = RawData(data_filename, calib_filename, return_dict = True)
|
---|
24 | despike = DRSSpikes()
|
---|
25 | sa = SlidingAverage(8)
|
---|
26 | gmf = GlobalMaxFinder(30,230)
|
---|
27 | clean = AmplitudeCleaner(45,18)
|
---|
28 | clean.return_bool_mask = False
|
---|
29 | hillas = HillasParameter()
|
---|
30 |
|
---|
31 | p = CamPlotter('cleaned')
|
---|
32 | #p2 = CamPlotter('not')
|
---|
33 |
|
---|
34 |
|
---|
35 | for 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
|
---|
59 | print 'good bye' |
---|