smiet.corsika.generate_file_contents module

smiet.corsika.generate_file_contents.generate_inp_file(sim_nr, sim_zenith, sim_azimuth, sim_energy, primary=14, direct='./', magnet=(0.0, 18600.0, -45600.0), obs_lev=0.0, slicing=5, first_height=None, 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 : int, default=14

The CORSIKA identifier for the primary particle type. Default is 14 (proton).

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)

first_height : float or None, default=None

The height of the first interaction, passed into the FIXHEI parameter. If not None, then the units must be in internal units. If None, then this parameter is not set.

direct : str, default='./'

The directory for the particle output (DIRECT)

atm : int or str, default=17

If an integer, the CORSIKA identifier for the atmosphere (used for ATMOD). If a string, the name of the GDAS atmosphere file (used for ATMFILE)

n_cores : int, default=10

The number of cores over which the MPI simulation will run. If n_cores = 1, the PARALLEL option will be disabled and a simulation without MPI will run.

thin : float, default=1e-7

The thinning level to use (THIN)

slicing : float, default=5

The thickness of the atmospheric slices, to be used for the longitudinal profile (LONGI) Defaults to units of g/cm^2.

Returns:

contents – The contents to be written to the INP file

Return type:

list of str

smiet.corsika.generate_file_contents.generate_list_file(sim_zenith, sim_azimuth, slices_gram, magnet_vector=None, number_of_arms=8, core=None, radii=None, rotate: bool = False)

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

rotate : bool, default=False

Whether to rotate the starshape pattern by 22.5 degrees, to avoid alignment of antennas along the vxB axis, which shows to fail with template synthesis.

Returns:

contents – The lines to be written to the LIST file

Return type:

list of str

smiet.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, rotate: bool = False)

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

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

rotate : bool, default=False

Whether to rotate the starshape pattern by 22.5 degrees, to avoid alignment of antennas on the vxB axis.

Returns:

contents – The lines to be written to the LIST file

Return type:

list of str

smiet.corsika.generate_file_contents.generate_list_file_from_positions(ant_positions, slices_gram)

Generate a list file from a known antenna layout from existing simulations.

The function simply adds one observer for every antenna position in ant_positions, for each slice in slices_gram. This can be used to generate list files from simulations that already exist for the sake of generating an origin shower with the same layout.

Parameters:
ant_positions : list of [list of float]

list of antenna positions for each CoREAS observer.

slices_gram : list of float

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

Returns:

contents – The lines to be written to the LIST file

Return type:

list of str

smiet.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