Simulation settings and configuration formats#

Shared run settings and selection of software-specific configuration writers.

Physical run settings shared by shower and telescope simulations.

class simtools.simulation.parameters.SimulationParameters(run_number, primary_particle, zenith_angle, azimuth_angle, shower_events, mc_events, viewcone_max=0.0, zenith_min=0.0, run_mode=None, use_curved_atmosphere=False)[source]#

Common simulation settings, independent of configuration-file syntax.

Angles are expressed in degrees, matching simtools run naming and pointing. Particle identities use the existing PrimaryParticle conversions.

Parameters:
run_numberint

Run identifier.

primary_particlePrimaryParticle

Primary particle identity.

zenith_angle, azimuth_anglefloat

Telescope pointing in degrees.

shower_events, mc_eventsint

Number of showers and number of events including shower reuse.

viewcone_maxfloat

Outer viewcone angle in degrees.

zenith_minfloat

Minimum shower zenith angle in degrees, used in file names.

run_modestr or None

Calibration mode, or None for air showers.

use_curved_atmospherebool

Whether curved-atmosphere checks apply to this run.

classmethod from_args(args, run_number, site_model)[source]#

Resolve common settings from application arguments or an input file.

Parameters:
argsdict

Validated simtools arguments.

run_numberint

Run identifier.

site_modelSiteModel

Site used to check the input observation level.

Returns:
SimulationParameters

Shared run settings, without constructing a shower configuration.

is_calibration_run()[source]#

Return whether this run generates calibration events.

Select software-specific configuration writers for resolved simulation models.

simtools.simulation.configuration.export_model_files(model, destination=None, update_if_necessary=False)[source]#

Export the parameter files of a model into its model directory.

Parameters:
modelModelParameter

Model whose parameter files are exported.

destinationpathlib.Path, optional

Target directory. Defaults to the model configuration directory.

update_if_necessarybool

Skip the export if the model files were already exported and not changed since.

simtools.simulation.configuration.get_light_source_writer(simulation)[source]#

Return the configuration writer for a calibration-source simulation.

Parameters:
simulationSimulatorLightEmission

Physical setup with light_emission_config and resolved models.

Returns:
object

Selected calibration-source configuration writer.

simtools.simulation.configuration.get_model_writer(model, simulation_software='sim_telarray', context=None)[source]#

Return the selected model configuration writer, retaining its table cache.

Parameters:
modelModelParameter or ArrayModel

Resolved simulation model.

simulation_softwarestr

Registered configuration writer.

contextRunContext, optional

Run context; the model’s own context is used if not given.

Returns:
object

Software-specific model writer.

Raises:
ValueError

If the selected software is not registered.

simtools.simulation.configuration.get_shower_configuration(array_model, run_number, label=None, simulation_software='corsika', context=None)[source]#

Create a shower configuration for the selected software.

Parameters:
array_modelArrayModel

Resolved array and site model.

run_numberint

Run identifier.

labelstr, optional

File naming label.

simulation_softwarestr

Registered shower configuration writer.

Returns:
object

Shower configuration with common simulation parameters.

Angular and temporal emission profiles of calibration light sources.

The profiles follow the calibration-model parameters flasher_angular_distribution (with flasher_angular_distribution_width) and flasher_pulse_shape. They are tables, linear between nodes, for ray-tracing backends that make the light themselves.

simtools.simulation.light_source_profiles.angular_profile(shape, width_deg, samples=201, n_sigma=5.0)[source]#

Relative intensity per solid angle versus angle to the source axis.

Parameters:
shape: str

Isotropic, Gauss (standard deviation width_deg), FilledCone (half opening angle width_deg) or Lambertian (cosine, up to width_deg).

width_deg: float

Width of the distribution [deg].

samples: int

Number of nodes of the Gauss and Lambertian tables.

n_sigma: float

Range of the Gauss table in standard deviations.

Returns:
tuple of numpy.ndarray

Angles [deg] and relative intensities.

simtools.simulation.light_source_profiles.pulse_profile(shape, width_ns, decay_ns, samples=201, n_sigma=5.0)[source]#

Relative emission rate versus time.

Parameters:
shape: str

TopHat (full width width_ns), Gauss (standard deviation width_ns), Exponential (decay time decay_ns) or Gauss-Exponential (10-90% rise time width_ns, 90-10% fall time decay_ns, a Gaussian convolved with an exponential).

width_ns, decay_ns: float

Width and decay time [ns].

samples: int

Number of nodes of the smooth profiles.

n_sigma: float

Range of the profiles: n_sigma standard deviations (Gauss), 4 n_sigma decay times (Exponential, down to exp(-20)), n_sigma times rise plus four fall times on either side of the peak (Gauss-Exponential).

Returns:
tuple of numpy.ndarray or None

Times [ns] and rates, or None for an instantaneous pulse.