From 0b56ded50cdb37ff0f69daba43d96cd12425405e Mon Sep 17 00:00:00 2001 From: Thomas Fitoussi Date: Wed, 26 Aug 2015 14:38:56 +0200 Subject: [PATCH] take into account source angle of emission => selection for a cone emission rather than isotropic --- Analysis.py | 79 +++++++++++++++++++++++++++++++++++++++---------------------------------------- Modules/Map.py | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------- Modules/Map.pyc | Bin 4925 -> 0 bytes Modules/Spectrum.py | 35 +++++++++++++++++++++++------------ Modules/Spectrum.pyc | Bin 3395 -> 0 bytes 5 files changed, 118 insertions(+), 92 deletions(-) diff --git a/Analysis.py b/Analysis.py index fb90c7f..3abd2e3 100755 --- a/Analysis.py +++ b/Analysis.py @@ -5,7 +5,7 @@ from numpy import append, savetxt, shape, array, newaxis, zeros, arange from Modules.Read import ReadEnergy, ReadTime, ReadExtraFile, ReadProfile from Modules.Read import ReadMomentumAngle, ReadPositionAngle, resultDirectory from Modules.Spectrum import spectrum -from Modules.Map import computeMap, isotrop +from Modules.Map import computeMap from Modules.Angle import angle_vs_energy from Modules.Timing import timing from Modules.Constants import degre @@ -19,6 +19,7 @@ if shape(argv)[0] < 2: #=============================================================================# PowerSpectrum=[1,1.5,2,2.5] +Jet_Opening=[180,30,60] # degre (180 <=> isotrop) for fileId in argv[1:]: print "#=============================================================================#" @@ -28,14 +29,14 @@ for fileId in argv[1:]: print "# 1. Reading data" time = ReadTime(fileId) energy = ReadEnergy(fileId) - weightini, generation, theta_arrival, Esource = ReadExtraFile(fileId,[2,3,4,5]) + weightini, generation, theta_arrival, Esource, dir_source = ReadExtraFile(fileId,[2,3,4,5,6]) nbPhotonsEmitted=ReadProfile(fileId,[3]) + weightini /= nbPhotonsEmitted Gen_contrib = [] Gen_cont = zeros((int(max(generation))+1)) Source = [] Spectrum = [] - Angle_Energy = [] Timing = [] print "# 2. Computing powerlaw spectrum" @@ -61,7 +62,7 @@ for fileId in argv[1:]: nbBins = 50 # draw source spectrum Es=array(list(set(Esource))) - Ws= (Es/min(Es))**(1-powerlaw_index) + Ws= (Es/min(Es))**(1-powerlaw_index) /nbPhotonsEmitted Es,Fs = spectrum(Es,Ws,nbBins=nbBins) Es=Es[:,newaxis] Fs=Fs[:,newaxis] @@ -102,44 +103,42 @@ for fileId in argv[1:]: #=============================================================================# # IMAGING, RADIAL DISTRIBUTION AND ANGLE VERSUS ENERGY #=============================================================================# - print "# 3. compute images and radial distribution" - powerlaw_index = 2 - Elim = 1e-1 # GeV - thetalim = 20 # degre - nbBins = 100 + Angle_Energy = [] Radial = [] + print "# 3. compute images and radial distribution" + for jet_opening_angle in Jet_Opening: + powerlaw_index = 2 + Elim = 1e-1 # GeV + thetalim = 20 # degre + nbBins = 100 + + thetaDir,phiDir = ReadMomentumAngle(fileId)*degre + thetaPos,phiPos = ReadPositionAngle(fileId)*degre + theta = thetaDir - thetaPos + phi = phiDir -phiPos + + # apply source spectrum + weight_source = (Esource/min(Esource))**(1-powerlaw_index) + weight = weightini* weight_source + + # apply selection + theta2,dndtheta2,ener,angle = computeMap(theta,phi,weight,energy,dir_source,fileId, + jet_opening_angle,Elim,nbBins,borne=[thetalim,thetalim]) + theta2=theta2[:,newaxis] + dndtheta2=dndtheta2[:,newaxis] + ener=ener[:,newaxis] + angle=angle[:,newaxis] + + if Radial==[]: + Radial = theta2 + Radial = append(Radial,dndtheta2,axis=1) + Angle_Energy = ener + Angle_Energy = append(Angle_Energy,angle,axis=1) + else: + Radial = append(Radial,dndtheta2,axis=1) + Angle_Energy = append(Angle_Energy,angle,axis=1) - thetaDir,phiDir = ReadMomentumAngle(fileId)*degre - thetaPos,phiPos = ReadPositionAngle(fileId)*degre - theta = thetaDir - thetaPos - phi = phiDir -phiPos - - # apply source spectrum - weight_source = (Esource/min(Esource))**(1-powerlaw_index) - weight = weightini* weight_source - - # apply selection - cond=(energy>Elim) #& (abs(theta)Elim) #& (abs(theta)