PARSEC Logo of the RWTH University

Last modification: 8 Apr 2014

Particle horizon

In this example the particle horizon is calculated from the parametrizations in PARSEC. The particle horizon is here the maximum distance a particle can originate from. The script can be found in the PARSEC code under ./examples/horizon.py .

Example image horizon
#30.08.11 , Tobias Winchen
#PARSEC example - Calculates the particle horizon 

import parsec

def plotFullHorizon(fieldStrength, spectralIndex, maximumSourceEnrgy, fmt):
  ''' Plots the horizon up to which sources contribute to the UHECR
  flux'''
  #Define Model
  att =parsec.AttenuationLengthData_Berezinsky2006()
  cel = parsec.ContinuousEnergyLoss(att)
  rwl = parsec.RandomWalkPropagation(cel,fieldStrength)
  sourceModel = parsec.PowerLawSourceModel(cel, rwl, spectralIndex,
      maximumSourceEnrgy)

  energy = 10**linspace(18,21, 100)
  horizon = zeros(len(energy))
  for i,e in enumerate(energy):
    horizon[i] = sourceModel.getParticleHorizon(e/1E18, 0.01)

  plot(energy,horizon, fmt, label = "B = %.1f nG" %(fieldStrength))


figure()
loglog()
plotFullHorizon(0, -2.7, 1000, 'k')
plotFullHorizon(1, -2.7, 1000, 'b')
plotFullHorizon(10, -2.7, 1000, 'r')
xlabel('Energy [eV]')
ylabel('Horizon [Mpc]')
legend(frameon=False)