Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:21:47

0001 #!/usr/bin/env python
0002 # Python program explaining  
0003 # load() function  
0004   
0005 import numpy as geek 
0006 import matplotlib.pyplot as plt 
0007   
0008 b = geek.load('hits.npy') 
0009   
0010 print("size of b is:",b.size)
0011 print("shape of b is:",b.shape)
0012 print("ndim of b is:",b.ndim)
0013 print(b)
0014 print(b[0,0,0])
0015 print(b[0,3,0])
0016 print("b is printed from hits.npy")
0017 x = b[:,0,0]
0018 y = b[:,0,1]
0019 z = b[:,0,2]
0020 lamb = b[:,2,3]
0021 print(x.shape)
0022 print(y.shape)
0023 print(lamb.shape)
0024 
0025 #axs = plt.subplots(2, 2, figsize=(5, 5))
0026 plt.subplot(131)
0027 plt.ylabel('#Photons')
0028 plt.xlabel('x-position/mm')
0029 plt.hist(x,50,(-200,200.))
0030 plt.subplot(132)
0031 plt.xlabel('x-position/mm')
0032 plt.ylabel('y-position/mm')
0033 plt.scatter(x, y)
0034 plt.subplot(133)
0035 plt.xlabel('lambda/nm')
0036 plt.ylabel('#Photons')
0037 plt.hist(lamb,50,(50,800.))
0038 #plt.hist(z)
0039 plt.show()