gammasimtools 0.12.0__py3-none-any.whl → 0.14.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.
Files changed (276) hide show
  1. {gammasimtools-0.12.0.dist-info → gammasimtools-0.14.0.dist-info}/METADATA +3 -3
  2. {gammasimtools-0.12.0.dist-info → gammasimtools-0.14.0.dist-info}/RECORD +257 -263
  3. {gammasimtools-0.12.0.dist-info → gammasimtools-0.14.0.dist-info}/WHEEL +1 -1
  4. {gammasimtools-0.12.0.dist-info → gammasimtools-0.14.0.dist-info}/entry_points.txt +4 -1
  5. simtools/_version.py +2 -2
  6. simtools/applications/convert_all_model_parameters_from_simtel.py +77 -88
  7. simtools/applications/convert_geo_coordinates_of_array_elements.py +1 -1
  8. simtools/applications/db_add_file_to_db.py +15 -0
  9. simtools/applications/db_add_value_from_json_to_db.py +18 -1
  10. simtools/applications/db_get_parameter_from_db.py +52 -22
  11. simtools/applications/derive_ctao_array_layouts.py +120 -0
  12. simtools/applications/derive_photon_electron_spectrum.py +30 -2
  13. simtools/applications/docs_produce_array_element_report.py +42 -26
  14. simtools/applications/docs_produce_model_parameter_reports.py +28 -21
  15. simtools/applications/generate_simtel_event_data.py +117 -0
  16. simtools/applications/plot_tabular_data.py +14 -2
  17. simtools/applications/print_version.py +81 -0
  18. simtools/applications/production_derive_corsika_limits.py +240 -0
  19. simtools/applications/production_scale_events.py +59 -36
  20. simtools/applications/run_application.py +47 -18
  21. simtools/applications/simulate_light_emission.py +115 -247
  22. simtools/applications/simulate_prod_htcondor_generator.py +2 -2
  23. simtools/applications/submit_data_from_external.py +1 -1
  24. simtools/applications/submit_model_parameter_from_external.py +2 -1
  25. simtools/camera/single_photon_electron_spectrum.py +169 -17
  26. simtools/constants.py +7 -0
  27. simtools/data_model/metadata_collector.py +159 -61
  28. simtools/data_model/model_data_writer.py +18 -61
  29. simtools/data_model/schema.py +2 -1
  30. simtools/data_model/validate_data.py +5 -3
  31. simtools/db/db_handler.py +123 -33
  32. simtools/dependencies.py +38 -3
  33. simtools/layout/array_layout.py +1 -0
  34. simtools/layout/ctao_array_layouts.py +172 -0
  35. simtools/model/array_model.py +3 -4
  36. simtools/model/model_parameter.py +30 -118
  37. simtools/production_configuration/derive_corsika_limits.py +328 -0
  38. simtools/production_configuration/event_scaler.py +2 -2
  39. simtools/ray_tracing/mirror_panel_psf.py +1 -1
  40. simtools/reporting/docs_auto_report_generator.py +217 -0
  41. simtools/reporting/docs_read_parameters.py +298 -143
  42. simtools/schemas/application_workflow.metaschema.yml +3 -0
  43. simtools/schemas/metadata.metaschema.yml +7 -6
  44. simtools/schemas/model_parameter.metaschema.yml +13 -4
  45. simtools/schemas/model_parameter_and_data_schema.metaschema.yml +19 -5
  46. simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
  47. simtools/schemas/model_parameters/altitude.schema.yml +1 -1
  48. simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
  49. simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +3 -3
  50. simtools/schemas/model_parameters/array_element_position_ground.schema.yml +3 -3
  51. simtools/schemas/model_parameters/array_element_position_utm.schema.yml +3 -3
  52. simtools/schemas/model_parameters/array_layouts.schema.yml +3 -0
  53. simtools/schemas/model_parameters/array_window.schema.yml +1 -1
  54. simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
  55. simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
  56. simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
  57. simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
  58. simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
  59. simtools/schemas/model_parameters/axes_offsets.schema.yml +2 -2
  60. simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
  61. simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
  62. simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
  63. simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
  64. simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
  65. simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
  66. simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
  67. simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
  68. simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
  69. simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
  70. simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
  71. simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
  72. simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
  73. simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
  74. simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
  75. simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
  76. simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
  77. simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
  78. simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
  79. simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
  80. simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
  81. simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
  82. simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
  83. simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
  84. simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
  85. simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
  86. simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
  87. simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
  88. simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
  89. simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
  90. simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
  91. simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
  92. simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
  93. simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
  94. simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
  95. simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
  96. simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
  97. simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
  98. simtools/schemas/model_parameters/dsum_prescale.schema.yml +2 -2
  99. simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
  100. simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
  101. simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
  102. simtools/schemas/model_parameters/dsum_threshold.schema.yml +1 -1
  103. simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
  104. simtools/schemas/model_parameters/effective_focal_length.schema.yml +5 -5
  105. simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
  106. simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
  107. simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
  108. simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
  109. simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +2 -2
  110. simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
  111. simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
  112. simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
  113. simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
  114. simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +2 -2
  115. simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
  116. simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
  117. simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
  118. simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +4 -4
  119. simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
  120. simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
  121. simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
  122. simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
  123. simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
  124. simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
  125. simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
  126. simtools/schemas/model_parameters/fadc_max_sum.schema.yml +4 -4
  127. simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
  128. simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
  129. simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
  130. simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
  131. simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
  132. simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
  133. simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
  134. simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
  135. simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
  136. simtools/schemas/model_parameters/fake_mirror_list.schema.yml +1 -1
  137. simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
  138. simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +20 -20
  139. simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
  140. simtools/schemas/model_parameters/focus_offset.schema.yml +4 -4
  141. simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
  142. simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
  143. simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
  144. simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
  145. simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
  146. simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
  147. simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
  148. simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
  149. simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
  150. simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
  151. simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
  152. simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
  153. simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
  154. simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
  155. simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
  156. simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
  157. simtools/schemas/model_parameters/led_events.schema.yml +1 -1
  158. simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
  159. simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
  160. simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
  161. simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
  162. simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
  163. simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +1 -1
  164. simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
  165. simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
  166. simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
  167. simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +4 -4
  168. simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +4 -4
  169. simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
  170. simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
  171. simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
  172. simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
  173. simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
  174. simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +3 -3
  175. simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +3 -3
  176. simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
  177. simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +45 -0
  178. simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +2 -2
  179. simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
  180. simtools/schemas/model_parameters/nsb_offaxis.schema.yml +5 -5
  181. simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
  182. simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +1 -1
  183. simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
  184. simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
  185. simtools/schemas/model_parameters/{nsb_skymap.schema.yml → nsb_sky_map.schema.yml} +1 -1
  186. simtools/schemas/model_parameters/nsb_spectrum.schema.yml +2 -2
  187. simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
  188. simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
  189. simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
  190. simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
  191. simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
  192. simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
  193. simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
  194. simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
  195. simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
  196. simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
  197. simtools/schemas/model_parameters/pm_transit_time.schema.yml +4 -4
  198. simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
  199. simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +8 -4
  200. simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
  201. simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
  202. simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +20 -20
  203. simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
  204. simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
  205. simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
  206. simtools/schemas/model_parameters/random_focal_length.schema.yml +2 -2
  207. simtools/schemas/model_parameters/random_mono_probability.schema.yml +38 -0
  208. simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
  209. simtools/schemas/model_parameters/reference_point_latitude.schema.yml +4 -1
  210. simtools/schemas/model_parameters/reference_point_longitude.schema.yml +4 -1
  211. simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
  212. simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
  213. simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +5 -5
  214. simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
  215. simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
  216. simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
  217. simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
  218. simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +20 -20
  219. simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
  220. simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
  221. simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
  222. simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
  223. simtools/schemas/model_parameters/stars.schema.yml +36 -0
  224. simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
  225. simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
  226. simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
  227. simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
  228. simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
  229. simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
  230. simtools/schemas/model_parameters/telescope_transmission.schema.yml +6 -6
  231. simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
  232. simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
  233. simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
  234. simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
  235. simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
  236. simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
  237. simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
  238. simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
  239. simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +4 -4
  240. simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
  241. simtools/schemas/plot_configuration.metaschema.yml +162 -0
  242. simtools/schemas/production_tables.schema.yml +1 -1
  243. simtools/simtel/simtel_config_reader.py +85 -34
  244. simtools/simtel/simtel_config_writer.py +70 -38
  245. simtools/simtel/simtel_io_event_reader.py +278 -0
  246. simtools/simtel/simtel_io_event_writer.py +317 -0
  247. simtools/simtel/simtel_table_reader.py +4 -0
  248. simtools/simtel/simulator_light_emission.py +181 -67
  249. simtools/simulator.py +2 -2
  250. simtools/testing/configuration.py +17 -0
  251. simtools/utils/general.py +83 -16
  252. simtools/utils/geometry.py +19 -0
  253. simtools/utils/names.py +14 -3
  254. simtools/visualization/plot_tables.py +25 -20
  255. simtools/visualization/visualize.py +73 -25
  256. simtools/_dev_version/__init__.py +0 -9
  257. simtools/applications/__init__.py +0 -0
  258. simtools/applications/production_derive_limits.py +0 -95
  259. simtools/configuration/__init__.py +0 -0
  260. simtools/corsika/__init__.py +0 -0
  261. simtools/data_model/__init__.py +0 -0
  262. simtools/db/__init__.py +0 -0
  263. simtools/io_operations/__init__.py +0 -0
  264. simtools/job_execution/__init__.py +0 -0
  265. simtools/layout/__init__.py +0 -0
  266. simtools/model/__init__.py +0 -0
  267. simtools/production_configuration/limits_calculation.py +0 -202
  268. simtools/ray_tracing/__init__.py +0 -0
  269. simtools/runners/__init__.py +0 -0
  270. simtools/simtel/__init__.py +0 -0
  271. simtools/simtel/simtel_io_events.py +0 -265
  272. simtools/testing/__init__.py +0 -0
  273. simtools/utils/__init__.py +0 -0
  274. simtools/visualization/__init__.py +0 -0
  275. {gammasimtools-0.12.0.dist-info → gammasimtools-0.14.0.dist-info/licenses}/LICENSE +0 -0
  276. {gammasimtools-0.12.0.dist-info → gammasimtools-0.14.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/python3
2
+
3
+ r"""
4
+ Derive CTAO array layouts definitions using CTAO common identifiers repository.
5
+
6
+ Retrieves the CTAO array layouts definitions from the CTAO common identifiers repository
7
+ and synchronizes them with the model parameter definition in 'array_layouts' for all
8
+ CTAO sites.
9
+
10
+ Requires access to the CTAO common identifiers repository. Future versions of the
11
+ common identifiers might be stored in a CTAO technical database.
12
+
13
+ Command line arguments
14
+ ----------------------
15
+ site (str)
16
+ CTAO site (North or South).
17
+ parameter_version (str)
18
+ Model parameter version.
19
+ repository_url (str)
20
+ URL or path of the CTAO common identifiers repository.
21
+ repository_branch (str )
22
+ Repository branch to use for CTAO common identifiers.
23
+ updated_parameter_version (str)
24
+ Updated parameter version.
25
+
26
+ Example
27
+ -------
28
+
29
+ Derive the CTAO array layouts definitions for the North site using the CTAO common identifiers
30
+ repository. Merge the retrieved array layouts with the model parameter definition in
31
+ 'array_layouts' (in this example for site North and parameter version 2.0.0). Write the
32
+ updated array layouts and metadata using the parameter version indicated by the
33
+ 'updated_parameter_version' argument.
34
+
35
+ .. code-block:: console
36
+
37
+ simtools-derive-ctao-array-layouts --site North \
38
+ --repository_url "https://gitlab.cta-observatory.org/" \
39
+ "cta-computing/common/identifiers/-/raw/" \
40
+ --repository_branch main \
41
+ --site North --parameter_version 2.0.0 \
42
+ --updated_parameter_version 3.0.0
43
+ """
44
+
45
+ import logging
46
+ from pathlib import Path
47
+
48
+ import simtools.utils.general as gen
49
+ from simtools.configuration import configurator
50
+ from simtools.db import db_handler
51
+ from simtools.layout.ctao_array_layouts import (
52
+ merge_array_layouts,
53
+ retrieve_array_layouts,
54
+ write_array_layouts,
55
+ )
56
+
57
+
58
+ def _parse(label):
59
+ """Parse command line configuration."""
60
+ config = configurator.Configurator(
61
+ label=label,
62
+ description="Derive CTAO array layouts from CTAO common identifiers repository.",
63
+ )
64
+ config.parser.add_argument(
65
+ "--repository_url",
66
+ help="URL or path of the CTAO common identifiers repository.",
67
+ type=str,
68
+ default="https://gitlab.cta-observatory.org/cta-computing/common/identifiers/-/raw/",
69
+ )
70
+ config.parser.add_argument(
71
+ "--repository_branch",
72
+ help="Repository branch to use for CTAO common identifiers.",
73
+ type=str,
74
+ default="main",
75
+ required=False,
76
+ )
77
+ config.parser.add_argument(
78
+ "--updated_parameter_version",
79
+ help="Updated parameter version.",
80
+ type=str,
81
+ required=False,
82
+ )
83
+ return config.initialize(
84
+ db_config=True, output=True, simulation_model=["site", "parameter_version", "model_version"]
85
+ )
86
+
87
+
88
+ def main(): # noqa: D103
89
+ args_dict, db_config = _parse(Path(__file__).stem)
90
+
91
+ logger = logging.getLogger()
92
+ logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
93
+
94
+ ctao_array_layouts = retrieve_array_layouts(
95
+ site=args_dict["site"],
96
+ repository_url=args_dict["repository_url"],
97
+ branch_name=args_dict["repository_branch"],
98
+ )
99
+
100
+ db = db_handler.DatabaseHandler(mongo_db_config=db_config)
101
+ db_array_layouts = db.get_model_parameter(
102
+ parameter="array_layouts",
103
+ site=args_dict["site"],
104
+ array_element_name=None,
105
+ parameter_version=args_dict.get("parameter_version"),
106
+ model_version=args_dict.get("model_version"),
107
+ )
108
+ db_array_layouts["array_layouts"].pop("_id", None)
109
+ db_array_layouts["array_layouts"].pop("entry_date", None)
110
+ logger.info(f"Layouts from DB: {db_array_layouts}")
111
+
112
+ write_array_layouts(
113
+ array_layouts=merge_array_layouts(db_array_layouts["array_layouts"], ctao_array_layouts),
114
+ args_dict=args_dict,
115
+ db_config=db_config,
116
+ )
117
+
118
+
119
+ if __name__ == "__main__":
120
+ main()
@@ -69,11 +69,39 @@ def _parse(label):
69
69
  )
70
70
  config.parser.add_argument(
71
71
  "--max_amplitude",
72
- help="Maximum amplitude in amplitude spectrum",
72
+ help="Maximum amplitude for single p.e. for amplitude spectrum",
73
73
  type=float,
74
74
  default=42.0,
75
75
  required=False,
76
76
  )
77
+ config.parser.add_argument(
78
+ "--scale_afterpulse_spectrum",
79
+ help="Scale afterpulse spectrum by the given factor",
80
+ type=float,
81
+ default=1.0,
82
+ required=False,
83
+ )
84
+ config.parser.add_argument(
85
+ "--afterpulse_amplitude_range",
86
+ help="Amplitude range in pe for afterpulse calculation",
87
+ type=float,
88
+ nargs=2,
89
+ default=[0.0, 42.0],
90
+ required=False,
91
+ )
92
+ config.parser.add_argument(
93
+ "--fit_afterpulse",
94
+ help="Fit afterpulse spectrum with an exponential decay function.",
95
+ action="store_true",
96
+ required=False,
97
+ )
98
+ config.parser.add_argument(
99
+ "--afterpulse_decay_factor_fixed_value",
100
+ help="Fix decay factor in afterpulse fit (free fit parameter if not set set).",
101
+ type=float,
102
+ default=15.0,
103
+ required=False,
104
+ )
77
105
  config.parser.add_argument(
78
106
  "--use_norm_spe",
79
107
  help="Use sim_telarray tool 'norm_spe' to normalize the spectrum.",
@@ -81,7 +109,7 @@ def _parse(label):
81
109
  required=False,
82
110
  )
83
111
 
84
- return config.initialize(db_config=False, output=True)
112
+ return config.initialize(db_config=False, output=True, simulation_model=["telescope"])
85
113
 
86
114
 
87
115
  def main(): # noqa: D103
@@ -9,10 +9,11 @@ Currently only implemented for telescopes.
9
9
  """
10
10
 
11
11
  import logging
12
+ from pathlib import Path
12
13
 
13
14
  from simtools.configuration import configurator
14
15
  from simtools.io_operations import io_handler
15
- from simtools.model.telescope_model import TelescopeModel
16
+ from simtools.reporting.docs_auto_report_generator import ReportGenerator
16
17
  from simtools.reporting.docs_read_parameters import ReadParameters
17
18
  from simtools.utils import general as gen
18
19
 
@@ -25,46 +26,61 @@ def _parse(label):
25
26
  )
26
27
 
27
28
  config.parser.add_argument(
28
- "--parameter",
29
+ "--all_telescopes",
29
30
  action="store_true",
30
- help="Compare all parameters across model versions for one telescope.",
31
+ help="Produce reports for all telescopes.",
32
+ )
33
+
34
+ config.parser.add_argument(
35
+ "--all_model_versions",
36
+ action="store_true",
37
+ help="Produce reports for all model versions.",
38
+ )
39
+
40
+ config.parser.add_argument(
41
+ "--all_sites", action="store_true", help="Produce reports for all sites."
42
+ )
43
+
44
+ config.parser.add_argument(
45
+ "--observatory",
46
+ action="store_true",
47
+ help="Produce reports for an observatory at a given site.",
31
48
  )
32
49
 
33
50
  return config.initialize(
34
- db_config=True, simulation_model=["site", "telescope", "model_version", "parameter_version"]
51
+ db_config=True, simulation_model=["site", "telescope", "model_version"]
35
52
  )
36
53
 
37
54
 
38
55
  def main(): # noqa: D103
39
56
  label_name = "reports"
40
57
  args, db_config = _parse(label_name)
58
+
41
59
  io_handler_instance = io_handler.IOHandler()
42
- output_path = io_handler_instance.get_output_directory(
43
- label=label_name, sub_dir=f"productions/{args['model_version']}"
44
- )
60
+ output_path = io_handler_instance.get_output_directory(label=label_name, sub_dir="productions")
45
61
 
46
62
  logger = logging.getLogger()
47
63
  logger.setLevel(gen.get_log_level_from_user(args["log_level"]))
48
64
 
49
- telescope_model = TelescopeModel(
50
- site=args["site"],
51
- telescope_name=args["telescope"],
52
- model_version=args["model_version"],
53
- label=label_name,
54
- mongo_db_config=db_config,
55
- )
56
-
57
- ReadParameters(
58
- db_config,
59
- telescope_model,
60
- output_path,
61
- ).produce_array_element_report()
62
-
63
- logger.info(
64
- f"Markdown report generated for {args['site']}"
65
- f" Telescope {args['telescope']} (v{args['model_version']}):"
66
- f" {output_path}"
67
- )
65
+ if any([args.get("all_telescopes"), args.get("all_sites"), args.get("all_model_versions")]):
66
+ ReportGenerator(
67
+ db_config,
68
+ args,
69
+ output_path,
70
+ ).auto_generate_array_element_reports()
71
+
72
+ else:
73
+ ReadParameters(
74
+ db_config,
75
+ args,
76
+ Path(output_path / f"{args['model_version']}"),
77
+ ).produce_array_element_report()
78
+
79
+ logger.info(
80
+ f"Markdown report generated for {args['site']}"
81
+ f" Telescope {args['telescope']} (v{args['model_version']}):"
82
+ f" {output_path}"
83
+ )
68
84
 
69
85
 
70
86
  if __name__ == "__main__":
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/python3
2
2
 
3
3
  r"""
4
- Produce one file per model parameter for a given array element.
4
+ Produce a model parameter report per array element.
5
5
 
6
6
  The markdown reports include detailed information on each parameter,
7
7
  comparing their values over various model versions.
@@ -12,7 +12,7 @@ import logging
12
12
 
13
13
  from simtools.configuration import configurator
14
14
  from simtools.io_operations import io_handler
15
- from simtools.model.telescope_model import TelescopeModel
15
+ from simtools.reporting.docs_auto_report_generator import ReportGenerator
16
16
  from simtools.reporting.docs_read_parameters import ReadParameters
17
17
  from simtools.utils import general as gen
18
18
 
@@ -24,10 +24,18 @@ def _parse(label):
24
24
  description=("Produce a markdown report for model parameters."),
25
25
  )
26
26
 
27
- return config.initialize(
28
- db_config=True, simulation_model=["site", "telescope", "model_version"]
27
+ config.parser.add_argument(
28
+ "--all_telescopes",
29
+ action="store_true",
30
+ help="Produce reports for all telescopes.",
29
31
  )
30
32
 
33
+ config.parser.add_argument(
34
+ "--all_sites", action="store_true", help="Produce reports for all sites."
35
+ )
36
+
37
+ return config.initialize(db_config=True, simulation_model=["site", "telescope"])
38
+
31
39
 
32
40
  def main(): # noqa: D103
33
41
  label_name = "reports"
@@ -38,25 +46,24 @@ def main(): # noqa: D103
38
46
  logger = logging.getLogger()
39
47
  logger.setLevel(gen.get_log_level_from_user(args["log_level"]))
40
48
 
41
- telescope_model = TelescopeModel(
42
- site=args["site"],
43
- telescope_name=args["telescope"],
44
- model_version=args["model_version"],
45
- label=label_name,
46
- mongo_db_config=db_config,
47
- )
49
+ if any([args.get("all_telescopes"), args.get("all_sites")]):
50
+ ReportGenerator(
51
+ db_config,
52
+ args,
53
+ output_path,
54
+ ).auto_generate_parameter_reports()
48
55
 
49
- ReadParameters(
50
- db_config,
51
- telescope_model,
52
- output_path,
53
- ).produce_model_parameter_reports()
56
+ else:
57
+ ReadParameters(
58
+ db_config,
59
+ args,
60
+ output_path,
61
+ ).produce_model_parameter_reports()
54
62
 
55
- logger.info(
56
- f"Markdown report generated for {args['site']}"
57
- f" Telescope {args['telescope']} (v{args['model_version']}):"
58
- f" {output_path}"
59
- )
63
+ logger.info(
64
+ f"Markdown report generated for {args['site']}"
65
+ f"Telescope {args['telescope']}: {output_path}"
66
+ )
60
67
 
61
68
 
62
69
  if __name__ == "__main__":
@@ -0,0 +1,117 @@
1
+ #!/usr/bin/python3
2
+
3
+ """
4
+ Reduces and compiles event data from multiple input files into a structured dataset with event info.
5
+
6
+ Command line arguments
7
+ ----------------------
8
+ prefix (str, required)
9
+ Path prefix for the input files.
10
+ output_file (str, required)
11
+ Path to save the output file.
12
+ max_files (int, optional, default=100)
13
+ Maximum number of files to process.
14
+ print_dataset_information (flag)
15
+ Print information about the datasets in the generated reduced event dataset.
16
+
17
+ Example
18
+ -------
19
+ Generate a reduced dataset from input files and save the result.
20
+
21
+ .. code-block:: console
22
+
23
+ simtools-production-extract-mc-event-data \
24
+ simtools-generate-simtel-event-data \
25
+ --prefix path/to/input_files/ \
26
+ --wildcard 'gamma_*dark*.simtel.zst' \
27
+ --output_file output_file.hdf5 \
28
+ --max_files 50 \
29
+ --print_dataset_information
30
+ """
31
+
32
+ import logging
33
+ from pathlib import Path
34
+
35
+ import simtools.utils.general as gen
36
+ from simtools.configuration import configurator
37
+ from simtools.io_operations import io_handler
38
+ from simtools.simtel.simtel_io_event_reader import SimtelIOEventDataReader
39
+ from simtools.simtel.simtel_io_event_writer import SimtelIOEventDataWriter
40
+
41
+
42
+ def _parse(label, description):
43
+ """
44
+ Parse command line arguments.
45
+
46
+ Returns
47
+ -------
48
+ dict
49
+ Parsed command-line arguments.
50
+ """
51
+ config = configurator.Configurator(label=label, description=description)
52
+
53
+ config.parser.add_argument(
54
+ "--prefix", type=str, required=True, help="Prefix path for input files."
55
+ )
56
+ config.parser.add_argument(
57
+ "--wildcard",
58
+ type=str,
59
+ required=True,
60
+ help="Wildcard for querying the files in the directory (e.g., 'gamma_*dark*.simtel.zst')",
61
+ )
62
+ config.parser.add_argument("--output_file", type=str, required=True, help="Output filename.")
63
+ config.parser.add_argument(
64
+ "--max_files", type=int, default=100, help="Maximum number of files to process."
65
+ )
66
+
67
+ config.parser.add_argument(
68
+ "--print_dataset_information",
69
+ type=int,
70
+ help="Print given number of rows of the dataset.",
71
+ default=0,
72
+ )
73
+
74
+ return config.initialize(db_config=False)
75
+
76
+
77
+ def main():
78
+ """
79
+ Process event data files and store data in reduced dataset.
80
+
81
+ The reduced dataset contains shower information, array information and triggered telescopes.
82
+ """
83
+ label = Path(__file__).stem
84
+
85
+ args_dict, _ = _parse(
86
+ label=label,
87
+ description=(
88
+ "Process files and store reduced dataset with event information, "
89
+ "array information and triggered telescopes."
90
+ ),
91
+ )
92
+
93
+ _logger = logging.getLogger()
94
+ _logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
95
+ _logger.info(f"Loading input files with prefix: {args_dict['prefix']}")
96
+
97
+ input_path = Path(args_dict["prefix"])
98
+ files = list(input_path.glob(args_dict["wildcard"]))
99
+ if not files:
100
+ _logger.warning("No matching input files found.")
101
+ return
102
+
103
+ output_path = io_handler.IOHandler().get_output_directory(label)
104
+ output_filepath = Path(output_path).joinpath(f"{args_dict['output_file']}")
105
+
106
+ output_filepath.parent.mkdir(parents=True, exist_ok=True)
107
+ generator = SimtelIOEventDataWriter(files, output_filepath, args_dict["max_files"])
108
+ generator.process_files()
109
+ _logger.info(f"reduced dataset saved to: {output_filepath}")
110
+
111
+ if args_dict["print_dataset_information"] > 0:
112
+ reader = SimtelIOEventDataReader(output_filepath)
113
+ reader.print_dataset_information(args_dict.get("print_dataset_information"))
114
+
115
+
116
+ if __name__ == "__main__":
117
+ main()
@@ -17,6 +17,9 @@ from pathlib import Path
17
17
 
18
18
  import simtools.utils.general as gen
19
19
  from simtools.configuration import configurator
20
+ from simtools.constants import PLOT_CONFIG_SCHEMA
21
+ from simtools.data_model import schema
22
+ from simtools.data_model.metadata_collector import MetadataCollector
20
23
  from simtools.io_operations import io_handler
21
24
  from simtools.visualization import plot_tables
22
25
 
@@ -54,7 +57,7 @@ def _parse(label, description, usage):
54
57
  type=str,
55
58
  required=True,
56
59
  )
57
- return config.initialize(db_config=True)
60
+ return config.initialize(db_config=True, simulation_model=["telescope"])
58
61
 
59
62
 
60
63
  def main():
@@ -70,7 +73,10 @@ def main():
70
73
  io_handler_instance = io_handler.IOHandler()
71
74
 
72
75
  plot_config = gen.convert_keys_in_dict_to_lowercase(
73
- gen.collect_data_from_file(args_dict["plot_config"])
76
+ schema.validate_dict_using_schema(
77
+ gen.collect_data_from_file(args_dict["plot_config"]),
78
+ PLOT_CONFIG_SCHEMA,
79
+ )
74
80
  )
75
81
 
76
82
  plot_tables.plot(
@@ -79,6 +85,12 @@ def main():
79
85
  db_config=db_config_,
80
86
  )
81
87
 
88
+ MetadataCollector.dump(
89
+ args_dict,
90
+ io_handler_instance.get_output_file(args_dict["output_file"]),
91
+ add_activity_name=True,
92
+ )
93
+
82
94
 
83
95
  if __name__ == "__main__":
84
96
  main()
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/python3
2
+ """
3
+ Print the versions of the simtools software.
4
+
5
+ The versions of simtools, the DB, sim_telarray, and CORSIKA are printed.
6
+
7
+ """
8
+
9
+ import json
10
+ import logging
11
+ from pathlib import Path
12
+
13
+ from simtools import dependencies, version
14
+ from simtools.configuration import configurator
15
+ from simtools.io_operations import io_handler
16
+ from simtools.utils import general as gen
17
+
18
+
19
+ def _parse(label, description, usage):
20
+ """
21
+ Parse command line configuration.
22
+
23
+ No command line arguments are required for this application,
24
+ but the configurator is called to set up the DB connection and
25
+ the structure with _parse is kept from other applications for consistency.
26
+
27
+ Parameters
28
+ ----------
29
+ label : str
30
+ Label describing the application.
31
+ description : str
32
+ Description of the application.
33
+ usage : str
34
+ Example on how to use the application.
35
+
36
+ Returns
37
+ -------
38
+ CommandLineParser
39
+ Command line parser object.
40
+ """
41
+ config = configurator.Configurator(label=label, description=description, usage=usage)
42
+
43
+ return config.initialize(db_config=True, output=True)
44
+
45
+
46
+ def main():
47
+ """Print the versions of the simtools software."""
48
+ label = Path(__file__).stem
49
+ args_dict, db_config = _parse(
50
+ label=label,
51
+ description="Print the versions of simtools, the DB, sim_telarray and CORSIKA.",
52
+ usage="simtools-print-version",
53
+ )
54
+ logger = logging.getLogger()
55
+ logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
56
+ io_handler_instance = io_handler.IOHandler()
57
+
58
+ version_string = dependencies.get_version_string(db_config)
59
+ version_dict = {"simtools version": version.__version__}
60
+
61
+ print()
62
+ # The loop below is not necessary, there is only one entry, but it is cleaner
63
+ for key, value in version_dict.items(): #
64
+ print(f"{key}: {value}")
65
+ print(version_string)
66
+
67
+ version_list = version_string.strip().split("\n")
68
+ for version_entry in version_list:
69
+ key, value = version_entry.split(": ")
70
+ version_dict[key] = value
71
+
72
+ with open(
73
+ io_handler_instance.get_output_file(args_dict["output_file"], label=label),
74
+ "w",
75
+ encoding="utf-8",
76
+ ) as f:
77
+ json.dump(version_dict, f, indent=4)
78
+
79
+
80
+ if __name__ == "__main__":
81
+ main()