source: fact/tools/pyscripts/tools/plot4.py@ 18066

Last change on this file since 18066 was 13145, checked in by neise, 13 years ago
exchanged pyfact_rename by pyfact and enabled tab checking. removed some tabs as well
  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#!/usr/bin/python -tt
2#
3# Werner Lustermann
4# ETH Zurich
5#
6import numpy as np
7from pyfact import RawData
8from plotter import Plotter
9from drs_spikes import DRSSpikes
10
11import matplotlib.pyplot as plt
12
13ch = 0
14def 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
40path = '/home/luster/win7/FACT/data/raw/20120114/'
41data_file_name = path + '20120114_024.fits.gz'
42calib_file_name = path + '20120114_022.drs.fits.gz'
43path = '/home/luster/win7/FACT/data/raw/20111124/'
44data_file_name = path + '20111124_117.fits.gz'
45calib_file_name = path + '20111124_114.drs.fits.gz'
46
47run = RawData( data_file_name, calib_file_name , user_action_calib = drs_calib)
48
49x = np.linspace(0., run.nroi, run.nroi)
50
51raw_data_plot = Plotter('raw_data', x, 'g.',
52 xlabel='slice in logical pipeline', ylabel='amplitude in mV')
53acal_data_plot = Plotter('cal_data', x, 'r.', xlabel='slice in logical pipeline', ylabel='amplitude in mV')
54
55
56
57plt.ion() # turn interactive mode on (plots are done immediately)
58
59ch = 0
60
61inp = ''
62data, scell, tt = run.next()
63#print data[ch,0:10]
64
65while ( 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
Note: See TracBrowser for help on using the repository browser.