1 | #!/usr/bin/python -tt
|
---|
2 | #
|
---|
3 | # Werner Lustermann
|
---|
4 | # ETH Zurich
|
---|
5 | #
|
---|
6 | import numpy as np
|
---|
7 | from pyfact import RawData
|
---|
8 | from plotter import Plotter
|
---|
9 | from drs_spikes import DRSSpikes
|
---|
10 |
|
---|
11 | import matplotlib.pyplot as plt
|
---|
12 |
|
---|
13 | ch = 0
|
---|
14 | def drs_calib(acal_data, raw_data, blm, tom, gm, scells, nroi):
|
---|
15 | """ call back function for RawData class """
|
---|
16 |
|
---|
17 | blm_pixel = np.roll( blm[ch,:], -scells[ch] )
|
---|
18 | tom_pixel = np.roll( tom[ch,:], -scells[ch] )
|
---|
19 | gm_pixel = np.roll( gm[ch,:], -scells[ch] )
|
---|
20 |
|
---|
21 | print 'nroi: ', nroi
|
---|
22 | print 'start: ', scells[ch]
|
---|
23 | print 'blm: ', blm[ch,0:20]
|
---|
24 | print 'blm: ', blm_pixel[0:20]
|
---|
25 | print 'tom: ', tom_pixel[0:20]
|
---|
26 | print 'gm: ', gm_pixel[0:10]
|
---|
27 | print 'raw_data:', raw_data[ch,0:20]
|
---|
28 | raw_data_mV = raw_data[ch,0:20] * 2000./4096.
|
---|
29 | print 'raw_data mV:', raw_data_mV
|
---|
30 | raw_data_blm = raw_data_mV - blm_pixel[0:20] - tom_pixel[0:20]
|
---|
31 | print 'raw_data mV - blm:', raw_data_blm
|
---|
32 | raw_data_gm = raw_data_blm / gm_pixel[0:20]
|
---|
33 | print 'raw_data_gm:', raw_data_gm * 1907.35
|
---|
34 | print 'acal_data: ', acal_data[ch,0:20]
|
---|
35 |
|
---|
36 | raw_data_plot(raw_data[ch,:])
|
---|
37 | acal_data_plot(acal_data[ch,:])
|
---|
38 |
|
---|
39 |
|
---|
40 | path = '/home/luster/win7/FACT/data/raw/20120114/'
|
---|
41 | data_file_name = path + '20120114_024.fits.gz'
|
---|
42 | calib_file_name = path + '20120114_022.drs.fits.gz'
|
---|
43 | path = '/home/luster/win7/FACT/data/raw/20111124/'
|
---|
44 | data_file_name = path + '20111124_117.fits.gz'
|
---|
45 | calib_file_name = path + '20111124_114.drs.fits.gz'
|
---|
46 |
|
---|
47 | run = RawData( data_file_name, calib_file_name , user_action_calib = drs_calib)
|
---|
48 |
|
---|
49 | x = np.linspace(0., run.nroi, run.nroi)
|
---|
50 |
|
---|
51 | raw_data_plot = Plotter('raw_data', x, 'g.',
|
---|
52 | xlabel='slice in logical pipeline', ylabel='amplitude in mV')
|
---|
53 | acal_data_plot = Plotter('cal_data', x, 'r.', xlabel='slice in logical pipeline', ylabel='amplitude in mV')
|
---|
54 |
|
---|
55 |
|
---|
56 |
|
---|
57 | plt.ion() # turn interactive mode on (plots are done immediately)
|
---|
58 |
|
---|
59 | ch = 0
|
---|
60 |
|
---|
61 | inp = ''
|
---|
62 | data, scell, tt = run.next()
|
---|
63 | #print data[ch,0:10]
|
---|
64 |
|
---|
65 | while ( inp != 'q' ):
|
---|
66 |
|
---|
67 | inp = raw_input('[n|p|q]: ')
|
---|
68 |
|
---|
69 | if inp == 'n':
|
---|
70 | ch = (ch + 1)%1440
|
---|
71 | elif inp == 'p':
|
---|
72 | ch = (ch + 1)%1440
|
---|
73 | print ch
|
---|
74 | elif inp == 'q':
|
---|
75 | pass
|
---|
76 | else:
|
---|
77 | data, scell, tt = run.next()
|
---|
78 |
|
---|