source: fact/tools/pyscripts/sandbox/dneise/trigger_studies/ftu_patch_signal.py@ 18729

Last change on this file since 18729 was 13146, checked in by neise, 13 years ago
enabled tab checking and excahnged python_rename with python
  • Property svn:executable set to *
File size: 2.7 KB
Line 
1#!/usr/bin/python -tt
2#
3# Dominik Neise
4#
5from pyfact import RawData
6from fir_filter import *
7from extractor import *
8from drs_spikes import *
9from plotters import *
10import os.path
11import matplotlib.pyplot as plt
12import numpy as np
13import sys
14
15data_file_name = '/media/daten_platte/FACT/data/20120305_022.fits.gz'
16calib_file_name = '/media/daten_platte/FACT/data/20120305_005.drs.fits.gz'
17if not os.path.isfile(data_file_name):
18 print 'not able to find file:', data_file_name
19 sys.exit(-1)
20if not os.path.isfile(calib_file_name ):
21 print 'not able to find file:', calib_file_name
22 sys.exit(-1)
23
24run = RawData(data_file_name, calib_file_name)
25despike = DRSSpikes()
26
27plot_all = Plotter('-to-be-changed-', style ='.:', ylabel='mV', xlabel='slices')
28plot = Plotter('-to-be-changed-', style ='.:', ylabel='FTU DAC counts', xlabel='slices')
29
30# according to Ulf Roeser, the clipping cable is about 5ns long and damps reflection by about 0.9
31clipping = CFD( length=20, ratio=0.9)
32
33
34
35# add up 9 pixels
36for data, scell, tt in run:
37 data = despike(data)
38 print 'this script is just plotting ... no further output or analysis is done'
39 print 'to end it ... Ctrl-C and then hit <Enter> so python'
40 for begin in range(0,data.shape[0],9):
41 print 'plotting pixels:', begin, 'to', begin+8
42
43 patch_sig = np.sum(data[begin:begin+9,:],axis=0)
44
45 # scaling signal as it should be in front of the comparator
46 # factors are according to poster of Olli
47 # EPS_HEP-Electronics.pdf ... I did not check the numbers again
48 # factor between DRS and U1A
49 patch_sig /=-2
50 # from U1A to comparator
51 patch_sig *= 1./5.4 * 4.5 * -1. * 0.5 * 4.5 * 0.9
52
53 # in order to understand the FTU treschold a little better
54 # I scale the voltages to FTU DAC counts: 12bits @ 2.5Volts
55 patch_sig *= 1./2500 * 2**12
56 #now clipping is applied.
57 pre_clip = patch_sig
58 patch_sig = -1*clipping(patch_sig)
59 plot.name = 'sum of pixels:' + str(begin) +'..' + str(begin+8) + ' as seen on FTU'
60 plot ( (pre_clip,patch_sig) , ('pre_clip','comparator in') )
61 plt.legend()
62
63
64
65 # plotting
66 labels=[]
67 for i in range(9):
68 labels.append('pix_'+str(i))
69 #labels.append('patch')
70 #to_plot = np.vstack( (data[begin:begin+9,:],patch_sig) )
71 to_plot = data[begin:begin+9,:]
72 plot_all.name = 'pixels:' + str(begin) +'..' + str(begin+8)
73 plot_all( to_plot , labels)
74 plt.legend()
75
76 user_input = raw_input("'q' for quit, anything else goes on")
77 if user_input.find('q') != -1:
78 sys.exit(0)
79
Note: See TracBrowser for help on using the repository browser.