simtools-production-generate-grid#
Generate a simulation production grid for a wide range of simulation parameters.
Overview#
The application expands a grid of simulation configuration parameters to be used for a simulation production. Possible axes include particle type, simulation model version, interaction models, and pointing directions such as azimuth, zenith, hour angle, and declination.
The generated grid can be used as input for local production execution or workload-management submission tools. Different levels of night-sky background (NSB) can be configured through the production model version.
Input/Output#
The application reads and writes the following user-visible files:
Role |
Argument |
Format |
Purpose |
Schema |
|---|---|---|---|---|
Input |
|
ECSV |
Lookup table for CORSIKA simulation limits (optional). |
|
Output |
|
ECSV |
Executable production job grid. |
Defining the number of showers#
showers_per_run defines the baseline number of CORSIKA showers in one job. It is required unless
max_showers_per_run is used with total_showers.
For every combination of primary, model version, interaction model, pointing, and energy interval,
the application first determines the showers in each generated job and then determines how many jobs
to create. The resulting value is written to the showers_per_run column; the unscaled configured
value is retained in configured_showers_per_run.
Choose one of the following allocation modes:
Mode |
Configuration |
Result |
|---|---|---|
Fixed number of jobs |
Set |
Creates that many jobs for every grid point and energy interval. The total is |
Target number of showers |
Set |
Creates enough equal-sized jobs to meet the target at every grid point and energy interval. This cannot be used with |
Add max_showers_per_run with total_showers to choose the smallest number of equal-sized jobs
that stays at or below the cap. The generated total is rounded up only enough to keep every job
equal. For example, a target of 2500 with a cap of 1000 creates three jobs of 834 showers (2502
showers total). This option can be set in YAML or passed as --max_showers_per_run.
Without max_showers_per_run, total_showers uses showers_per_run as the fixed job size and
rounds the target up to a whole number of jobs. For example,
total_showers: 2500 and showers_per_run: 1000 create three jobs of 1000 showers, for an actual
total of 3000. A warning reports each such adjustment; max_total_showers_rounding_warnings limits
how many of these warnings are emitted (20 by default).
The following options alter the shower allocation. Per-run scaling is applied before the number of
jobs is determined, so it affects the total when number_of_runs is used and the required number of
jobs when total_showers is used.
Option |
Choices or value |
Effect |
|---|---|---|
|
|
Scales the baseline per-run value by |
|
|
|
|
|
Applies only with |
total_showers_scaling changes the requested total, whereas showers_per_run_scaling changes the
size of each job. They can be combined: the first sets a zenith-dependent target and the second sets
a zenith-dependent job size, after which the application rounds the number of jobs up as needed.
Command line arguments#
options#
- –help
show this help message and exit
- –axis
Grid axis as NAME MIN UNIT MAX UNIT POINTS [SCALING]. Repeat for each axis. Use azimuth/zenith or ha/dec, plus offset. SCALING is linear, log, or 1/cos.
- –direction_grid_density
Direction-point density in deg^-2. Overrides POINTS for both direction axes.
- –local_zenith_range
Accepted local zenith range for an HA/Dec density grid, e.g. 0 deg 70 deg.
- –local_azimuth_range
Accepted local azimuth range for an HA/Dec density grid. Ranges may wrap through 0 deg.
- –output_file
Output ECSV production job grid.
Default: job_grid.ecsv.
- –corsika_limits
ECSV lookup table of direction-dependent CORSIKA simulation limits.
- –total_showers
Target showers per grid point and energy interval; incompatible with –number_of_runs.
- –max_showers_per_run
Maximum equal shower count per run when total_showers is configured.
- –total_showers_scaling
Total-shower zenith scaling. zenith_scaled applies N * exp(factor * (cos(zenith) - 1)).
Default: fixed. Choices: fixed, zenith_scaled.
- –zenith_angle_scaling_factor
Factor in the zenith_scaled total-showers expression.
Default: 3.9781.
- –max_total_showers_rounding_warnings
Maximum warnings emitted when total_showers is rounded up to complete runs.
Default: 20.
- –showers_per_run_power_law
Scale showers per run by (E_mid / E_ref)^INDEX (mostly used for fixed energy grid). Provide three values: INDEX VALUE UNIT; E_mid is the logarithmic energy-interval midpoint.
- –showers_per_run_scaling
Showers-per-run zenith scaling. cosine_zenith applies ceil(N * cos(zenith)).
Default: fixed. Choices: fixed, cosine_zenith.
- –energy_max_scaling
Set the zenith-dependent maximum energy to VALUE * cos(zenith)^INDEX. Provide three values: INDEX VALUE UNIT; the configured energy-range maximum remains an upper bound.
simulation configuration#
- –number_of_runs
Runs generated per grid point.
- –primary
Primary particle(s) to simulate. Common names: gamma, electron, positron, muon+, muon-, proton, neutron, helium, carbon, nitrogen, silicon, iron. Use –show_options primary.
Required.
- –primary_id_type
Primary particle ID type
Default: common_name. Choices: common_name, corsika7_id, pdg_id.
- –azimuth_angle
Telescope pointing direction in azimuth. It can be in degrees between 0 and 360 or one of north, south, east or west. North is 0 degrees and the azimuth grows clockwise (East is 90 degrees).
- –zenith_angle
Zenith angle in degrees (between 0 and 180).
Default: 20.0 deg.
- –showers_per_run
Baseline number of CORSIKA showers per run.
- –run_number_offset
Offset added to each run number.
- –run_number
Run number to be simulated.
Default: 1.
- –event_number_first_shower
Event number of first shower
Default: 1.
- –correct_for_b_field_alignment
Align North with geographic North (and not magnetic North).
Default: True.
- –curved_atmosphere_min_zenith_angle
Minimum zenith angle (deg) for using curved-atmosphere CORSIKA binaries.
Default: 65.0 deg.
simulation model#
- –model_version
Simulation production model version(s). Use –show_options model_version.
Required.
- –overwrite_model_parameters
JSON string with model parameters to overwrite
- –site
Observatory site (e.g., North, South). Use –show_options site.
Required.
- –array_layout_name
Array layout name(s) (e.g., CTAO-North-Alpha, LSTN-01). Telescope names are assumed as single-telescope layouts. Use –show_options array_layout_name.
Required.
simulation software#
- –simulation_software
Stages of the simulation chain in order, each as STAGE or STAGE:KEY=VALUE,… (e.g. corsika sim_telarray).
Default: [‘corsika’, ‘sim_telarray’].
shower parameters#
- –eslope
Slope of the energy spectrum.
Default: -2.0.
- –energy_range
Minimum and maximum primary energy, e.g. ‘10 GeV 5 TeV’.
Default: (<Quantity 3. GeV>, <Quantity 330. TeV>).
- –view_cone
Minimum and maximum view-cone radius, e.g. ‘0 deg 10 deg’.
Default: [‘0 deg 0 deg’].
- –core_scatter
Core positions per shower and maximum scatter radius, e.g. ‘10 500 m’.
Default: [‘10 10000 m’].
corsika configuration#
- –corsika_he_interaction
High-energy interaction model for CORSIKA (default fallback: epos). Use –show_options corsika_he_interaction.
- –corsika_le_interaction
Low-energy interaction model for CORSIKA (default fallback: urqmd). Use –show_options corsika_le_interaction.
- –corsika_hadronic_transition_energy
Transition energy between the low- and high-energy CORSIKA hadronic interaction models. Unitless values are interpreted as GeV. If omitted, the CORSIKA build default is used.
model repository#
- –simulation_models_path
Path containing the simulation-model repository to read.
- –simulation_models_git_path
Path to a local normal, bare, or mirror Git repository containing simulation models.
- –simulation_models_git_revision
Git tag, ref, or commit to read from the simulation-model repository.
application#
- –show_options
Print available values for a supported option and exit.
Examples#
Generate an HA/Dec production grid#
Generate point-source simulation jobs at fixed hour-angle and declination offsets, applying tabulated CORSIKA limits.
Application: simtools-production-generate-grid
Integration test: production_generate_grid_ha_dec.yml
Command
simtools-production-generate-grid --config tests/integration_tests/config/production_generate_grid_ha_dec.yml
Configuration
array_layout_name: LSTN-01
axis:
- ha 0 deg 360 deg 36 linear
- dec -90 deg 90 deg 18 linear
- offset 0 deg 10 deg 2 linear
core_scatter: 10 500 m
corsika_he_interaction: epos
corsika_le_interaction: urqmd
energy_range: 30 GeV 300 GeV
corsika_limits: ${downloaded:corsika_limits.ecsv}
model_version: 7.0.0
showers_per_run: 5
showers_per_run_power_law: 0.0 1 TeV
number_of_runs: 2
output_file: job_grid_ha_dec.ecsv
output_path: simtools-output
primary: gamma
simulation_software:
- corsika
- sim_telarray
site: North
view_cone: 0 deg 10 deg
Generate a density-based HA/Dec production grid#
Sample hour angle and declination across 0 to 70 deg zenith distance while applying tabulated CORSIKA limits.
Application: simtools-production-generate-grid
Integration test: production_generate_grid_ha_dec_density.yml
Command
simtools-production-generate-grid --config tests/integration_tests/config/production_generate_grid_ha_dec_density.yml
Configuration
array_layout_name: LSTN-01
axis:
- ha 0 deg 360 deg 1 linear
- dec -40 deg 80 deg 1 linear
- offset 0 deg 10 deg 2 linear
local_zenith_range: 0 deg 70 deg
local_azimuth_range: 300 deg 60 deg
direction_grid_density: 0.25 1/deg^2
core_scatter: 10 500 m
corsika_he_interaction: epos
corsika_le_interaction: urqmd
energy_range: 30 GeV 300 GeV
corsika_limits: ${downloaded:corsika_limits.ecsv}
model_version: 7.0.0
showers_per_run: 5
showers_per_run_power_law: 0.0 1 TeV
number_of_runs: 2
output_file: job_grid_ha_dec_density.ecsv
output_path: simtools-output
primary: gamma
simulation_software:
- corsika
- sim_telarray
site: North
view_cone: 0 deg 10 deg
Generate a zenith-azimuth production grid#
Generate horizontal-coordinate simulation jobs with event counts scaled by energy and zenith angle and with tabulated CORSIKA limits.
Application: simtools-production-generate-grid
Integration test: production_generate_grid_horizontal.yml
Command
simtools-production-generate-grid --config tests/integration_tests/config/production_generate_grid_horizontal.yml
Configuration
array_layout_name: LSTN-01
axis:
- azimuth 310 deg 20 deg 3 linear
- zenith 30 deg 40 deg 2 linear
- offset 0 deg 10 deg 2 linear
core_scatter: 10 500 m
corsika_he_interaction: epos
corsika_le_interaction: urqmd
energy_range: 30 GeV 300 GeV
corsika_limits: ${downloaded:corsika_limits.ecsv}
model_version: 7.0.0
showers_per_run: 5
showers_per_run_power_law: 0.0 1 TeV
showers_per_run_scaling: cosine_zenith
number_of_runs: 2
output_file: job_grid_horizontal.ecsv
output_path: simtools-output
primary: gamma
simulation_software:
- corsika
- sim_telarray
site: North
view_cone: 0 deg 10 deg
Generate a density-based horizontal production grid#
Sample zenith and azimuth according to a configured sky density to create executable simulation jobs.
Application: simtools-production-generate-grid
Integration test: production_generate_grid_horizontal_density.yml
Command
simtools-production-generate-grid --config tests/integration_tests/config/production_generate_grid_horizontal_density.yml
Configuration
array_layout_name:
by_version:
<7.0.0: 1lst
'>=7.0.0': LSTN-01
axis:
- azimuth 0 deg 360 deg 0 linear
- zenith 0 deg 70 deg 0 linear
- offset 0 deg 10 deg 2 linear
direction_grid_density: 0.25 1/deg^2
corsika_he_interaction: epos
corsika_le_interaction: urqmd
energy_range: 3 GeV 500 TeV
energy_max_scaling: -2.5 200 TeV
core_scatter: 10 2500 m
corsika_limits: ${downloaded:corsika_limits.ecsv}
model_version: 7.0.0
showers_per_run: 5
showers_per_run_power_law: 0.0 1 TeV
number_of_runs: 2
output_file: job_grid_horizontal_grid_density.ecsv
output_path: simtools-output
primary: gamma
simulation_software:
- corsika
- sim_telarray
site: North
view_cone: 0 deg 10 deg
Generate an explicit horizontal production grid#
Expand explicitly configured horizontal, energy, particle, and model axes into simulation jobs with energy-and zenith-scaled event counts.
Application: simtools-production-generate-grid
Integration test: production_generate_grid_horizontal_explicit.yml
Command
simtools-production-generate-grid --config tests/integration_tests/config/production_generate_grid_horizontal_explicit.yml
Configuration
array_layout_name:
by_version:
<7.0.0: alpha
'>=7.0.0': CTAO-North-Alpha
azimuth_angle:
- North
- South
core_scatter: 10 500 m
corsika_he_interaction:
- epos
- qgs3
corsika_le_interaction: urqmd
energy_range:
- 30 GeV 30 GeV
- 300 GeV 300 GeV
label: test-production-grid
log_level: DEBUG
model_version:
- 6.3.0
- 7.0.0
showers_per_run: 5
showers_per_run_power_law: 0.0 1 TeV
total_showers: 50
total_showers_scaling: zenith_scaled
output_file: job_grid_horizontal_explicit.ecsv
output_path: simtools-output
primary:
- gamma
- proton
simulation_software:
- corsika
- sim_telarray
site: North
view_cone: 0 deg 10 deg
zenith_angle:
- 20
- 40