From a05caa75b3b2b07876b526f4900969820dcc6365 Mon Sep 17 00:00:00 2001 From: Thomas Fitoussi Date: Tue, 7 Apr 2015 18:22:38 +0200 Subject: [PATCH] Add 2d-histogram to arrival direction - count vs theta and phi --- Arrival_direction.py | 91 ++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------- Constantes.py | 3 ++- Constantes.pyc | Bin 2091 -> 0 bytes 3 files changed, 46 insertions(+), 48 deletions(-) diff --git a/Arrival_direction.py b/Arrival_direction.py index b800ad1..b4fd18a 100755 --- a/Arrival_direction.py +++ b/Arrival_direction.py @@ -3,6 +3,7 @@ from sys import argv import numpy as np import matplotlib.pyplot as plt +from matplotlib.colors import LogNorm from mpl_toolkits.mplot3d.axes3d import Axes3D if len(argv)<2: @@ -11,77 +12,73 @@ if len(argv)<2: # figure: position of the arriving particles in space -> size circle = energy #============================================================================= -nbBins = 50 +nbBins = 100 degre= 180/np.pi borne=5 # degree -Elim=1e-6 # GeV +Elim=1e-1 # GeV -fig = plt.figure() +fig1 = plt.figure() +fig2 = plt.figure() nbplots = len(argv)-1 ind = 1 for fileId in argv[1:]: energy,thetaDir,phiDir = np.loadtxt("Results_EGMF"+fileId+"/Results_momentum",unpack=True,usecols=[0,4,5]) thetaPos,phiPos = np.loadtxt("Results_EGMF"+fileId+"/Results_position",unpack=True,usecols=[4,5]) + charge,weight=np.loadtxt("Results_EGMF"+fileId+"/Results_extra",unpack=True,usecols=[0,2]) - plotid = 100+nbplots*10+ind - ax = fig.add_subplot(plotid) - - Energy = energy[energy>Elim] - print "Cut at", Elim, "GeV:", np.shape(Energy) - thetaPos = thetaPos[energy>Elim]*degre - phiPos = phiPos[energy>Elim]*degre - thetaDir = thetaDir[energy>Elim]*degre - phiDir = phiDir[energy>Elim]*degre + thetaPos = thetaPos*degre + phiPos = phiPos*degre + thetaDir = thetaDir*degre + phiDir = phiDir*degre theta = thetaDir - thetaPos phi = phiDir -phiPos - ## random position of the detector - #a=np.random.rand(2,1) - #w=a[0,0]*2.-1. - #u=np.sqrt(1-w*w)*np.cos(2*np.pi*a[1,0]) - #v=np.sqrt(1.-w*w)*np.sin(2.*np.pi*a[1,0]) - ## 2D -> use only u and v - #theta_detector = u*180 #degre - #phi_detector = v*90 #degre + cond=(energy>Elim) & (abs(theta)Elim - # and np.absolute(theta-theta_detector)Elim - # and np.absolute(theta-theta_detector)Elim - # and np.absolute(theta-theta_detector)