gammasimtools 0.9.0__py3-none-any.whl → 0.11.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.9.0.dist-info → gammasimtools-0.11.0.dist-info}/METADATA +4 -2
- {gammasimtools-0.9.0.dist-info → gammasimtools-0.11.0.dist-info}/RECORD +133 -117
- {gammasimtools-0.9.0.dist-info → gammasimtools-0.11.0.dist-info}/WHEEL +1 -1
- {gammasimtools-0.9.0.dist-info → gammasimtools-0.11.0.dist-info}/entry_points.txt +6 -1
- simtools/_version.py +9 -4
- simtools/applications/calculate_trigger_rate.py +15 -38
- simtools/applications/convert_all_model_parameters_from_simtel.py +9 -29
- simtools/applications/convert_geo_coordinates_of_array_elements.py +47 -45
- simtools/applications/convert_model_parameter_from_simtel.py +2 -3
- simtools/applications/db_add_file_to_db.py +1 -3
- simtools/applications/db_add_simulation_model_from_repository_to_db.py +110 -0
- simtools/applications/db_add_value_from_json_to_db.py +1 -2
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +6 -6
- simtools/applications/db_get_file_from_db.py +11 -12
- simtools/applications/db_get_parameter_from_db.py +26 -35
- simtools/applications/derive_mirror_rnda.py +1 -2
- simtools/applications/derive_photon_electron_spectrum.py +99 -0
- simtools/applications/derive_psf_parameters.py +1 -0
- simtools/applications/docs_produce_array_element_report.py +71 -0
- simtools/applications/docs_produce_model_parameter_reports.py +63 -0
- simtools/applications/generate_array_config.py +17 -17
- simtools/applications/generate_corsika_histograms.py +2 -2
- simtools/applications/generate_regular_arrays.py +19 -17
- simtools/applications/generate_simtel_array_histograms.py +11 -48
- simtools/applications/production_derive_limits.py +95 -0
- simtools/applications/production_generate_simulation_config.py +37 -33
- simtools/applications/production_scale_events.py +4 -9
- simtools/applications/run_application.py +165 -0
- simtools/applications/simulate_light_emission.py +0 -4
- simtools/applications/simulate_prod.py +1 -1
- simtools/applications/simulate_prod_htcondor_generator.py +26 -26
- simtools/applications/submit_data_from_external.py +12 -4
- simtools/applications/submit_model_parameter_from_external.py +18 -11
- simtools/applications/validate_camera_efficiency.py +2 -2
- simtools/applications/validate_file_using_schema.py +26 -22
- simtools/camera/single_photon_electron_spectrum.py +168 -0
- simtools/configuration/commandline_parser.py +37 -1
- simtools/configuration/configurator.py +8 -10
- simtools/constants.py +10 -3
- simtools/corsika/corsika_config.py +19 -17
- simtools/corsika/corsika_histograms.py +5 -7
- simtools/corsika/corsika_histograms_visualize.py +2 -4
- simtools/data_model/data_reader.py +0 -3
- simtools/data_model/metadata_collector.py +20 -12
- simtools/data_model/metadata_model.py +8 -124
- simtools/data_model/model_data_writer.py +81 -75
- simtools/data_model/schema.py +220 -0
- simtools/data_model/validate_data.py +79 -68
- simtools/db/db_handler.py +350 -492
- simtools/db/db_model_upload.py +139 -0
- simtools/dependencies.py +112 -0
- simtools/io_operations/hdf5_handler.py +54 -24
- simtools/layout/array_layout.py +38 -32
- simtools/model/array_model.py +13 -7
- simtools/model/model_parameter.py +55 -54
- simtools/model/site_model.py +2 -2
- simtools/production_configuration/calculate_statistical_errors_grid_point.py +119 -145
- simtools/production_configuration/event_scaler.py +9 -35
- simtools/production_configuration/generate_simulation_config.py +9 -44
- simtools/production_configuration/interpolation_handler.py +9 -15
- simtools/production_configuration/limits_calculation.py +202 -0
- simtools/reporting/docs_read_parameters.py +310 -0
- simtools/runners/corsika_simtel_runner.py +4 -4
- simtools/schemas/{integration_tests_config.metaschema.yml → application_workflow.metaschema.yml} +61 -27
- simtools/schemas/array_elements.yml +8 -0
- simtools/schemas/input/MST_mirror_2f_measurements.schema.yml +39 -0
- simtools/schemas/input/single_pe_spectrum.schema.yml +38 -0
- simtools/schemas/model_parameter.metaschema.yml +103 -2
- simtools/schemas/model_parameter_and_data_schema.metaschema.yml +4 -1
- simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
- simtools/schemas/model_parameters/array_window.schema.yml +37 -0
- simtools/schemas/model_parameters/asum_clipping.schema.yml +0 -4
- simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
- simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
- simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +2 -0
- simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +2 -0
- simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +2 -0
- simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +4 -2
- simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +2 -0
- simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +2 -0
- simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +2 -0
- simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +2 -0
- simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +2 -0
- simtools/schemas/model_parameters/dsum_clipping.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_offset.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_pedsub.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_prescale.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_presum_max.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_shaping.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_threshold.schema.yml +0 -2
- simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +0 -2
- simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
- simtools/schemas/model_parameters/fadc_noise.schema.yml +3 -3
- simtools/schemas/model_parameters/fake_mirror_list.schema.yml +33 -0
- simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
- simtools/schemas/model_parameters/laser_photons.schema.yml +2 -2
- simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
- simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
- simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
- simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
- simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
- simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
- simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
- simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
- simtools/schemas/production_configuration_metrics.schema.yml +68 -0
- simtools/schemas/production_tables.schema.yml +41 -0
- simtools/simtel/simtel_config_reader.py +1 -2
- simtools/simtel/simtel_config_writer.py +6 -8
- simtools/simtel/simtel_io_histogram.py +32 -68
- simtools/simtel/simtel_io_histograms.py +17 -34
- simtools/simtel/simulator_array.py +2 -1
- simtools/simtel/simulator_camera_efficiency.py +6 -3
- simtools/simtel/simulator_light_emission.py +5 -6
- simtools/simtel/simulator_ray_tracing.py +3 -4
- simtools/testing/configuration.py +2 -1
- simtools/testing/helpers.py +6 -13
- simtools/testing/validate_output.py +141 -47
- simtools/utils/general.py +114 -14
- simtools/utils/names.py +299 -157
- simtools/utils/value_conversion.py +17 -13
- simtools/version.py +2 -2
- simtools/visualization/legend_handlers.py +2 -0
- simtools/applications/db_add_model_parameters_from_repository_to_db.py +0 -176
- simtools/db/db_array_elements.py +0 -130
- {gammasimtools-0.9.0.dist-info → gammasimtools-0.11.0.dist-info}/LICENSE +0 -0
- {gammasimtools-0.9.0.dist-info → gammasimtools-0.11.0.dist-info}/top_level.txt +0 -0
- /simtools/{camera_efficiency.py → camera/camera_efficiency.py} +0 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
#!/usr/bin/python3
|
|
2
|
+
|
|
3
|
+
r"""Class to read and manage relevant model parameters for a given telescope model."""
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
import textwrap
|
|
7
|
+
from itertools import groupby
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from simtools.io_operations import io_handler
|
|
11
|
+
from simtools.model.telescope_model import TelescopeModel
|
|
12
|
+
from simtools.utils import names
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ReadParameters:
|
|
18
|
+
"""Read and manage model parameter data."""
|
|
19
|
+
|
|
20
|
+
def __init__(self, db_config, telescope_model, output_path):
|
|
21
|
+
"""Initialise class with a telescope model."""
|
|
22
|
+
self._logger = logging.getLogger(__name__)
|
|
23
|
+
self.db_config = db_config
|
|
24
|
+
self.telescope_model = telescope_model
|
|
25
|
+
self.output_path = output_path
|
|
26
|
+
|
|
27
|
+
def _convert_to_md(self, input_file):
|
|
28
|
+
"""
|
|
29
|
+
Convert a '.dat' or '.ecsv' file to a Markdown file, preserving formatting.
|
|
30
|
+
|
|
31
|
+
Parameters
|
|
32
|
+
----------
|
|
33
|
+
input_file: Path, str
|
|
34
|
+
Simulation data file (in '.dat' or '.ecsv' format).
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
-------
|
|
38
|
+
- Path to the created Markdown file.
|
|
39
|
+
"""
|
|
40
|
+
input_file = Path(input_file)
|
|
41
|
+
output_data_path = Path(self.output_path / "_data_files")
|
|
42
|
+
output_data_path.mkdir(parents=True, exist_ok=True)
|
|
43
|
+
output_file_name = Path(input_file.stem + ".md")
|
|
44
|
+
output_file = output_data_path / output_file_name
|
|
45
|
+
|
|
46
|
+
try:
|
|
47
|
+
with (
|
|
48
|
+
input_file.open("r", encoding="utf-8") as infile,
|
|
49
|
+
output_file.open("w", encoding="utf-8") as outfile,
|
|
50
|
+
):
|
|
51
|
+
outfile.write(f"# {input_file.stem}")
|
|
52
|
+
outfile.write("\n")
|
|
53
|
+
outfile.write("```")
|
|
54
|
+
outfile.write("\n")
|
|
55
|
+
file_contents = infile.read()
|
|
56
|
+
outfile.write(file_contents)
|
|
57
|
+
outfile.write("\n")
|
|
58
|
+
outfile.write("```")
|
|
59
|
+
|
|
60
|
+
except FileNotFoundError as exc:
|
|
61
|
+
logger.exception(f"Data file not found: {input_file}.")
|
|
62
|
+
raise FileNotFoundError(f"Data file not found: {input_file}.") from exc
|
|
63
|
+
|
|
64
|
+
return f"_data_files/{output_file_name}"
|
|
65
|
+
|
|
66
|
+
def get_all_parameter_descriptions(self):
|
|
67
|
+
"""
|
|
68
|
+
Get descriptions for all model parameters.
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
-------
|
|
72
|
+
tuple: A tuple containing two dictionaries:
|
|
73
|
+
- parameter_description: Maps parameter names to their descriptions.
|
|
74
|
+
- short_description: Maps parameter names to their short descriptions.
|
|
75
|
+
- inst_class: Maps parameter names to their respective class.
|
|
76
|
+
"""
|
|
77
|
+
parameter_description, short_description, inst_class = {}, {}, {}
|
|
78
|
+
|
|
79
|
+
for instrument_class in names.db_collection_to_instrument_class_key("telescopes"):
|
|
80
|
+
for parameter, details in names.model_parameters(instrument_class).items():
|
|
81
|
+
parameter_description[parameter] = details.get("description")
|
|
82
|
+
short_description[parameter] = details.get("short_description")
|
|
83
|
+
inst_class[parameter] = instrument_class
|
|
84
|
+
|
|
85
|
+
return parameter_description, short_description, inst_class
|
|
86
|
+
|
|
87
|
+
def get_array_element_parameter_data(self, telescope_model, collection="telescopes"):
|
|
88
|
+
"""
|
|
89
|
+
Get model parameter data for a given array element.
|
|
90
|
+
|
|
91
|
+
Currently only configures for telescope.
|
|
92
|
+
|
|
93
|
+
Parameters
|
|
94
|
+
----------
|
|
95
|
+
telescope_model : TelescopeModel
|
|
96
|
+
The telescope model instance.
|
|
97
|
+
|
|
98
|
+
Returns
|
|
99
|
+
-------
|
|
100
|
+
list: A list of lists containing parameter names, values with units,
|
|
101
|
+
descriptions, and short descriptions.
|
|
102
|
+
"""
|
|
103
|
+
all_params = telescope_model.db.get_model_parameters(
|
|
104
|
+
site=telescope_model.site,
|
|
105
|
+
array_element_name=telescope_model.name,
|
|
106
|
+
collection=collection,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
telescope_model.export_model_files()
|
|
110
|
+
parameter_descriptions = self.get_all_parameter_descriptions()
|
|
111
|
+
data = []
|
|
112
|
+
|
|
113
|
+
for parameter in all_params:
|
|
114
|
+
if all_params[parameter]["instrument"] != telescope_model.name:
|
|
115
|
+
continue
|
|
116
|
+
parameter_version = telescope_model.get_parameter_version(parameter)
|
|
117
|
+
value = telescope_model.get_parameter_value_with_unit(parameter)
|
|
118
|
+
if telescope_model.get_parameter_file_flag(parameter) and value:
|
|
119
|
+
input_file_name = telescope_model.config_file_directory / Path(value)
|
|
120
|
+
output_file_name = self._convert_to_md(input_file_name)
|
|
121
|
+
value = f"[{Path(value).name}]({output_file_name})"
|
|
122
|
+
elif isinstance(value, list):
|
|
123
|
+
value = ", ".join(str(q) for q in value)
|
|
124
|
+
else:
|
|
125
|
+
value = str(value)
|
|
126
|
+
|
|
127
|
+
description = parameter_descriptions[0].get(parameter)
|
|
128
|
+
short_description = parameter_descriptions[1].get(parameter, description)
|
|
129
|
+
inst_class = parameter_descriptions[2].get(parameter)
|
|
130
|
+
data.append(
|
|
131
|
+
[
|
|
132
|
+
inst_class,
|
|
133
|
+
parameter,
|
|
134
|
+
parameter_version,
|
|
135
|
+
value,
|
|
136
|
+
description,
|
|
137
|
+
short_description,
|
|
138
|
+
]
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
return data
|
|
142
|
+
|
|
143
|
+
def _compare_parameter_across_versions(self, parameter_name):
|
|
144
|
+
"""
|
|
145
|
+
Compare a parameter's value across different model versions.
|
|
146
|
+
|
|
147
|
+
Parameters
|
|
148
|
+
----------
|
|
149
|
+
parameter_name : str
|
|
150
|
+
The name of the parameter to compare.
|
|
151
|
+
|
|
152
|
+
Returns
|
|
153
|
+
-------
|
|
154
|
+
list
|
|
155
|
+
A list of dictionaries containing model version, parameter value, and description.
|
|
156
|
+
"""
|
|
157
|
+
all_versions = self.telescope_model.db.get_model_versions()
|
|
158
|
+
all_versions.reverse()
|
|
159
|
+
comparison_data = []
|
|
160
|
+
|
|
161
|
+
for model_version in all_versions:
|
|
162
|
+
telescope_model = TelescopeModel(
|
|
163
|
+
site=self.telescope_model.site,
|
|
164
|
+
telescope_name=self.telescope_model.name,
|
|
165
|
+
model_version=model_version,
|
|
166
|
+
label="reports",
|
|
167
|
+
mongo_db_config=self.db_config,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
if not telescope_model.has_parameter(parameter_name):
|
|
171
|
+
return comparison_data
|
|
172
|
+
|
|
173
|
+
parameter_data = self.get_array_element_parameter_data(telescope_model)
|
|
174
|
+
for param in parameter_data:
|
|
175
|
+
if param[1] == parameter_name:
|
|
176
|
+
comparison_data.append(
|
|
177
|
+
{
|
|
178
|
+
"model_version": model_version,
|
|
179
|
+
"parameter_version": param[2],
|
|
180
|
+
"value": param[3],
|
|
181
|
+
"description": param[4],
|
|
182
|
+
}
|
|
183
|
+
)
|
|
184
|
+
break
|
|
185
|
+
return comparison_data
|
|
186
|
+
|
|
187
|
+
def produce_array_element_report(self):
|
|
188
|
+
"""
|
|
189
|
+
Produce a markdown report of all model parameters per array element.
|
|
190
|
+
|
|
191
|
+
Output
|
|
192
|
+
----------
|
|
193
|
+
One markdown report of a given array element listing parameter values,
|
|
194
|
+
versions, and descriptions.
|
|
195
|
+
"""
|
|
196
|
+
output_filename = Path(self.output_path / (self.telescope_model.name + ".md"))
|
|
197
|
+
output_filename.parent.mkdir(parents=True, exist_ok=True)
|
|
198
|
+
data = self.get_array_element_parameter_data(self.telescope_model)
|
|
199
|
+
# Sort data by class to prepare for grouping
|
|
200
|
+
if not isinstance(data, str):
|
|
201
|
+
data.sort(key=lambda x: (x[0], x[1]), reverse=True)
|
|
202
|
+
|
|
203
|
+
with output_filename.open("w", encoding="utf-8") as file:
|
|
204
|
+
# Group by class and write sections
|
|
205
|
+
file.write(f"# {self.telescope_model.name}\n")
|
|
206
|
+
|
|
207
|
+
if self.telescope_model.name != self.telescope_model.design_model:
|
|
208
|
+
file.write(
|
|
209
|
+
"The design model can be found here: "
|
|
210
|
+
f"[{self.telescope_model.design_model}]"
|
|
211
|
+
f"({self.telescope_model.design_model}.md).\n"
|
|
212
|
+
)
|
|
213
|
+
file.write("\n\n")
|
|
214
|
+
|
|
215
|
+
for class_name, group in groupby(data, key=lambda x: x[0]):
|
|
216
|
+
group = sorted(group, key=lambda x: x[1])
|
|
217
|
+
file.write(f"## {class_name}\n\n")
|
|
218
|
+
|
|
219
|
+
# Write table header and separator row
|
|
220
|
+
file.write(
|
|
221
|
+
"| Parameter Name | Parameter Version "
|
|
222
|
+
"| Values | Short Description |\n"
|
|
223
|
+
"|---------------------|------------------------"
|
|
224
|
+
"|-------------|-----------------------------|\n"
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
# Write table rows
|
|
228
|
+
column_widths = [20, 20, 20, 70]
|
|
229
|
+
for (
|
|
230
|
+
_,
|
|
231
|
+
parameter_name,
|
|
232
|
+
parameter_version,
|
|
233
|
+
value,
|
|
234
|
+
description,
|
|
235
|
+
short_description,
|
|
236
|
+
) in group:
|
|
237
|
+
text = short_description if short_description else description
|
|
238
|
+
wrapped_text = textwrap.fill(str(text), column_widths[3]).split("\n")
|
|
239
|
+
wrapped_text = " ".join(wrapped_text)
|
|
240
|
+
file.write(
|
|
241
|
+
f"| {parameter_name:{column_widths[0]}} |"
|
|
242
|
+
f" {parameter_version:{column_widths[1]}} |"
|
|
243
|
+
f" {value:{column_widths[2]}} |"
|
|
244
|
+
f" {wrapped_text} |\n"
|
|
245
|
+
)
|
|
246
|
+
file.write("\n\n")
|
|
247
|
+
|
|
248
|
+
def produce_model_parameter_reports(self):
|
|
249
|
+
"""
|
|
250
|
+
Produce a markdown report per parameter for a given array element.
|
|
251
|
+
|
|
252
|
+
Output
|
|
253
|
+
----------
|
|
254
|
+
One markdown report per model parameter of a given array element comparing
|
|
255
|
+
values across model versions.
|
|
256
|
+
"""
|
|
257
|
+
logger.info(
|
|
258
|
+
f"Comparing parameters across model versions for Telescope: {self.telescope_model.name}"
|
|
259
|
+
f" and Site: {self.telescope_model.site}."
|
|
260
|
+
)
|
|
261
|
+
io_handler_instance = io_handler.IOHandler()
|
|
262
|
+
output_path = io_handler_instance.get_output_directory(
|
|
263
|
+
label="reports", sub_dir=f"parameters/{self.telescope_model.name}"
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
all_params = self.telescope_model.db.get_model_parameters(
|
|
267
|
+
site=self.telescope_model.site,
|
|
268
|
+
array_element_name=self.telescope_model.name,
|
|
269
|
+
collection="telescopes",
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
for parameter in all_params:
|
|
273
|
+
comparison_data = []
|
|
274
|
+
if all_params[parameter]["instrument"] == self.telescope_model.name:
|
|
275
|
+
comparison_data = self._compare_parameter_across_versions(parameter)
|
|
276
|
+
if comparison_data:
|
|
277
|
+
output_filename = output_path / f"{parameter}.md"
|
|
278
|
+
with output_filename.open("w", encoding="utf-8") as file:
|
|
279
|
+
# Write header
|
|
280
|
+
file.write(
|
|
281
|
+
f"# {parameter}\n\n"
|
|
282
|
+
f"**Telescope**: {self.telescope_model.name}\n\n"
|
|
283
|
+
f"**Description**: {comparison_data[0]['description']}\n\n"
|
|
284
|
+
"\n"
|
|
285
|
+
)
|
|
286
|
+
|
|
287
|
+
# Write table header
|
|
288
|
+
file.write(
|
|
289
|
+
"| Model Version | Parameter Version "
|
|
290
|
+
"| Value |\n"
|
|
291
|
+
"|--------------------|------------------------"
|
|
292
|
+
"|----------------------|\n"
|
|
293
|
+
)
|
|
294
|
+
|
|
295
|
+
# Write table rows
|
|
296
|
+
for item in comparison_data:
|
|
297
|
+
file.write(
|
|
298
|
+
f"| {item['model_version']} |"
|
|
299
|
+
f" {item['parameter_version']} |"
|
|
300
|
+
f"{item['value'].replace('](', '](../')} |\n"
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
file.write("\n")
|
|
304
|
+
if isinstance(comparison_data[0]["value"], str) and comparison_data[0][
|
|
305
|
+
"value"
|
|
306
|
+
].endswith(".md)"):
|
|
307
|
+
file.write(
|
|
308
|
+
f""
|
|
310
|
+
)
|
|
@@ -6,6 +6,7 @@ from pathlib import Path
|
|
|
6
6
|
|
|
7
7
|
from simtools.runners.corsika_runner import CorsikaRunner
|
|
8
8
|
from simtools.simtel.simulator_array import SimulatorArray
|
|
9
|
+
from simtools.utils.general import clear_default_sim_telarray_cfg_directories
|
|
9
10
|
|
|
10
11
|
__all__ = ["CorsikaSimtelRunner"]
|
|
11
12
|
|
|
@@ -128,9 +129,7 @@ class CorsikaSimtelRunner:
|
|
|
128
129
|
)
|
|
129
130
|
with open(multipipe_script, "w", encoding="utf-8") as file:
|
|
130
131
|
multipipe_command = Path(self._simtel_path).joinpath(
|
|
131
|
-
"sim_telarray/bin/multipipe_corsika "
|
|
132
|
-
f"-c {multipipe_file}"
|
|
133
|
-
" || echo 'Fan-out failed'"
|
|
132
|
+
f"sim_telarray/bin/multipipe_corsika -c {multipipe_file} || echo 'Fan-out failed'"
|
|
134
133
|
)
|
|
135
134
|
file.write(f"{multipipe_command}")
|
|
136
135
|
|
|
@@ -197,7 +196,8 @@ class CorsikaSimtelRunner:
|
|
|
197
196
|
)
|
|
198
197
|
command += f" | gzip > {_log_file} 2>&1 || exit"
|
|
199
198
|
|
|
200
|
-
|
|
199
|
+
# Remove the default sim_telarray configuration directories
|
|
200
|
+
return clear_default_sim_telarray_cfg_directories(command)
|
|
201
201
|
|
|
202
202
|
def get_file_name(self, simulation_software=None, file_type=None, run_number=None, mode=None):
|
|
203
203
|
"""
|
simtools/schemas/{integration_tests_config.metaschema.yml → application_workflow.metaschema.yml}
RENAMED
|
@@ -1,50 +1,74 @@
|
|
|
1
1
|
---
|
|
2
2
|
$schema: http://json-schema.org/draft-06/schema#
|
|
3
|
-
$ref: '#/definitions/
|
|
4
|
-
title: SimPipe
|
|
5
|
-
description: YAML representation of
|
|
6
|
-
version: 0.
|
|
7
|
-
name:
|
|
3
|
+
$ref: '#/definitions/SimtoolsApplicationWorkflowConfiguration'
|
|
4
|
+
title: SimPipe application workflow configuration metaschema
|
|
5
|
+
description: YAML representation of application workflow configuration metaschema
|
|
6
|
+
version: 0.3.0
|
|
7
|
+
name: application_workflow.metaschema
|
|
8
8
|
type: object
|
|
9
9
|
additionalProperties: false
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
definitions:
|
|
13
|
-
|
|
12
|
+
SimtoolsApplicationWorkflowConfiguration:
|
|
14
13
|
type: object
|
|
15
14
|
additionalProperties: false
|
|
16
15
|
properties:
|
|
17
16
|
CTA_SIMPIPE:
|
|
18
17
|
"$ref": "#/definitions/CTASIMPIPE"
|
|
18
|
+
SCHEMA_VERSION:
|
|
19
|
+
type: string
|
|
20
|
+
description: "Version of the schema."
|
|
21
|
+
SCHEMA_URL:
|
|
22
|
+
type: string
|
|
23
|
+
format: uri
|
|
24
|
+
description: "URL of the schema."
|
|
25
|
+
SCHEMA_NAME:
|
|
26
|
+
type: string
|
|
27
|
+
description: "Name of the schema."
|
|
19
28
|
required:
|
|
20
29
|
- CTA_SIMPIPE
|
|
30
|
+
- SCHEMA_VERSION
|
|
31
|
+
- SCHEMA_NAME
|
|
21
32
|
title: ""
|
|
22
33
|
CTASIMPIPE:
|
|
23
34
|
type: object
|
|
24
35
|
additionalProperties: false
|
|
25
36
|
properties:
|
|
26
|
-
|
|
37
|
+
LOG_PATH:
|
|
27
38
|
type: string
|
|
28
|
-
description: "
|
|
29
|
-
|
|
30
|
-
type: string
|
|
31
|
-
description: "Test name. Should be unique for this application."
|
|
32
|
-
MODEL_VERSION_USE_CURRENT:
|
|
33
|
-
type: boolean
|
|
34
|
-
description: |
|
|
35
|
-
"Skip test if model version is changed via command line.
|
|
36
|
-
Important e.g., for cases where DB model is incomplete for some
|
|
37
|
-
model versions."
|
|
38
|
-
CONFIGURATION:
|
|
39
|
-
"$ref": "#/definitions/Configuration"
|
|
40
|
-
INTEGRATION_TESTS:
|
|
39
|
+
description: "Path to the log file."
|
|
40
|
+
APPLICATIONS:
|
|
41
41
|
type: array
|
|
42
42
|
items:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
type: object
|
|
44
|
+
properties:
|
|
45
|
+
APPLICATION:
|
|
46
|
+
type: string
|
|
47
|
+
description: "Name of simtools application"
|
|
48
|
+
TEST_NAME:
|
|
49
|
+
type: string
|
|
50
|
+
description: "Test name. Should be unique for this application."
|
|
51
|
+
MODEL_VERSION_USE_CURRENT:
|
|
52
|
+
type: boolean
|
|
53
|
+
description: |
|
|
54
|
+
"Skip test if model version is changed via command line.
|
|
55
|
+
Important e.g., for cases where DB model is incomplete for some
|
|
56
|
+
model versions."
|
|
57
|
+
CONFIGURATION:
|
|
58
|
+
"$ref": "#/definitions/Configuration"
|
|
59
|
+
INTEGRATION_TESTS:
|
|
60
|
+
type: array
|
|
61
|
+
items:
|
|
62
|
+
"$ref": "#/definitions/IntegrationTest"
|
|
63
|
+
TEST_REQUIREMENT:
|
|
64
|
+
type: string
|
|
65
|
+
description: "Requirement ID of the test."
|
|
66
|
+
TEST_USE_CASE:
|
|
67
|
+
type: string
|
|
68
|
+
description: "Use case ID of the test."
|
|
69
|
+
required:
|
|
70
|
+
- APPLICATION
|
|
71
|
+
- CONFIGURATION
|
|
48
72
|
title: CTASimpipe
|
|
49
73
|
Configuration:
|
|
50
74
|
description: "Command line configuration of simtools application."
|
|
@@ -82,6 +106,16 @@ definitions:
|
|
|
82
106
|
description: |
|
|
83
107
|
"Reference file used for comparison."
|
|
84
108
|
type: string
|
|
109
|
+
TEST_SIMTEL_CFG_FILES:
|
|
110
|
+
description: |
|
|
111
|
+
"Reference file used for comparison of sim_telarray configuration files."
|
|
112
|
+
type: object
|
|
113
|
+
additionalProperties: false
|
|
114
|
+
patternProperties:
|
|
115
|
+
"^[0-9]+\\.[0-9]+\\.[0-9]+$": # Semantic versioning pattern (e.g., "5.0.0", "6.0.0")
|
|
116
|
+
type: string
|
|
117
|
+
description: Path to the configuration file for the given version.
|
|
118
|
+
minProperties: 1
|
|
85
119
|
TOLERANCE:
|
|
86
120
|
description: "Allowed tolerance for floating point comparison."
|
|
87
121
|
type: number
|
|
@@ -100,4 +134,4 @@ definitions:
|
|
|
100
134
|
CUT_CONDITION:
|
|
101
135
|
description: "Condition to apply to the cut column."
|
|
102
136
|
type: string
|
|
103
|
-
title:
|
|
137
|
+
title: ApplicationWorkflow
|
|
@@ -15,6 +15,7 @@ data:
|
|
|
15
15
|
collection: "telescopes"
|
|
16
16
|
observatory: "CTAO"
|
|
17
17
|
site: "North"
|
|
18
|
+
design_types: ["FlashCam", "NectarCam", "test"]
|
|
18
19
|
LSTS:
|
|
19
20
|
collection: "telescopes"
|
|
20
21
|
observatory: "CTAO"
|
|
@@ -23,6 +24,7 @@ data:
|
|
|
23
24
|
collection: "telescopes"
|
|
24
25
|
observatory: "CTAO"
|
|
25
26
|
site: "South"
|
|
27
|
+
design_types: ["FlashCam", "NectarCam", "test"]
|
|
26
28
|
SSTS:
|
|
27
29
|
collection: "telescopes"
|
|
28
30
|
observatory: "CTAO"
|
|
@@ -33,6 +35,12 @@ data:
|
|
|
33
35
|
observatory: "CTAO"
|
|
34
36
|
site: "South"
|
|
35
37
|
description: "Mid-sized Schwarzschild-Couder telescope"
|
|
38
|
+
MSTx:
|
|
39
|
+
collection: "telescopes"
|
|
40
|
+
observatory: "CTAO"
|
|
41
|
+
site: ["North", "South"]
|
|
42
|
+
design_types: ["FlashCam", "NectarCam", "test"]
|
|
43
|
+
description: "Mid-sized telescope"
|
|
36
44
|
ILLN:
|
|
37
45
|
collection: "calibration_devices"
|
|
38
46
|
observatory: "CTAO"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
%YAML 1.2
|
|
2
|
+
---
|
|
3
|
+
title: Schema for mirror panel 2F measurements
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
meta_schema: simpipe-schema
|
|
6
|
+
meta_schema_url: https://raw.githubusercontent.com/gammasim/simtools/main/src/simtools/schemas/model_parameter_and_data_schema.metaschema.yml
|
|
7
|
+
meta_schema_version: 0.1.0
|
|
8
|
+
name: mirror_2f_measurement
|
|
9
|
+
description: |-
|
|
10
|
+
Mirror panel 2F measurements determining
|
|
11
|
+
panel radius and panel PSF.
|
|
12
|
+
data:
|
|
13
|
+
- type: data_table
|
|
14
|
+
table_columns:
|
|
15
|
+
- name: mirror_panel_id
|
|
16
|
+
description: |-
|
|
17
|
+
Mirror panel ID.
|
|
18
|
+
required: true
|
|
19
|
+
unit: dimensionless
|
|
20
|
+
type: string
|
|
21
|
+
- name: mirror_curvature_radius
|
|
22
|
+
description: |-
|
|
23
|
+
Mirror panel curvature radius.
|
|
24
|
+
required: true
|
|
25
|
+
unit: cm
|
|
26
|
+
type: float64
|
|
27
|
+
- name: psf
|
|
28
|
+
description: |-
|
|
29
|
+
Spot size of mirror panel PSF at nominal distance.
|
|
30
|
+
required: true
|
|
31
|
+
unit: cm
|
|
32
|
+
type: float64
|
|
33
|
+
- name: psf_opt
|
|
34
|
+
description: |-
|
|
35
|
+
Spot size of mirror panel PSF
|
|
36
|
+
(best value, not at nominal distance).
|
|
37
|
+
required: false
|
|
38
|
+
unit: cm
|
|
39
|
+
type: float64
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
%YAML 1.2
|
|
2
|
+
---
|
|
3
|
+
title: Schema for single photon electron spectrum
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
meta_schema: simpipe-schema
|
|
6
|
+
meta_schema_url: https://raw.githubusercontent.com/gammasim/simtools/main/src/simtools/schemas/model_parameter_and_data_schema.metaschema.yml
|
|
7
|
+
meta_schema_version: 0.1.0
|
|
8
|
+
name: single_pe_spectrum
|
|
9
|
+
description: |-
|
|
10
|
+
Single photo-electron response as a function of signal amplitude.
|
|
11
|
+
May include prompt, prompt plus afterpulse, or afterpulse response.
|
|
12
|
+
data:
|
|
13
|
+
- type: data_table
|
|
14
|
+
table_columns:
|
|
15
|
+
- name: amplitude
|
|
16
|
+
description: |-
|
|
17
|
+
Signal amplitude (p.e.)
|
|
18
|
+
required: true
|
|
19
|
+
unit: dimensionless
|
|
20
|
+
type: float64
|
|
21
|
+
- name: frequency (prompt)
|
|
22
|
+
description: |-
|
|
23
|
+
Single photo-electron response (prompt)
|
|
24
|
+
required: false
|
|
25
|
+
unit: dimensionless
|
|
26
|
+
type: float64
|
|
27
|
+
- name: frequency (afterpulsing)
|
|
28
|
+
description: |-
|
|
29
|
+
Single photo-electron response (afterpulsing)
|
|
30
|
+
required: false
|
|
31
|
+
unit: dimensionless
|
|
32
|
+
type: float64
|
|
33
|
+
- name: frequency (prompt+afterpulsing)
|
|
34
|
+
description: |-
|
|
35
|
+
Single photo-electron response (prompt+afterpulsing)
|
|
36
|
+
required: false
|
|
37
|
+
unit: dimensionless
|
|
38
|
+
type: float64
|
|
@@ -5,7 +5,7 @@ title: SimPipe DB Model Parameter Metaschema
|
|
|
5
5
|
description: |
|
|
6
6
|
YAML representation of db model parameter metaschema
|
|
7
7
|
(based on simulation model DB).
|
|
8
|
-
version: 0.
|
|
8
|
+
version: 0.3.0
|
|
9
9
|
name: modelparameter.metaschema
|
|
10
10
|
type: object
|
|
11
11
|
additionalProperties: false
|
|
@@ -25,14 +25,115 @@ definitions:
|
|
|
25
25
|
type: boolean
|
|
26
26
|
description: "This parameter is a file."
|
|
27
27
|
instrument:
|
|
28
|
-
type:
|
|
28
|
+
type:
|
|
29
|
+
- string
|
|
30
|
+
- "null"
|
|
29
31
|
description: "Associated instrument."
|
|
30
32
|
site:
|
|
33
|
+
anyOf:
|
|
34
|
+
- type: string
|
|
35
|
+
enum:
|
|
36
|
+
- North
|
|
37
|
+
- South
|
|
38
|
+
- type: "null"
|
|
39
|
+
- type: array
|
|
40
|
+
items:
|
|
41
|
+
type: string
|
|
42
|
+
enum:
|
|
43
|
+
- North
|
|
44
|
+
- South
|
|
45
|
+
description: "Associated CTAO site."
|
|
46
|
+
type:
|
|
31
47
|
type: string
|
|
48
|
+
description: "Data type"
|
|
49
|
+
enum:
|
|
50
|
+
- boolean
|
|
51
|
+
- dict
|
|
52
|
+
- double
|
|
53
|
+
- file
|
|
54
|
+
- float64
|
|
55
|
+
- int
|
|
56
|
+
- int64
|
|
57
|
+
- string
|
|
58
|
+
- uint
|
|
59
|
+
- uint32
|
|
60
|
+
- uint64
|
|
61
|
+
unit:
|
|
62
|
+
anyOf:
|
|
63
|
+
- type: string
|
|
64
|
+
- type: "null"
|
|
65
|
+
description: "Unit of the parameter."
|
|
66
|
+
value:
|
|
67
|
+
anyOf:
|
|
68
|
+
- type: boolean
|
|
69
|
+
- type: number
|
|
70
|
+
- type: string
|
|
71
|
+
- type: "null"
|
|
72
|
+
- type: array
|
|
73
|
+
description: "Value of the parameter."
|
|
74
|
+
parameter_version:
|
|
75
|
+
anyOf:
|
|
76
|
+
- type: string
|
|
77
|
+
description: "Parameter version."
|
|
78
|
+
schema_version:
|
|
79
|
+
anyOf:
|
|
80
|
+
- type: string
|
|
81
|
+
description: "Metaschema version."
|
|
82
|
+
unique_id:
|
|
83
|
+
anyOf:
|
|
84
|
+
- type: string
|
|
85
|
+
- type: "null"
|
|
86
|
+
description: "Unique ID of parameter definition."
|
|
87
|
+
required:
|
|
88
|
+
- file
|
|
89
|
+
- instrument
|
|
90
|
+
- parameter_version
|
|
91
|
+
- schema_version
|
|
92
|
+
- site
|
|
93
|
+
- type
|
|
94
|
+
- unit
|
|
95
|
+
- value
|
|
96
|
+
...
|
|
97
|
+
---
|
|
98
|
+
$schema: http://json-schema.org/draft-06/schema#
|
|
99
|
+
$ref: '#/definitions/SimtoolsModelParameters'
|
|
100
|
+
title: SimPipe DB Model Parameter Metaschema
|
|
101
|
+
description: |
|
|
102
|
+
YAML representation of db model parameter metaschema
|
|
103
|
+
(based on simulation model DB).
|
|
104
|
+
version: 0.2.0
|
|
105
|
+
name: modelparameter.metaschema
|
|
106
|
+
type: object
|
|
107
|
+
additionalProperties: false
|
|
108
|
+
|
|
109
|
+
definitions:
|
|
110
|
+
SimtoolsModelParameters:
|
|
111
|
+
description: ""
|
|
112
|
+
type: object
|
|
113
|
+
properties:
|
|
114
|
+
_id:
|
|
115
|
+
type: string
|
|
116
|
+
description: "DB unique identifier."
|
|
117
|
+
entry_date:
|
|
118
|
+
type: string
|
|
119
|
+
description: "Value entry date."
|
|
120
|
+
file:
|
|
121
|
+
type: boolean
|
|
122
|
+
description: "This parameter is a file."
|
|
123
|
+
instrument:
|
|
124
|
+
type:
|
|
125
|
+
- string
|
|
126
|
+
- "null"
|
|
127
|
+
description: "Associated instrument."
|
|
128
|
+
site:
|
|
129
|
+
type:
|
|
130
|
+
- string
|
|
131
|
+
- "null"
|
|
32
132
|
description: "Associated CTAO site."
|
|
33
133
|
enum:
|
|
34
134
|
- North
|
|
35
135
|
- South
|
|
136
|
+
- null
|
|
36
137
|
type:
|
|
37
138
|
type: string
|
|
38
139
|
description: "Data type"
|