template_synthesis.corsika.generate_file_contents module

template_synthesis.corsika.generate_file_contents.generate_inp_file(sim_nr, sim_zenith, sim_azimuth, sim_energy, primary='proton', direct='./', magnet=(0.0, 18600.0, -45600.0), obs_lev=0.0, slicing=3.1207548722557624e+38, thin=1e-07, n_cores=10, atm=17)

Make an INP file for a CORSIKA run with CoREAS, using MPI.

As CoREAS only supports a single shower per run, the EVTNR and NSHOW are set to 1. The shower zenith, azimuth and energy are fixed to the values provided. For the geometry, the NRR coordinate system is assumed (ie x-axis points east), which means that the provided azimuth is shifted by 90 degrees to convert to the CORSIKA system. The SEED values are randomly generated. For the USER variable, the login name is used (by evaluating os.getlogin()).

Parameters:
sim_nr : int

The value for the RUNNR parameter

sim_zenith : float

The zenith of the shower (THETAP). Currently only using a fixed zenith is supported

sim_azimuth : float

The azimuth of the shower (PHIP + 270 deg). Currently only using a fixed azimuth is supported

sim_energy : float

The fixed energy to use for the simulation

primary : {'proton', 'helium', 'carbon', 'silicon', 'iron'}, default='proton'

Name of the primary, used to identify correct template file

obs_lev : float, default=0.0 * units.m

The observation level to use for the simulation (OBSLEV)

magnet : tuple of float, default=(0.0, 18.6, -45.6) * units.gauss

The components of the 3D magnetic field, provided in the NRR CS and internal units (MAGNET)

direct : str, default='./'

The directory for the particle output (DIRECT)

atm : float, default=17

The CORSIKA identifier for the atmosphere (ATMOD)

n_cores : int, default=10

The number of cores over which the MPI simulation will run

thin : float, default=1e-7

The thinning level to use (THIN)

slicing : float, default=5 * units.g / units.cm2

The thickness of the atmospheric slices, to be used for the longitudinal profile (LONGI)

Returns:

contents – The contents to be written to the INP file

Return type:

list of str

template_synthesis.corsika.generate_file_contents.generate_list_file(sim_zenith, sim_azimuth, slices_gram, magnet_vector=None, number_of_arms=8, core=None, radii=None)

Create a starshape pattern with 8 arms in the shower plane and project it to the ground, along the shower axis. This result in the antennas from the same “circle” to have different viewing angles after being projected to the ground. The antennas are sliced according to the grammages specified, and in the LIST file the receivers are ordered by slice (which proves to be a couple of percent faster than ordering them by position).

Parameters:
sim_zenith : float

The zenith angle of the shower, in the NRR coordinate system

sim_azimuth : float

The azimuth angle of the shower, in the NRR coordinate system

slices_gram : list of float

The grammages of the planes defining the slices, including both the first and last one.

core : list of float, default=[0,0,0] * units.m

The core of the simulated air shower

magnet_vector : array of float, default=[0, 0.186, -0.456] * units.gauss

The magnetic field vector used in the simulation, used to project the antennas from the shower plane to the ground

radii : list of float, default=None

The distances (in the showerplane) from the showeraxis on which to put the antennas If None, a default starshape is used.

number_of_arms : int, default=8

The number of arms to use for the star shape pattern

Returns:

contents – The lines to be written to the LIST file

Return type:

list of str

template_synthesis.corsika.generate_file_contents.generate_list_file_cherenkov(sim_zenith, sim_azimuth, slices_gram, atm, viewing_angle_fractions, number_of_arms=8, magnet_vector=None, core=None)

Create a starshape pattern with 8 arms in the shower plane and project it to the ground, along the viewing angle under which antenna observes the slice. Note that this results in different physical antennas on the ground for every slice! Therefore, this function should not be used to generate list files for origin showers. The antennas are sliced according to the grammages specified, and in the LIST file the receivers are ordered by slice (which proves to be a couple of percent faster than ordering them by position).

Parameters:
sim_zenith : float

The zenith angle of the shower, in the NRR coordinate system

sim_azimuth : float

The azimuth angle of the shower, in the NRR coordinate system

slices_gram : list of float

The grammages of the planes defining the slices, including both the first and last one.

atm : radiotools.atmosphere.models.Atmosphere

The atmosphere model to use to map the antennas to the ground plane

core : list of float, default=[0,0,0] * units.m

The core of the simulated air shower

magnet_vector : array of float, default=[0, 0.186, -0.456] * units.gauss

The magnetic field vector used in the simulation, used to project the antennas from the shower plane to the ground

viewing_angle_fractions : list of float

The viewing angles (expressed as fractions of the local Cherenkov angle) under which to place the antennas.

number_of_arms : int, default=8

The number of arms to use for the star shape pattern

Returns:

contents – The lines to be written to the LIST file

Return type:

list of str

template_synthesis.corsika.generate_file_contents.generate_reas_file(event_number, n=1.000292, time_res=0.2, time_bound=400.0, core=None)

Generate the contents of the REAS file using the set of given input parameters. The contents are based on the CoREAS V1.4 software.

Parameters:
event_number : int

The run number of the simulation

n : float, default=1.000292

The refractive index at sea level (GroundLevelRefractiveIndex)

time_res : float, default=2e-10 * units.s

The time resolution to use for the CoREAS simulation (TimeResolution)

time_bound : float, default=4e-7 * units.s

The time window to use for the CoREAS simulation (used with AutomaticTimeBoundaries)

core : list of float, default=[0,0,0] * units.m

The core of the simulated air shower, in the NRR coordinate system

Returns:

contents – The lines to be written to the REAS file

Return type:

list of str