source: fact/tools/pyscripts/examples/plotcam.py@ 12852

Last change on this file since 12852 was 12851, checked in by neise, 15 years ago
methods to plot trivial data like amplitudes in camera plane
File size: 1.5 KB
Line 
1import matplotlib.pyplot as plt
2import numpy as np
3import numpy.ma as ma
4
5def plotcam():
6 chid, y,x,xe,ye,yh,xh,softid,hardid = np.loadtxt("map_dn.txt",unpack=True)
7 fig = plt.figure()
8 ax = fig.add_subplot(111, aspect='equal')
9 H = (6,0,30./180.*3.1415926)
10 ax.scatter(xe,ye,s=40,alpha=0.75,marker=H, linewidths=0.)
11 plt.show()
12
13def plotincam( data ):
14 chid, y,x,xe,ye,yh,xh,softid,hardid = np.loadtxt("map_dn.txt",unpack=True)
15 fig = plt.figure()
16 ax = fig.add_subplot(111, aspect='equal')
17 H = (6,0,30./180.*3.1415926)
18 ax.scatter(xe,ye,s=40,alpha=0.75,marker=H, c=data)
19 plt.show()
20
21def plotmaskedcam( thr):
22 chid, y,x,xe,ye,yh,xh,softid,hardid = np.loadtxt("map_dn.txt",unpack=True)
23 data = np.random.rand(1440)
24 mdata = ma.masked_greater(data, thr)
25 fig = plt.figure()
26 ax = fig.add_subplot(111, aspect='equal')
27 H = (6,0,30./180.*3.1415926)
28
29 a = ma.masked_where(mdata.mask == True, xe)
30 b = ma.masked_where(mdata.mask == True, ye)
31
32 xm = a.compressed()
33 ym = b.compressed()
34 dm = mdata.compressed()
35
36 print xm
37 print ym
38 print dm
39 ax.scatter(xe,ye,s=80,alpha=0.75,marker=H, c=data, edgecolors='none')
40 ax.scatter( xm, ym ,s=80,alpha=1,marker=H,facecolors='none',linewidths=3)
41 plt.show()
42
43
44def randomcam():
45 data = np.random.rand(1440)
46 plotincam( data )
47
48
49# uncomment what ever you like to test.
50
51# plotcam() #plot an empty cam ..
52# randomcam() # plot a cam filled with random data
53
54 fun = np.linspace(0,1,1440)
55 plotincam( fun )
56
57#plotmaskedcam( 0.15 )
58
Note: See TracBrowser for help on using the repository browser.