from numpy import loadtxt resultDirectory="Results/" positionFile="/position" momentumFile="/momentum" extraFile="/extra" profileFile="/profile" ElmagFile="/Elmag_spectrum" def ReadTime(fileName): return loadtxt(resultDirectory+fileName+positionFile,unpack=True,usecols=[0]) def ReadPosition(fileName): return loadtxt(resultDirectory+fileName+positionFile,unpack=True,usecols=[1,2,3]) def ReadPositionAngle(fileName): return loadtxt(resultDirectory+fileName+positionFile,unpack=True,usecols=[4,5]) def ReadEnergy(fileName): return loadtxt(resultDirectory+fileName+momentumFile,unpack=True,usecols=[0]) def ReadMomentum(fileName): return loadtxt(resultDirectory+fileName+momentumFile,unpack=True,usecols=[1,2,3]) def ReadMomentumAngle(fileName): return loadtxt(resultDirectory+fileName+momentumFile,unpack=True,usecols=[4,5]) def ReadCharge(fileName): return loadtxt(resultDirectory+fileName+extraFile,unpack=True,usecols=[0]) def ReadRedshift(fileName): return loadtxt(resultDirectory+fileName+extraFile,unpack=True,usecols=[1]) def ReadWeight(fileName): return loadtxt(resultDirectory+fileName+extraFile,unpack=True,usecols=[2]) def ReadGeneration(fileName): return loadtxt(resultDirectory+fileName+extraFile,unpack=True,usecols=[3]) def ReadElmag(fileName): Elmag=resultDirectory+fileName+ElmagFile energy,fluxGamma,fluxLepton = loadtxt(Elmag,unpack=True,usecols=[0,1,2]) energy *= 10**(-9) #GeV flux=(fluxGamma+fluxLepton)*1e-9 #GeV normalized to 1 initial photon return energy,flux def ReadE_source(fileName): # Emax (GeV), redshift, distance (Mpc), Nb photons return loadtxt(resultDirectory+fileName+profileFile,unpack=True,usecols=[0]) def Readz_source(fileName): # redshift return loadtxt(resultDirectory+fileName+profileFile,unpack=True,usecols=[1]) def ReadD_source(fileName): # distance (Mpc) return loadtxt(resultDirectory+fileName+profileFile,unpack=True,usecols=[2]) def ReadNphot_source(fileName): # Nb photons emitted return loadtxt(resultDirectory+fileName+profileFile,unpack=True,usecols=[3]) def ReadEGMF(fileName): return loadtxt(resultDirectory+fileName+profileFile,unpack=True,usecols=[4]) def ReadNbLeptonsProd(fileName): return loadtxt(resultDirectory+fileName+profileFile,unpack=True,usecols=[5])