Last change
on this file since 13450 was 13446, checked in by neise, 13 years ago |
plots each pixels darkcount pulse height histogram
|
-
Property svn:executable
set to
*
|
File size:
1.1 KB
|
Line | |
---|
1 | #!/usr/bin/python -tti
|
---|
2 | #
|
---|
3 | #
|
---|
4 |
|
---|
5 | import sys
|
---|
6 | import numpy as np
|
---|
7 | import matplotlib.pyplot as plt
|
---|
8 |
|
---|
9 | if len(sys.argv) > 1:
|
---|
10 | npz_file = np.load(sys.argv[1])
|
---|
11 | else:
|
---|
12 | print 'I need a filename'
|
---|
13 | sys.exit(0)
|
---|
14 |
|
---|
15 | print npz_file.files
|
---|
16 |
|
---|
17 | # sanitiy check for gain npz files
|
---|
18 | #
|
---|
19 | expected_filenames = [
|
---|
20 | 'result_peak_positions',
|
---|
21 | 'result_peak_unfiltered_height',
|
---|
22 | 'result_peak_smoothed_height']
|
---|
23 |
|
---|
24 | abort = False
|
---|
25 | for fn in expected_filenames:
|
---|
26 | if not fn in npz_file.files:
|
---|
27 | print 'coulnd not find', fn, 'in ', sys.argv[1]
|
---|
28 | print 'This is probably no gain-npz-file ...'
|
---|
29 | print 'Aborting...'
|
---|
30 | abort = True
|
---|
31 | if abort:
|
---|
32 | print npz_file.files
|
---|
33 | sys.exit(1)
|
---|
34 |
|
---|
35 | data = npz_file['result_peak_smoothed_height']
|
---|
36 | data = np.nan_to_num(data)
|
---|
37 |
|
---|
38 | plt.ion()
|
---|
39 | fig = plt.figure()
|
---|
40 |
|
---|
41 | for i in range(data.shape[1]): # this is a loop over a pixel
|
---|
42 | plt.cla()
|
---|
43 | plt.grid(True)
|
---|
44 | plt.title('Pixel ' + str(i))
|
---|
45 | plt.xlabel('darc count amplitude mV')
|
---|
46 | plt.ylabel('rate')
|
---|
47 | contents,bins,patches = plt.hist(data[:,i,:].flatten(), range=(0,100), bins=200, align='left', histtype='step')
|
---|
48 | #break
|
---|
49 | raw_input('')
|
---|
Note:
See
TracBrowser
for help on using the repository browser.