template_synthesis.corsika.write_simulation module¶
-
template_synthesis.corsika.write_simulation.generate_simulation(sim_nr, sim_primary, sim_cores, sim_zenith=
None
, sim_azimuth=None
, sim_energy=None
, slice_gram=3.1207548722557624e+38
, magnetic_field='lofar'
, thinning=1e-06
, atmosphere=17
, core=None
, radii=None
, cherenkov=False
)¶ Prepare the contents for the INP, LIST and REAS files for a sliced MPI simulation, with a star shape pattern for the antenna layout.
One can choose to project the antennas along the shower axis or along the viewing angle by setting the cherenkov option. If this is set to True, the radii parameter will be interpreted as a list of viewing angles expressed as multiples of the slice Cherenkov angle. Otherwise, the radii parameter should be the list of radii to use in the star shape (use this option to generate origin showers).
The magnetic field vector can be taken from the radiotools.helper module, by passing a string as the magnetic_field parameter. This variable is passed on to the radiotools.helper.get_magnetic_field_vector function. But to be consistent with the CORSIKA definition where the magnetic field has no East-West component, the vector x-component is set to zero. This ensures the simulated antennas are indeed on the (vx)vxB axis.
As of November 2024, only proton, helium, carbon, silicon and iron primaries are supported (this is limited by the CORSIKA particle codes defined in the generate_file_contents.py file).
- Parameters:¶
- sim_nr : int¶
The number of the simulation.
- sim_primary : {'proton', 'helium', 'carbon', 'silicon', 'iron'}¶
The primary particle to inject
- sim_cores : int¶
The number of cores the simulation will be run on
- sim_zenith : float, optional¶
The zenith angle. If not provided, the angle will be drawn from sample_zenith_angle.
- sim_azimuth : float, optional¶
The azimuth angle. If not provided, the angle will be drawn from sample_azimuth_angle.
- sim_energy : float, optional¶
The energy of the simulation. If not provided, the energy will be drawn from sample_primary_energy.
- core : list of float, default=[0, 0, 0] * units.m¶
The core to use in the simulation
- slice_gram : float, default=5.0 * units.g / units.cm2¶
The thickness of the atmospheric slices
- radii : list of float, default=None¶
The radii of the starshape, passed to template_synthesis.corsika.generate_list_file
- cherenkov : bool, default=False¶
If True, interpret radii as multiples of slice Cherenkov radius, and calculate antenna radii per slice
- magnetic_field : np.ndarray or str, default='lofar'¶
If a string, the name of the site from which to take the magnetic field vector (using radiotools.helper). Otherwise, this is interpreted as the magnetic field vector (in internal units).
- thinning : float, default=1e-7¶
The thinning level to use
- atmosphere : int, default=17¶
The CORSIKA atmosphere identifier
-
template_synthesis.corsika.write_simulation.sample_azimuth_angle(range=
(0, 360)
, size=1
)¶ Sample the azimuth angle within the given range, from a uniform distribution.
-
template_synthesis.corsika.write_simulation.sample_primary_energy(exp_range=
(8, 10)
)¶ Sample a single primary energy from log-uniform distribution, between the exponents given by exp_range. For example, using the default settings, calling this function will generate a value between \(10^{8}\) and \(10^{10}\) GeV.
-
template_synthesis.corsika.write_simulation.sample_zenith_angle(range=
(0, 90)
, size=1
, uniformity='sin2'
)¶ Sample the zenith angle from some distribution normalised with the solid angle. The names of the distributions refer to the variable in which they are uniform.
Notes
The names of the distributions refer to the variable in which they are uniform, in the sense that if you sampled using ‘sin2’ (the default), the zenith angle distribution will look uniform if binned in \(sin^2(\theta)\).
-
template_synthesis.corsika.write_simulation.write_simulation_to_file(inp_file, list_file, reas_file, sim_directory=
'./'
)¶ Write the contents of the INP, LIST and REAS files for an MPI simulation to a directory. The function will fail if the directory already exists.