gammasimtools 0.23.0__py3-none-any.whl → 0.25.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gammasimtools-0.23.0.dist-info → gammasimtools-0.25.0.dist-info}/METADATA +1 -1
- {gammasimtools-0.23.0.dist-info → gammasimtools-0.25.0.dist-info}/RECORD +89 -85
- {gammasimtools-0.23.0.dist-info → gammasimtools-0.25.0.dist-info}/entry_points.txt +1 -0
- simtools/_version.py +2 -2
- simtools/application_control.py +54 -4
- simtools/applications/convert_geo_coordinates_of_array_elements.py +1 -1
- simtools/applications/db_add_file_to_db.py +2 -2
- simtools/applications/db_add_simulation_model_from_repository_to_db.py +1 -1
- simtools/applications/db_add_value_from_json_to_db.py +2 -2
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +1 -1
- simtools/applications/db_generate_compound_indexes.py +1 -1
- simtools/applications/db_get_array_layouts_from_db.py +2 -2
- simtools/applications/db_get_file_from_db.py +1 -1
- simtools/applications/db_get_parameter_from_db.py +1 -1
- simtools/applications/db_inspect_databases.py +4 -2
- simtools/applications/db_upload_model_repository.py +1 -1
- simtools/applications/derive_ctao_array_layouts.py +1 -1
- simtools/applications/derive_psf_parameters.py +5 -0
- simtools/applications/derive_pulse_shape_parameters.py +195 -0
- simtools/applications/generate_array_config.py +1 -1
- simtools/applications/maintain_simulation_model_add_production.py +11 -21
- simtools/applications/plot_array_layout.py +63 -1
- simtools/applications/production_generate_grid.py +1 -1
- simtools/applications/simulate_flasher.py +3 -2
- simtools/applications/simulate_pedestals.py +1 -1
- simtools/applications/simulate_prod.py +8 -23
- simtools/applications/simulate_prod_htcondor_generator.py +7 -0
- simtools/applications/submit_array_layouts.py +7 -5
- simtools/applications/validate_camera_fov.py +1 -1
- simtools/applications/validate_cumulative_psf.py +2 -2
- simtools/applications/validate_file_using_schema.py +49 -123
- simtools/applications/validate_optics.py +1 -1
- simtools/configuration/commandline_parser.py +15 -15
- simtools/configuration/configurator.py +1 -1
- simtools/corsika/corsika_config.py +199 -91
- simtools/data_model/model_data_writer.py +15 -3
- simtools/data_model/schema.py +145 -36
- simtools/data_model/validate_data.py +82 -48
- simtools/db/db_handler.py +61 -294
- simtools/db/db_model_upload.py +3 -2
- simtools/db/mongo_db.py +626 -0
- simtools/dependencies.py +38 -17
- simtools/io/eventio_handler.py +128 -0
- simtools/job_execution/htcondor_script_generator.py +0 -2
- simtools/layout/array_layout.py +7 -7
- simtools/layout/array_layout_utils.py +4 -4
- simtools/model/array_model.py +72 -72
- simtools/model/calibration_model.py +12 -9
- simtools/model/model_parameter.py +196 -160
- simtools/model/model_repository.py +176 -39
- simtools/model/model_utils.py +3 -3
- simtools/model/site_model.py +59 -27
- simtools/model/telescope_model.py +21 -13
- simtools/ray_tracing/mirror_panel_psf.py +4 -4
- simtools/ray_tracing/psf_analysis.py +11 -8
- simtools/ray_tracing/psf_parameter_optimisation.py +823 -680
- simtools/reporting/docs_auto_report_generator.py +1 -1
- simtools/reporting/docs_read_parameters.py +72 -11
- simtools/runners/corsika_runner.py +12 -3
- simtools/runners/corsika_simtel_runner.py +6 -0
- simtools/runners/runner_services.py +17 -7
- simtools/runners/simtel_runner.py +12 -54
- simtools/schemas/model_parameters/flasher_pulse_exp_decay.schema.yml +2 -0
- simtools/schemas/model_parameters/flasher_pulse_shape.schema.yml +50 -0
- simtools/schemas/model_parameters/flasher_pulse_width.schema.yml +2 -0
- simtools/schemas/simulation_models_info.schema.yml +4 -1
- simtools/simtel/pulse_shapes.py +268 -0
- simtools/simtel/simtel_config_writer.py +179 -21
- simtools/simtel/simtel_io_event_writer.py +2 -2
- simtools/simtel/simulator_array.py +58 -12
- simtools/simtel/simulator_light_emission.py +45 -8
- simtools/simulator.py +361 -346
- simtools/testing/assertions.py +110 -10
- simtools/testing/configuration.py +1 -1
- simtools/testing/log_inspector.py +4 -1
- simtools/testing/sim_telarray_metadata.py +1 -1
- simtools/testing/validate_output.py +46 -15
- simtools/utils/names.py +2 -4
- simtools/utils/value_conversion.py +10 -5
- simtools/version.py +61 -0
- simtools/visualization/legend_handlers.py +14 -4
- simtools/visualization/plot_array_layout.py +229 -33
- simtools/visualization/plot_mirrors.py +837 -0
- simtools/visualization/plot_pixels.py +1 -1
- simtools/visualization/plot_psf.py +1 -1
- simtools/visualization/plot_tables.py +1 -1
- simtools/simtel/simtel_io_file_info.py +0 -62
- {gammasimtools-0.23.0.dist-info → gammasimtools-0.25.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.23.0.dist-info → gammasimtools-0.25.0.dist-info}/licenses/LICENSE +0 -0
- {gammasimtools-0.23.0.dist-info → gammasimtools-0.25.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
r"""Derive Gaussian sigma and exponential tau from specified rise/fall widths.
|
|
3
|
+
|
|
4
|
+
Solve (sigma, tau) for a Gaussian convolved with a causal exponential so the
|
|
5
|
+
pulse matches user-provided rise and fall widths between fractional amplitude
|
|
6
|
+
levels (e.g. 0.1-0.9 rise, 0.9-0.1 fall).
|
|
7
|
+
|
|
8
|
+
Command line arguments
|
|
9
|
+
----------------------
|
|
10
|
+
site (str, required)
|
|
11
|
+
North or South.
|
|
12
|
+
telescope (str, required)
|
|
13
|
+
Telescope model name.
|
|
14
|
+
model_version (str, required)
|
|
15
|
+
Model version.
|
|
16
|
+
parameter_version (str, required)
|
|
17
|
+
Parameter version.
|
|
18
|
+
rise_width_ns (float, required)
|
|
19
|
+
Rising-edge width between rise_range fractions (ns).
|
|
20
|
+
fall_width_ns (float, required)
|
|
21
|
+
Falling-edge width between fall_range fractions (ns).
|
|
22
|
+
rise_range (float float, optional)
|
|
23
|
+
Fractional amplitudes (low high) for rise width (default: 0.1 0.9).
|
|
24
|
+
fall_range (float float, optional)
|
|
25
|
+
Fractional amplitudes (high low) for fall width (default: 0.9 0.1).
|
|
26
|
+
dt_ns (float, optional)
|
|
27
|
+
Time sampling step (ns). Default: 0.1.
|
|
28
|
+
time_margin_ns (float, optional)
|
|
29
|
+
Margin added at both ends of readout window. Default: 5.
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
Example
|
|
33
|
+
-------
|
|
34
|
+
Derive parameters for a pulse with 2.5 ns rise (10-90%) and
|
|
35
|
+
5 ns fall (90-10%) for LSTN-01:
|
|
36
|
+
|
|
37
|
+
.. code-block:: console
|
|
38
|
+
|
|
39
|
+
simtools-derive-pulse-shape-parameters \
|
|
40
|
+
--site North \
|
|
41
|
+
--telescope MSTx-NectarCam \
|
|
42
|
+
--model_version 7.0 \
|
|
43
|
+
--parameter_version 1.0.0 \
|
|
44
|
+
--rise_width_ns 2.5 \
|
|
45
|
+
--fall_width_ns 5.0 \
|
|
46
|
+
--rise_range 0.1 0.9 \
|
|
47
|
+
--fall_range 0.9 0.1 \
|
|
48
|
+
--dt_ns 0.1 \
|
|
49
|
+
--time_margin_ns 10
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
import logging
|
|
53
|
+
|
|
54
|
+
import simtools.data_model.model_data_writer as writer
|
|
55
|
+
from simtools.application_control import get_application_label, startup_application
|
|
56
|
+
from simtools.configuration import configurator
|
|
57
|
+
from simtools.model.model_utils import initialize_simulation_models
|
|
58
|
+
from simtools.simtel.pulse_shapes import solve_sigma_tau_from_rise_fall
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _parse():
|
|
62
|
+
"""Parse command line configuration for parameter derivation."""
|
|
63
|
+
config = configurator.Configurator(
|
|
64
|
+
label=get_application_label(__file__),
|
|
65
|
+
description=(
|
|
66
|
+
"Derive Gaussian sigma and exponential tau from rise/fall width specifications."
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
config.parser.add_argument(
|
|
71
|
+
"--rise_width_ns",
|
|
72
|
+
help="Wdth on the rising edge in ns between rise_range fractions.",
|
|
73
|
+
type=float,
|
|
74
|
+
required=True,
|
|
75
|
+
)
|
|
76
|
+
config.parser.add_argument(
|
|
77
|
+
"--fall_width_ns",
|
|
78
|
+
help="Width on the falling edge in ns between fall_range fractions.",
|
|
79
|
+
type=float,
|
|
80
|
+
required=True,
|
|
81
|
+
)
|
|
82
|
+
config.parser.add_argument(
|
|
83
|
+
"--rise_range",
|
|
84
|
+
help="Fractional amplitudes (low high) for rise width, e.g. 0.1 0.9",
|
|
85
|
+
type=float,
|
|
86
|
+
nargs=2,
|
|
87
|
+
default=[0.1, 0.9],
|
|
88
|
+
required=False,
|
|
89
|
+
)
|
|
90
|
+
config.parser.add_argument(
|
|
91
|
+
"--fall_range",
|
|
92
|
+
help="Fractional amplitudes (high low) for fall width, e.g. 0.9 0.1",
|
|
93
|
+
type=float,
|
|
94
|
+
nargs=2,
|
|
95
|
+
default=[0.9, 0.1],
|
|
96
|
+
required=False,
|
|
97
|
+
)
|
|
98
|
+
config.parser.add_argument(
|
|
99
|
+
"--dt_ns",
|
|
100
|
+
help="Time sampling step in ns used by the solver.",
|
|
101
|
+
type=float,
|
|
102
|
+
default=0.1,
|
|
103
|
+
required=False,
|
|
104
|
+
)
|
|
105
|
+
config.parser.add_argument(
|
|
106
|
+
"--time_margin_ns",
|
|
107
|
+
help=(
|
|
108
|
+
"Margin (ns) added to both ends of the instrument readout window when deriving the "
|
|
109
|
+
"internal time window."
|
|
110
|
+
),
|
|
111
|
+
type=float,
|
|
112
|
+
default=10.0,
|
|
113
|
+
required=False,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
return config.initialize(
|
|
117
|
+
db_config=True,
|
|
118
|
+
simulation_model=["site", "telescope", "model_version", "parameter_version"],
|
|
119
|
+
output=True,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def main():
|
|
124
|
+
"""Run parameter derivation and write results."""
|
|
125
|
+
app_context = startup_application(_parse)
|
|
126
|
+
log = logging.getLogger(__name__)
|
|
127
|
+
|
|
128
|
+
rise_width_ns = app_context.args["rise_width_ns"]
|
|
129
|
+
fall_width_ns = app_context.args["fall_width_ns"]
|
|
130
|
+
rise_range = tuple(app_context.args["rise_range"])
|
|
131
|
+
fall_range = tuple(app_context.args["fall_range"])
|
|
132
|
+
dt_ns = app_context.args["dt_ns"]
|
|
133
|
+
time_margin_ns = app_context.args["time_margin_ns"]
|
|
134
|
+
site = app_context.args["site"]
|
|
135
|
+
label = app_context.args.get("label") or get_application_label(__file__)
|
|
136
|
+
telescope_model, _, _ = initialize_simulation_models(
|
|
137
|
+
label=label,
|
|
138
|
+
db_config=app_context.db_config,
|
|
139
|
+
model_version=app_context.args["model_version"],
|
|
140
|
+
site=site,
|
|
141
|
+
telescope_name=app_context.args["telescope"],
|
|
142
|
+
)
|
|
143
|
+
fadc_sum_bins = telescope_model.get_parameter_value("fadc_sum_bins")
|
|
144
|
+
|
|
145
|
+
window_ns = fadc_sum_bins + time_margin_ns
|
|
146
|
+
t_start_ns = -window_ns
|
|
147
|
+
t_stop_ns = window_ns
|
|
148
|
+
|
|
149
|
+
sigma_ns, tau_ns = solve_sigma_tau_from_rise_fall(
|
|
150
|
+
rise_width_ns=rise_width_ns,
|
|
151
|
+
fall_width_ns=fall_width_ns,
|
|
152
|
+
dt_ns=dt_ns,
|
|
153
|
+
rise_range=rise_range,
|
|
154
|
+
t_start_ns=t_start_ns,
|
|
155
|
+
t_stop_ns=t_stop_ns,
|
|
156
|
+
)
|
|
157
|
+
# Apply reasonable rounding for output precision.
|
|
158
|
+
sigma_ns = round(sigma_ns, 4)
|
|
159
|
+
tau_ns = round(tau_ns, 4)
|
|
160
|
+
|
|
161
|
+
log.info(
|
|
162
|
+
f"Derived pulse parameters: sigma={sigma_ns:.6g} ns, tau={tau_ns:.6g} ns "
|
|
163
|
+
f"(rise={rise_width_ns} ns @ {rise_range}, fall={fall_width_ns} ns @ {fall_range})"
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
output_path = app_context.args.get("output_path")
|
|
167
|
+
instrument = app_context.args.get("telescope")
|
|
168
|
+
parameter_version = app_context.args.get("parameter_version")
|
|
169
|
+
|
|
170
|
+
writer.ModelDataWriter.dump_model_parameter(
|
|
171
|
+
parameter_name="flasher_pulse_width",
|
|
172
|
+
value=sigma_ns,
|
|
173
|
+
instrument=instrument,
|
|
174
|
+
parameter_version=parameter_version,
|
|
175
|
+
output_file="flasher_pulse_width.json",
|
|
176
|
+
output_path=output_path,
|
|
177
|
+
unit="ns",
|
|
178
|
+
)
|
|
179
|
+
writer.ModelDataWriter.dump_model_parameter(
|
|
180
|
+
parameter_name="flasher_pulse_exp_decay",
|
|
181
|
+
value=tau_ns,
|
|
182
|
+
instrument=instrument,
|
|
183
|
+
parameter_version=parameter_version,
|
|
184
|
+
output_file="flasher_pulse_exp_decay.json",
|
|
185
|
+
output_path=output_path,
|
|
186
|
+
unit="ns",
|
|
187
|
+
)
|
|
188
|
+
log.info(
|
|
189
|
+
f"Wrote model parameter files flasher_pulse_width.json and "
|
|
190
|
+
f"flasher_pulse_exp_decay.json (sigma={sigma_ns:.6g} ns, tau={tau_ns:.6g} ns)"
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
if __name__ == "__main__":
|
|
195
|
+
main()
|
|
@@ -46,7 +46,7 @@ def main():
|
|
|
46
46
|
array_model = ArrayModel(
|
|
47
47
|
label=app_context.args["label"],
|
|
48
48
|
model_version=app_context.args["model_version"],
|
|
49
|
-
|
|
49
|
+
db_config=app_context.db_config,
|
|
50
50
|
site=app_context.args.get("site"),
|
|
51
51
|
layout_name=app_context.args.get("array_layout_name"),
|
|
52
52
|
array_elements=app_context.args.get("array_elements"),
|
|
@@ -3,15 +3,18 @@ Generate a new simulation model production and update tables and model parameter
|
|
|
3
3
|
|
|
4
4
|
This script is used to maintain the simulation model repository. It allows to create
|
|
5
5
|
new production tables by copying an existing base version and applies modifications
|
|
6
|
-
to production tables and model parameters as provided in a
|
|
6
|
+
to production tables and model parameters as provided in a configuration file (see
|
|
7
|
+
the 'info.yml' examples in the simulation models repository).
|
|
7
8
|
|
|
8
9
|
Two main use cases are covered by this script:
|
|
9
10
|
|
|
10
|
-
1. full update:
|
|
11
|
+
1. full update: create a complete new set of production tables (e.g. for new major or minor
|
|
11
12
|
versions of the simulation models). This will copy all production tables from the source
|
|
12
13
|
directory and apply the modifications to the tables that are listed in the modifications file.
|
|
14
|
+
If the full update is based on a previous patch update, the full history of changes is applied
|
|
15
|
+
iteratively until the last base version is reached.
|
|
13
16
|
|
|
14
|
-
2. patch update:
|
|
17
|
+
2. patch update: create a set of new production tables including the changes defined in the
|
|
15
18
|
modifications file. No unmodified tables are copied. For new production tables with patch
|
|
16
19
|
modifications, the key-value pair 'base_model_version: <base_model version>' is added.
|
|
17
20
|
|
|
@@ -26,8 +29,8 @@ The following example applies a patch update with changes defined in a YAML file
|
|
|
26
29
|
.. code-block:: console
|
|
27
30
|
|
|
28
31
|
simtools-maintain-simulation-model-add-new-production \\
|
|
29
|
-
--
|
|
30
|
-
--
|
|
32
|
+
--model_path ../simulation-models-dev/simulation-models/ \\
|
|
33
|
+
--model_version 6.0.2
|
|
31
34
|
|
|
32
35
|
"""
|
|
33
36
|
|
|
@@ -44,20 +47,7 @@ def _parse():
|
|
|
44
47
|
label=get_application_label(__file__),
|
|
45
48
|
description="Generate a new simulation model production",
|
|
46
49
|
)
|
|
47
|
-
config.
|
|
48
|
-
"--simulation_models_path",
|
|
49
|
-
type=str,
|
|
50
|
-
required=True,
|
|
51
|
-
help="Path to the simulation models repository.",
|
|
52
|
-
)
|
|
53
|
-
config.parser.add_argument(
|
|
54
|
-
"--modifications",
|
|
55
|
-
type=str,
|
|
56
|
-
required=True,
|
|
57
|
-
help="File containing the list of changes to apply.",
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
return config.initialize(db_config=False, output=False)
|
|
50
|
+
return config.initialize(db_config=False, output=False, simulation_model=["model_version"])
|
|
61
51
|
|
|
62
52
|
|
|
63
53
|
def main():
|
|
@@ -65,8 +55,8 @@ def main():
|
|
|
65
55
|
app_context = startup_application(_parse)
|
|
66
56
|
|
|
67
57
|
model_repository.generate_new_production(
|
|
68
|
-
|
|
69
|
-
simulation_models_path=Path(app_context.args["
|
|
58
|
+
model_version=app_context.args["model_version"],
|
|
59
|
+
simulation_models_path=Path(app_context.args["model_path"]),
|
|
70
60
|
)
|
|
71
61
|
|
|
72
62
|
|
|
@@ -62,6 +62,17 @@ highlighted_array_elements : list, optional
|
|
|
62
62
|
List of array elements to plot with red circles around them.
|
|
63
63
|
legend_location : str, optional
|
|
64
64
|
Location of the legend (default "best").
|
|
65
|
+
bounds : str, optional
|
|
66
|
+
Axis bounds mode. Use "symmetric" for +-R with padding (default) or "exact" for
|
|
67
|
+
per-axis min/max bounds.
|
|
68
|
+
padding : float, optional
|
|
69
|
+
Fractional padding applied around computed extents in both modes (default 0.1).
|
|
70
|
+
x_lim : tuple(float, float), optional
|
|
71
|
+
Explicit x-axis limits [xmin, xmax] in meters. When provided, overrides derived limits
|
|
72
|
+
and filters plotted elements by x.
|
|
73
|
+
y_lim : tuple(float, float), optional
|
|
74
|
+
Explicit y-axis limits [ymin, ymax] in meters. When provided, overrides derived limits
|
|
75
|
+
and filters plotted elements by y.
|
|
65
76
|
|
|
66
77
|
Examples
|
|
67
78
|
--------
|
|
@@ -89,6 +100,20 @@ Plot layout from a file with a list of telescopes:
|
|
|
89
100
|
simtools-plot-array-layout
|
|
90
101
|
--array_layout_file tests/resources/telescope_positions-North-ground.ecsv
|
|
91
102
|
|
|
103
|
+
Use exact bounds with default padding:
|
|
104
|
+
|
|
105
|
+
.. code-block:: console
|
|
106
|
+
|
|
107
|
+
simtools-plot-array-layout --array_layout_name alpha \
|
|
108
|
+
--site North --model_version 6.0.0 --bounds exact
|
|
109
|
+
|
|
110
|
+
Use symmetric bounds with custom padding:
|
|
111
|
+
|
|
112
|
+
.. code-block:: console
|
|
113
|
+
|
|
114
|
+
simtools-plot-array-layout --array_layout_name alpha \
|
|
115
|
+
--site North --model_version 6.0.0 --bounds symmetric --padding 0.15
|
|
116
|
+
|
|
92
117
|
Plot layout from a parameter file with a list of telescopes:
|
|
93
118
|
|
|
94
119
|
.. code-block:: console
|
|
@@ -173,6 +198,24 @@ def _parse():
|
|
|
173
198
|
required=False,
|
|
174
199
|
default=None,
|
|
175
200
|
)
|
|
201
|
+
config.parser.add_argument(
|
|
202
|
+
"--x_lim",
|
|
203
|
+
help="Explicit x-axis limits [xmin xmax] in meters.",
|
|
204
|
+
type=float,
|
|
205
|
+
nargs=2,
|
|
206
|
+
required=False,
|
|
207
|
+
default=None,
|
|
208
|
+
metavar=("XMIN", "XMAX"),
|
|
209
|
+
)
|
|
210
|
+
config.parser.add_argument(
|
|
211
|
+
"--y_lim",
|
|
212
|
+
help="Explicit y-axis limits [ymin ymax] in meters.",
|
|
213
|
+
type=float,
|
|
214
|
+
nargs=2,
|
|
215
|
+
required=False,
|
|
216
|
+
default=None,
|
|
217
|
+
metavar=("YMIN", "YMAX"),
|
|
218
|
+
)
|
|
176
219
|
config.parser.add_argument(
|
|
177
220
|
"--array_layout_name_background",
|
|
178
221
|
help="Name of the background layout array (e.g., test_layout, alpha, 4mst, etc.).",
|
|
@@ -201,12 +244,27 @@ def _parse():
|
|
|
201
244
|
help=(
|
|
202
245
|
"Location of the legend (e.g., 'best', 'upper right', 'upper left', "
|
|
203
246
|
"'lower left', 'lower right', 'right', 'center left', 'center right', "
|
|
204
|
-
"'lower center', 'upper center', 'center')."
|
|
247
|
+
"'lower center', 'upper center', 'center', 'no_legend')."
|
|
205
248
|
),
|
|
206
249
|
type=str,
|
|
207
250
|
required=False,
|
|
208
251
|
default="best",
|
|
209
252
|
)
|
|
253
|
+
config.parser.add_argument(
|
|
254
|
+
"--bounds",
|
|
255
|
+
help=("Axis bounds mode: 'symmetric' uses +-R with padding, 'exact' uses per-axis min/max"),
|
|
256
|
+
type=str,
|
|
257
|
+
choices=["symmetric", "exact"],
|
|
258
|
+
required=False,
|
|
259
|
+
default="symmetric",
|
|
260
|
+
)
|
|
261
|
+
config.parser.add_argument(
|
|
262
|
+
"--padding",
|
|
263
|
+
help=("Fractional padding applied around computed extents (used for both modes)."),
|
|
264
|
+
type=float,
|
|
265
|
+
required=False,
|
|
266
|
+
default=0.1,
|
|
267
|
+
)
|
|
210
268
|
return config.initialize(
|
|
211
269
|
db_config=True,
|
|
212
270
|
simulation_model=[
|
|
@@ -305,6 +363,10 @@ def main():
|
|
|
305
363
|
grayed_out_elements=app_context.args["grayed_out_array_elements"],
|
|
306
364
|
highlighted_elements=app_context.args["highlighted_array_elements"],
|
|
307
365
|
legend_location=app_context.args["legend_location"],
|
|
366
|
+
bounds_mode=app_context.args["bounds"],
|
|
367
|
+
padding=app_context.args["padding"],
|
|
368
|
+
x_lim=tuple(app_context.args["x_lim"]) if app_context.args["x_lim"] else None,
|
|
369
|
+
y_lim=tuple(app_context.args["y_lim"]) if app_context.args["y_lim"] else None,
|
|
308
370
|
)
|
|
309
371
|
site_string = ""
|
|
310
372
|
if layout.get("site") is not None:
|
|
@@ -132,7 +132,7 @@ def main():
|
|
|
132
132
|
|
|
133
133
|
axes = load_axes(app_context.args["axes"])
|
|
134
134
|
site_model = SiteModel(
|
|
135
|
-
|
|
135
|
+
db_config=app_context.db_config,
|
|
136
136
|
model_version=app_context.args["model_version"],
|
|
137
137
|
site=app_context.args["site"],
|
|
138
138
|
)
|
|
@@ -29,8 +29,9 @@ Example Usage
|
|
|
29
29
|
.. code-block:: console
|
|
30
30
|
|
|
31
31
|
simtools-simulate-flasher --run_mode full_simulation \
|
|
32
|
-
--light_source MSFx-
|
|
33
|
-
--telescope MSTS-04 --site South
|
|
32
|
+
--light_source MSFx-NectarCam --model_version 6.0 \
|
|
33
|
+
--telescope MSTS-04 --site South --run_number 1 \
|
|
34
|
+
--array_layout_name 1mst
|
|
34
35
|
|
|
35
36
|
Command Line Arguments
|
|
36
37
|
----------------------
|
|
@@ -69,7 +69,7 @@ def _parse():
|
|
|
69
69
|
help="Calibration run mode",
|
|
70
70
|
type=str,
|
|
71
71
|
required=True,
|
|
72
|
-
choices=["pedestals", "
|
|
72
|
+
choices=["pedestals", "pedestals_dark", "pedestals_nsb_only"],
|
|
73
73
|
)
|
|
74
74
|
config.parser.add_argument(
|
|
75
75
|
"--number_of_events",
|
|
@@ -39,10 +39,6 @@ r"""
|
|
|
39
39
|
It allows the transformation system to keep using sequential run numbers without repetition.
|
|
40
40
|
run (int, required)
|
|
41
41
|
Run number (actual run number will be 'start_run' + 'run').
|
|
42
|
-
data_directory (str, optional)
|
|
43
|
-
The location of the output directories corsika-data and simtel-data.
|
|
44
|
-
the label is added to the data_directory, such that the output
|
|
45
|
-
will be written to data_directory/label/simtel-data.
|
|
46
42
|
pack_for_grid_register (str, optional)
|
|
47
43
|
Set whether to prepare a tarball for registering the output files on the grid.
|
|
48
44
|
The files are written to the specified directory.
|
|
@@ -58,13 +54,6 @@ r"""
|
|
|
58
54
|
simtools-simulate-prod \\
|
|
59
55
|
--model_version 5.0.0 --site north --primary gamma --azimuth_angle north \\
|
|
60
56
|
--zenith_angle 20 --start_run 0 --run 1
|
|
61
|
-
|
|
62
|
-
By default the configuration is saved in simtools-output/test-production
|
|
63
|
-
together with the actual simulation output in corsika-data and simtel-data within.
|
|
64
|
-
The location of the latter directories can be set
|
|
65
|
-
to a different location via the option --data_directory,
|
|
66
|
-
but the label is always added to the data_directory, such that the output
|
|
67
|
-
will be written to data_directory/label/simtel-data.
|
|
68
57
|
"""
|
|
69
58
|
|
|
70
59
|
from simtools.application_control import startup_application
|
|
@@ -76,15 +65,12 @@ def _parse():
|
|
|
76
65
|
"""Parse command line configuration."""
|
|
77
66
|
config = configurator.Configurator(description="Run simulations for productions")
|
|
78
67
|
config.parser.add_argument(
|
|
79
|
-
"--
|
|
68
|
+
"--corsika_file",
|
|
80
69
|
help=(
|
|
81
|
-
"
|
|
82
|
-
"the label is added to the data_directory, such that the output"
|
|
83
|
-
"will be written to data_directory/label/simtel-data."
|
|
70
|
+
"Path to the CORSIKA input file (only relevant for simulation software 'sim_telarray')."
|
|
84
71
|
),
|
|
85
|
-
type=str
|
|
72
|
+
type=str,
|
|
86
73
|
required=False,
|
|
87
|
-
default="./simtools-output/",
|
|
88
74
|
)
|
|
89
75
|
config.parser.add_argument(
|
|
90
76
|
"--pack_for_grid_register",
|
|
@@ -150,19 +136,18 @@ def main():
|
|
|
150
136
|
simulator.simulate()
|
|
151
137
|
simulator.validate_metadata()
|
|
152
138
|
|
|
153
|
-
app_context.logger.info(
|
|
154
|
-
f"Production run complete for primary {app_context.args['primary']} showers "
|
|
155
|
-
f"from {app_context.args['azimuth_angle']} azimuth and "
|
|
156
|
-
f"{app_context.args['zenith_angle']} zenith "
|
|
157
|
-
f"at {app_context.args['site']} site, using {app_context.args['model_version']} model."
|
|
158
|
-
)
|
|
159
139
|
if app_context.args["save_reduced_event_lists"]:
|
|
160
140
|
simulator.save_reduced_event_lists()
|
|
141
|
+
|
|
142
|
+
simulator.verify_simulations()
|
|
143
|
+
|
|
161
144
|
if app_context.args.get("pack_for_grid_register"):
|
|
162
145
|
simulator.pack_for_register(app_context.args["pack_for_grid_register"])
|
|
163
146
|
if app_context.args["save_file_lists"]:
|
|
164
147
|
simulator.save_file_lists()
|
|
165
148
|
|
|
149
|
+
simulator.report()
|
|
150
|
+
|
|
166
151
|
|
|
167
152
|
if __name__ == "__main__":
|
|
168
153
|
main()
|
|
@@ -56,6 +56,13 @@ def _parse():
|
|
|
56
56
|
label=get_application_label(__file__),
|
|
57
57
|
description="Prepare simulations production for HT Condor job submission",
|
|
58
58
|
)
|
|
59
|
+
config.parser.add_argument(
|
|
60
|
+
"--number_of_runs",
|
|
61
|
+
help="Number of runs to be simulated.",
|
|
62
|
+
type=int,
|
|
63
|
+
required=True,
|
|
64
|
+
default=1,
|
|
65
|
+
)
|
|
59
66
|
config.parser.add_argument(
|
|
60
67
|
"--apptainer_image",
|
|
61
68
|
help="Apptainer image to use for the simulation (full path).",
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/python3
|
|
2
2
|
|
|
3
3
|
r"""
|
|
4
|
-
|
|
4
|
+
Read array layouts from file, validate with telescopes in DB, and prepare for submission.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
Validates that all telescope defined in the array layouts exist in the database for the
|
|
7
|
+
specified model version. Prepares both JSON-style model parameters and corresponding
|
|
8
|
+
metadata for submission.
|
|
7
9
|
|
|
8
10
|
Command line arguments
|
|
9
11
|
----------------------
|
|
@@ -19,7 +21,7 @@ r"""
|
|
|
19
21
|
Example
|
|
20
22
|
-------
|
|
21
23
|
|
|
22
|
-
Submit a new array layout dictionary:
|
|
24
|
+
Submit and validate a new array layout dictionary:
|
|
23
25
|
|
|
24
26
|
.. code-block:: console
|
|
25
27
|
|
|
@@ -73,10 +75,10 @@ def main():
|
|
|
73
75
|
"""Submit and validate array layouts."""
|
|
74
76
|
app_context = startup_application(_parse)
|
|
75
77
|
|
|
76
|
-
db = db_handler.DatabaseHandler(
|
|
78
|
+
db = db_handler.DatabaseHandler(db_config=app_context.db_config)
|
|
77
79
|
|
|
78
80
|
array_layouts = validate_array_layouts_with_db(
|
|
79
|
-
production_table=db.
|
|
81
|
+
production_table=db.read_production_table_from_db(
|
|
80
82
|
collection_name="telescopes", model_version=app_context.args["model_version"]
|
|
81
83
|
),
|
|
82
84
|
array_layouts=ascii_handler.collect_data_from_file(app_context.args["array_layouts"]),
|
|
@@ -92,7 +92,7 @@ def main():
|
|
|
92
92
|
tel_model = TelescopeModel(
|
|
93
93
|
site=app_context.args["site"],
|
|
94
94
|
telescope_name=app_context.args["telescope"],
|
|
95
|
-
|
|
95
|
+
db_config=app_context.db_config,
|
|
96
96
|
model_version=app_context.args["model_version"],
|
|
97
97
|
label=label,
|
|
98
98
|
)
|
|
@@ -136,8 +136,8 @@ def main():
|
|
|
136
136
|
model_version=app_context.args["model_version"],
|
|
137
137
|
)
|
|
138
138
|
|
|
139
|
-
if app_context.args.get("
|
|
140
|
-
tel_model.
|
|
139
|
+
if app_context.args.get("overwrite_model_parameters"):
|
|
140
|
+
tel_model.overwrite_parameters_from_file(app_context.args["overwrite_model_parameters"])
|
|
141
141
|
|
|
142
142
|
ray = RayTracing(
|
|
143
143
|
telescope_model=tel_model,
|