Simulations based on theoretical models of EAS lateral distributions

Lateral distribution functions that can be used for simulating particle densities and for fitting to data.

Example usage:

>>> import tables

>>> from sapphire import NkgLdfSimulation, ScienceParkCluster

>>> data = tables.open_file('/tmp/test_ldf_simulation.h5', 'w')
>>> cluster = ScienceParkCluster()

>>> sim = NkgLdfSimulation(max_core_distance=400, min_energy=1e15,
...                        max_energy=1e21, cluster=cluster,
...                        datafile=data, n=200)
>>> sim.run()
class sapphire.simulations.ldf.BaseLdfSimulation(max_core_distance, min_energy, max_energy, *args, **kwargs)

Simulation initialization

Parameters:
  • max_core_distance – maximum distance of shower core to center of cluster (in meters).
  • min_energy,max_energy – Minimum and maximum energy of the shower (in eV).
generate_shower_parameters()

Generate shower parameters, i.e. core position

For the simple LDF only the core position is relevant. It assumes the shower to come from the Zenith.

Returns:dictionary with shower parameters: core_pos (x, y-tuple).
simulate_detector_response(detector, shower_parameters)

Simulate detector response to a shower

Get the mips in a detector from the LDF.

Parameters:
  • detectorDetector for which the observables will be determined.
  • shower_parameters – dictionary with the shower parameters.
get_num_particles_in_detector(detector, shower_parameters)

Get the number of particles in a detector

Parameters:
  • detectorDetector for which the number of particles will be determined.
  • shower_parameters – dictionary with the shower parameters.
static simulate_particles_for_density(p)

Get number of particles in detector given a particle density

Parameters:p – particle density in number per detector area.
Returns:random number from Poisson distribution.
class sapphire.simulations.ldf.BaseLdfSimulationWithoutErrors(max_core_distance, min_energy, max_energy, *args, **kwargs)

This simulation does not simulate errors/uncertainties

This should result in perfect particle counting for the detectors.

Simulation initialization

Parameters:
  • max_core_distance – maximum distance of shower core to center of cluster (in meters).
  • min_energy,max_energy – Minimum and maximum energy of the shower (in eV).
static simulate_particles_for_density(p)

Exact number

class sapphire.simulations.ldf.NkgLdfSimulation(*args, **kwargs)

Same as the BaseLdfSimulation but uses the NkgLdf as LDF

class sapphire.simulations.ldf.NkgLdfSimulationWithoutErrors(*args, **kwargs)

Same as the NkgLdfSimulation but without error simulation

class sapphire.simulations.ldf.KascadeLdfSimulation(*args, **kwargs)

Same as the BaseLdfSimulation but uses the KascadeLdf as LDF

class sapphire.simulations.ldf.KascadeLdfSimulationWithoutErrors(*args, **kwargs)

Same as the KascadeLdfSimulation but without error simulation

class sapphire.simulations.ldf.EllipsLdfSimulation(*args, **kwargs)

Same as BaseLdfSimulation but uses the EllipsLdF as LDF

generate_shower_parameters()

Generate shower parameters, i.e. core position

For the elliptic LDF both the core position and the zenith angle are relevant.

Returns:dictionary with shower parameters: core_pos (x, y-tuple).
get_num_particles_in_detector(detector, shower_parameters)

Get the number of particles in a detector

Parameters:
  • detectorDetector for which the number of particles will be determined.
  • shower_parameters – dictionary with the shower parameters.
class sapphire.simulations.ldf.BaseLdf

Base LDF class

No particles! Always returns a particle density of 0.

calculate_ldf_value(r, n_electrons=None, s=None)
calculate_core_distance(x, y, x0, y0, theta, phi)

Calculate core distance

The core distance is the distance of the detector to the shower core, measured on the shower front. For derivations, see logbook.

Parameters:
  • x,y – detector position in m.
  • x0,y0 – shower core position in m.
  • theta,phi – shower axis direction in radians.
Returns:

distance from detector to the shower core in shower front plane in m.

class sapphire.simulations.ldf.NkgLdf(n_electrons=None, s=None)

The Nishimura-Kamata-Greisen function

NKG LDF setup

Parameters:
  • n_electrons – Shower size (number of electrons).
  • s – Shower age parameter.
calculate_ldf_value(r, n_electrons=None, s=None)

Calculate the LDF value

Parameters:
  • r – core distance in m.
  • n_electrons – number of electrons in the shower.
  • s – shower age parameter.
Returns:

particle density in m ** -2.

ldf_value(r, n_electrons, s)

Calculate the LDF value

Given a core distance, shower size, and shower age. As given in Fokkema2012 eq 7.2.

Parameters:
  • r – core distance in m.
  • n_electrons – number of electrons in the shower.
  • s – shower age parameter.
Returns:

particle density in m ** -2.

class sapphire.simulations.ldf.KascadeLdf(n_electrons=None, s=None)

The KASCADE modified NKG function

NKG LDF setup

Parameters:
  • n_electrons – Shower size (number of electrons).
  • s – Shower age parameter.
ldf_value(r, n_electrons, s)

Calculate the LDF value

Given a core distance, shower size, and shower age. As given in Fokkema2012 eq 7.4.

Parameters:
  • r – core distance in m.
  • n_electrons – number of electrons in the shower.
  • s – shower shape parameter.
Returns:

particle density in m ** -2.

class sapphire.simulations.ldf.EllipsLdf(n_electrons=None, zenith=None, azimuth=None, s1=None, s2=None)

The NKG function modified for leptons and azimuthal asymmetry

calculate_ldf_value(r, phi, n_electrons=None, zenith=None, azimuth=None)

Calculate the LDF value for a given core distance and polar angle

Parameters:
  • r – core distance in m.
  • phi – polar angle in rad.
  • n_electrons – number of electrons in the shower.
Returns:

particle density in m ** -2.

ldf_value(r, phi, n_electrons, zenith, azimuth, s1, s2)

Calculate the LDF value

Given a core distance, core polar angle, zenith angle, azimuth angle, shower size and three shape parameters (r0, s1, s2) . As given by Montanus, paper to follow.

Warning

The value 11.24 in the expression: muoncorr is only valid for: s1 = -.5, s2 = - 2.6 and r0 = 30.

Parameters:
  • r – core distance in m.
  • phi – polar angle in rad.
  • n_electrons – number of electrons in the shower.
  • zenith – zenith angle in rad.
  • azimuth – azimuth angle in rad.
  • s1 – shower shape parameter.
  • s2 – shower shape parameter.
Returns:

particle density in m ** -2.

calculate_core_distance_and_angle(x, y, x0, y0)

Calculate core distance

The core distance is the distance of the detector to the shower core, measured in the horizontal observation plane.

Parameters:
  • x,y – detector position in m.
  • x0,y0 – shower core position in m.
Returns:

distance and polar angle from detector to the shower core in horizontal observation plane in m resp. rad.