gammasimtools 0.21.0__py3-none-any.whl → 0.23.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 (370) hide show
  1. {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/METADATA +3 -3
  2. gammasimtools-0.23.0.dist-info/RECORD +414 -0
  3. {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/entry_points.txt +2 -1
  4. simtools/_version.py +2 -2
  5. simtools/application_control.py +118 -0
  6. simtools/applications/calculate_incident_angles.py +17 -25
  7. simtools/applications/convert_all_model_parameters_from_simtel.py +29 -45
  8. simtools/applications/convert_geo_coordinates_of_array_elements.py +26 -45
  9. simtools/applications/convert_model_parameter_from_simtel.py +21 -42
  10. simtools/applications/db_add_file_to_db.py +12 -13
  11. simtools/applications/db_add_simulation_model_from_repository_to_db.py +20 -33
  12. simtools/applications/db_add_value_from_json_to_db.py +28 -23
  13. simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +19 -34
  14. simtools/applications/db_generate_compound_indexes.py +12 -27
  15. simtools/applications/db_get_array_layouts_from_db.py +19 -39
  16. simtools/applications/db_get_file_from_db.py +15 -17
  17. simtools/applications/db_get_parameter_from_db.py +33 -35
  18. simtools/applications/db_inspect_databases.py +10 -11
  19. simtools/applications/db_upload_model_repository.py +104 -0
  20. simtools/applications/derive_ctao_array_layouts.py +16 -21
  21. simtools/applications/derive_mirror_rnda.py +9 -14
  22. simtools/applications/derive_photon_electron_spectrum.py +7 -10
  23. simtools/applications/derive_psf_parameters.py +24 -21
  24. simtools/applications/derive_trigger_rates.py +6 -9
  25. simtools/applications/docs_produce_array_element_report.py +22 -23
  26. simtools/applications/docs_produce_calibration_reports.py +26 -24
  27. simtools/applications/docs_produce_model_parameter_reports.py +15 -22
  28. simtools/applications/docs_produce_simulation_configuration_report.py +21 -22
  29. simtools/applications/generate_array_config.py +14 -33
  30. simtools/applications/generate_corsika_histograms.py +22 -43
  31. simtools/applications/generate_default_metadata.py +15 -36
  32. simtools/applications/generate_regular_arrays.py +11 -15
  33. simtools/applications/generate_simtel_event_data.py +23 -33
  34. simtools/applications/maintain_simulation_model_add_production.py +17 -48
  35. simtools/applications/maintain_simulation_model_compare_productions.py +10 -12
  36. simtools/applications/maintain_simulation_model_verify_production_tables.py +8 -11
  37. simtools/applications/merge_tables.py +15 -24
  38. simtools/applications/plot_array_layout.py +77 -55
  39. simtools/applications/plot_simtel_events.py +11 -13
  40. simtools/applications/plot_tabular_data.py +17 -38
  41. simtools/applications/plot_tabular_data_for_model_parameter.py +16 -23
  42. simtools/applications/print_version.py +14 -42
  43. simtools/applications/production_derive_corsika_limits.py +5 -9
  44. simtools/applications/production_derive_statistics.py +12 -26
  45. simtools/applications/production_generate_grid.py +20 -48
  46. simtools/applications/production_merge_corsika_limits.py +17 -21
  47. simtools/applications/run_application.py +12 -32
  48. simtools/applications/simulate_flasher.py +79 -81
  49. simtools/applications/simulate_illuminator.py +56 -197
  50. simtools/applications/{simulate_calibration_events.py → simulate_pedestals.py} +22 -68
  51. simtools/applications/simulate_prod.py +21 -33
  52. simtools/applications/simulate_prod_htcondor_generator.py +11 -25
  53. simtools/applications/submit_array_layouts.py +15 -18
  54. simtools/applications/submit_data_from_external.py +18 -34
  55. simtools/applications/submit_model_parameter_from_external.py +27 -41
  56. simtools/applications/validate_camera_efficiency.py +23 -22
  57. simtools/applications/validate_camera_fov.py +21 -27
  58. simtools/applications/validate_cumulative_psf.py +28 -37
  59. simtools/applications/validate_file_using_schema.py +35 -45
  60. simtools/applications/validate_optics.py +27 -33
  61. simtools/camera/camera_efficiency.py +8 -13
  62. simtools/configuration/commandline_parser.py +33 -11
  63. simtools/configuration/configurator.py +0 -7
  64. simtools/corsika/corsika_config.py +9 -16
  65. simtools/corsika/corsika_histograms.py +1 -1
  66. simtools/data_model/data_reader.py +0 -2
  67. simtools/data_model/metadata_collector.py +0 -2
  68. simtools/data_model/model_data_writer.py +87 -27
  69. simtools/data_model/schema.py +61 -2
  70. simtools/data_model/validate_data.py +1 -3
  71. simtools/db/db_handler.py +58 -39
  72. simtools/db/db_model_upload.py +210 -5
  73. simtools/io/hdf5_handler.py +0 -5
  74. simtools/io/io_handler.py +31 -83
  75. simtools/io/legacy_data_handler.py +0 -5
  76. simtools/job_execution/job_manager.py +43 -1
  77. simtools/layout/array_layout.py +0 -2
  78. simtools/layout/array_layout_utils.py +1 -5
  79. simtools/layout/telescope_position.py +0 -2
  80. simtools/model/array_model.py +95 -46
  81. simtools/model/calibration_model.py +0 -2
  82. simtools/model/camera.py +0 -2
  83. simtools/model/mirrors.py +0 -2
  84. simtools/model/model_parameter.py +50 -16
  85. simtools/model/model_repository.py +139 -106
  86. simtools/model/model_utils.py +21 -11
  87. simtools/model/site_model.py +0 -2
  88. simtools/model/telescope_model.py +20 -2
  89. simtools/production_configuration/calculate_statistical_uncertainties_grid_point.py +0 -2
  90. simtools/production_configuration/derive_corsika_limits.py +1 -1
  91. simtools/production_configuration/derive_production_statistics.py +0 -2
  92. simtools/production_configuration/interpolation_handler.py +0 -2
  93. simtools/ray_tracing/incident_angles.py +7 -7
  94. simtools/ray_tracing/mirror_panel_psf.py +1 -1
  95. simtools/ray_tracing/psf_analysis.py +0 -2
  96. simtools/ray_tracing/psf_parameter_optimisation.py +180 -73
  97. simtools/ray_tracing/ray_tracing.py +1 -5
  98. simtools/reporting/docs_auto_report_generator.py +108 -0
  99. simtools/reporting/docs_read_parameters.py +168 -104
  100. simtools/resources/array_elements.yml +26 -0
  101. simtools/runners/corsika_runner.py +0 -2
  102. simtools/runners/corsika_simtel_runner.py +11 -19
  103. simtools/runners/runner_services.py +5 -6
  104. simtools/runners/simtel_runner.py +0 -2
  105. simtools/runners/simtools_runner.py +0 -2
  106. simtools/schemas/application_workflow.metaschema.yml +1 -1
  107. simtools/schemas/common_definitions.schema.yml +39 -0
  108. simtools/schemas/model_parameter.metaschema.yml +19 -13
  109. simtools/schemas/model_parameter_and_data_schema.metaschema.yml +6 -12
  110. simtools/schemas/model_parameters/adjust_gain.schema.yml +0 -5
  111. simtools/schemas/model_parameters/altitude.schema.yml +0 -5
  112. simtools/schemas/model_parameters/array_coordinates.schema.yml +0 -5
  113. simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +0 -5
  114. simtools/schemas/model_parameters/array_element_position_ground.schema.yml +0 -7
  115. simtools/schemas/model_parameters/array_element_position_utm.schema.yml +0 -7
  116. simtools/schemas/model_parameters/array_layouts.schema.yml +0 -5
  117. simtools/schemas/model_parameters/array_triggers.schema.yml +0 -5
  118. simtools/schemas/model_parameters/array_window.schema.yml +0 -7
  119. simtools/schemas/model_parameters/asum_clipping.schema.yml +0 -3
  120. simtools/schemas/model_parameters/asum_offset.schema.yml +0 -7
  121. simtools/schemas/model_parameters/asum_shaping.schema.yml +0 -7
  122. simtools/schemas/model_parameters/asum_threshold.schema.yml +0 -7
  123. simtools/schemas/model_parameters/atmospheric_profile.schema.yml +0 -5
  124. simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +0 -5
  125. simtools/schemas/model_parameters/axes_offsets.schema.yml +0 -7
  126. simtools/schemas/model_parameters/calibration_devices.schema.yml +30 -0
  127. simtools/schemas/model_parameters/camera_body_diameter.schema.yml +0 -7
  128. simtools/schemas/model_parameters/camera_body_shape.schema.yml +0 -7
  129. simtools/schemas/model_parameters/camera_config_file.schema.yml +0 -7
  130. simtools/schemas/model_parameters/camera_config_rotate.schema.yml +0 -7
  131. simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +0 -7
  132. simtools/schemas/model_parameters/camera_degraded_map.schema.yml +0 -7
  133. simtools/schemas/model_parameters/camera_depth.schema.yml +0 -7
  134. simtools/schemas/model_parameters/camera_filter.schema.yml +0 -7
  135. simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +0 -3
  136. simtools/schemas/model_parameters/camera_pixels.schema.yml +0 -7
  137. simtools/schemas/model_parameters/camera_transmission.schema.yml +0 -7
  138. simtools/schemas/model_parameters/channels_per_chip.schema.yml +0 -7
  139. simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +0 -7
  140. simtools/schemas/model_parameters/corsika_observation_level.schema.yml +0 -5
  141. simtools/schemas/model_parameters/dark_events.schema.yml +4 -3
  142. simtools/schemas/model_parameters/default_trigger.schema.yml +0 -7
  143. simtools/schemas/model_parameters/design_model.schema.yml +0 -7
  144. simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +0 -7
  145. simtools/schemas/model_parameters/disc_bins.schema.yml +0 -7
  146. simtools/schemas/model_parameters/disc_start.schema.yml +0 -7
  147. simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +0 -7
  148. simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +0 -7
  149. simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +0 -7
  150. simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +0 -7
  151. simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +0 -7
  152. simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +0 -7
  153. simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +0 -7
  154. simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +0 -7
  155. simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +0 -7
  156. simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +0 -7
  157. simtools/schemas/model_parameters/discriminator_threshold.schema.yml +0 -7
  158. simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -9
  159. simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +0 -7
  160. simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +0 -7
  161. simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +0 -7
  162. simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +0 -7
  163. simtools/schemas/model_parameters/dish_shape_length.schema.yml +0 -5
  164. simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -5
  165. simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +0 -3
  166. simtools/schemas/model_parameters/dsum_offset.schema.yml +0 -3
  167. simtools/schemas/model_parameters/dsum_pedsub.schema.yml +0 -3
  168. simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +0 -3
  169. simtools/schemas/model_parameters/dsum_prescale.schema.yml +0 -3
  170. simtools/schemas/model_parameters/dsum_presum_max.schema.yml +0 -3
  171. simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +0 -3
  172. simtools/schemas/model_parameters/dsum_shaping.schema.yml +0 -3
  173. simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +0 -3
  174. simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -12
  175. simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +0 -3
  176. simtools/schemas/model_parameters/effective_focal_length.schema.yml +0 -7
  177. simtools/schemas/model_parameters/epsg_code.schema.yml +0 -5
  178. simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +0 -7
  179. simtools/schemas/model_parameters/fadc_amplitude.schema.yml +2 -9
  180. simtools/schemas/model_parameters/fadc_bins.schema.yml +0 -7
  181. simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +0 -7
  182. simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +0 -2
  183. simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +0 -7
  184. simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +0 -7
  185. simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +2 -9
  186. simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +0 -7
  187. simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +0 -2
  188. simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +0 -7
  189. simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +0 -7
  190. simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +0 -7
  191. simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +0 -2
  192. simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +0 -7
  193. simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +0 -7
  194. simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +0 -7
  195. simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +0 -7
  196. simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +0 -7
  197. simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +0 -7
  198. simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +0 -3
  199. simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +0 -3
  200. simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +0 -3
  201. simtools/schemas/model_parameters/fadc_max_signal.schema.yml +0 -7
  202. simtools/schemas/model_parameters/fadc_max_sum.schema.yml +0 -2
  203. simtools/schemas/model_parameters/fadc_mhz.schema.yml +0 -7
  204. simtools/schemas/model_parameters/fadc_noise.schema.yml +0 -7
  205. simtools/schemas/model_parameters/fadc_pedestal.schema.yml +0 -7
  206. simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +0 -7
  207. simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +0 -7
  208. simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +0 -7
  209. simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +0 -7
  210. simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +0 -7
  211. simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +0 -7
  212. simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +0 -7
  213. simtools/schemas/model_parameters/fake_mirror_list.schema.yml +0 -3
  214. simtools/schemas/model_parameters/flasher_angular_distribution.schema.yml +32 -0
  215. simtools/schemas/model_parameters/flasher_angular_distribution_width.schema.yml +32 -0
  216. simtools/schemas/model_parameters/flasher_bunch_size.schema.yml +28 -0
  217. simtools/schemas/model_parameters/flasher_external_trigger.schema.yml +32 -0
  218. simtools/schemas/model_parameters/flasher_photons.schema.yml +34 -0
  219. simtools/schemas/model_parameters/flasher_position.schema.yml +43 -0
  220. simtools/schemas/model_parameters/flasher_pulse_exp_decay.schema.yml +29 -0
  221. simtools/schemas/model_parameters/flasher_pulse_offset.schema.yml +35 -0
  222. simtools/schemas/model_parameters/flasher_pulse_shape.schema.yml +30 -0
  223. simtools/schemas/model_parameters/flasher_pulse_width.schema.yml +32 -0
  224. simtools/schemas/model_parameters/flasher_type.schema.yml +28 -0
  225. simtools/schemas/model_parameters/flasher_var_photons.schema.yml +31 -0
  226. simtools/schemas/model_parameters/flasher_wavelength.schema.yml +33 -0
  227. simtools/schemas/model_parameters/flatfielding.schema.yml +0 -7
  228. simtools/schemas/model_parameters/focal_length.schema.yml +0 -7
  229. simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +0 -3
  230. simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +0 -3
  231. simtools/schemas/model_parameters/focus_offset.schema.yml +0 -7
  232. simtools/schemas/model_parameters/gain_variation.schema.yml +0 -7
  233. simtools/schemas/model_parameters/geomag_horizontal.schema.yml +2 -7
  234. simtools/schemas/model_parameters/geomag_rotation.schema.yml +2 -7
  235. simtools/schemas/model_parameters/geomag_vertical.schema.yml +2 -7
  236. simtools/schemas/model_parameters/hg_lg_variation.schema.yml +0 -5
  237. simtools/schemas/model_parameters/iobuf_maximum.schema.yml +0 -7
  238. simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +0 -7
  239. simtools/schemas/model_parameters/laser_events.schema.yml +4 -3
  240. simtools/schemas/model_parameters/laser_external_trigger.schema.yml +4 -3
  241. simtools/schemas/model_parameters/laser_photons.schema.yml +4 -3
  242. simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +4 -3
  243. simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +4 -3
  244. simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +4 -3
  245. simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +4 -3
  246. simtools/schemas/model_parameters/laser_var_photons.schema.yml +4 -3
  247. simtools/schemas/model_parameters/laser_wavelength.schema.yml +4 -3
  248. simtools/schemas/model_parameters/led_events.schema.yml +4 -3
  249. simtools/schemas/model_parameters/led_photons.schema.yml +4 -3
  250. simtools/schemas/model_parameters/led_pulse_offset.schema.yml +4 -3
  251. simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +4 -3
  252. simtools/schemas/model_parameters/led_var_photons.schema.yml +4 -3
  253. simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +0 -7
  254. simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +0 -7
  255. simtools/schemas/model_parameters/min_photoelectrons.schema.yml +0 -7
  256. simtools/schemas/model_parameters/min_photons.schema.yml +0 -7
  257. simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +0 -5
  258. simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +0 -7
  259. simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +0 -7
  260. simtools/schemas/model_parameters/mirror_class.schema.yml +2 -9
  261. simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +0 -7
  262. simtools/schemas/model_parameters/mirror_focal_length.schema.yml +0 -5
  263. simtools/schemas/model_parameters/mirror_list.schema.yml +0 -7
  264. simtools/schemas/model_parameters/mirror_offset.schema.yml +0 -7
  265. simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +0 -7
  266. simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +0 -7
  267. simtools/schemas/model_parameters/multiplicity_offset.schema.yml +0 -7
  268. simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +0 -7
  269. simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +0 -7
  270. simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +0 -3
  271. simtools/schemas/model_parameters/nsb_offaxis.schema.yml +0 -7
  272. simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +0 -7
  273. simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +0 -5
  274. simtools/schemas/model_parameters/nsb_reference_value.schema.yml +0 -5
  275. simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +0 -5
  276. simtools/schemas/model_parameters/nsb_sky_map.schema.yml +0 -5
  277. simtools/schemas/model_parameters/nsb_spectrum.schema.yml +0 -5
  278. simtools/schemas/model_parameters/num_gains.schema.yml +0 -7
  279. simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +0 -7
  280. simtools/schemas/model_parameters/optics_properties.schema.yml +0 -7
  281. simtools/schemas/model_parameters/parabolic_dish.schema.yml +0 -3
  282. simtools/schemas/model_parameters/pedestal_events.schema.yml +4 -7
  283. simtools/schemas/model_parameters/photon_delay.schema.yml +0 -7
  284. simtools/schemas/model_parameters/photons_per_run.schema.yml +4 -4
  285. simtools/schemas/model_parameters/pixel_cells.schema.yml +0 -3
  286. simtools/schemas/model_parameters/pixels_parallel.schema.yml +0 -3
  287. simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +0 -7
  288. simtools/schemas/model_parameters/pm_average_gain.schema.yml +0 -5
  289. simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +0 -5
  290. simtools/schemas/model_parameters/pm_gain_index.schema.yml +0 -5
  291. simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +0 -7
  292. simtools/schemas/model_parameters/pm_transit_time.schema.yml +4 -9
  293. simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +0 -5
  294. simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +0 -7
  295. simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +0 -3
  296. simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +0 -3
  297. simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +0 -3
  298. simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +0 -3
  299. simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +0 -3
  300. simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +0 -3
  301. simtools/schemas/model_parameters/qe_variation.schema.yml +0 -7
  302. simtools/schemas/model_parameters/quantum_efficiency.schema.yml +0 -7
  303. simtools/schemas/model_parameters/random_focal_length.schema.yml +2 -7
  304. simtools/schemas/model_parameters/random_generator.schema.yml +0 -7
  305. simtools/schemas/model_parameters/random_mono_probability.schema.yml +0 -7
  306. simtools/schemas/model_parameters/reference_point_altitude.schema.yml +0 -5
  307. simtools/schemas/model_parameters/reference_point_latitude.schema.yml +0 -5
  308. simtools/schemas/model_parameters/reference_point_longitude.schema.yml +0 -5
  309. simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +0 -5
  310. simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +0 -5
  311. simtools/schemas/model_parameters/sampled_output.schema.yml +0 -7
  312. simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +0 -7
  313. simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +0 -3
  314. simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +0 -3
  315. simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +0 -3
  316. simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +0 -3
  317. simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +0 -3
  318. simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +0 -3
  319. simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +0 -3
  320. simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +0 -3
  321. simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +0 -3
  322. simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +0 -3
  323. simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +0 -3
  324. simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +0 -3
  325. simtools/schemas/model_parameters/stars.schema.yml +0 -5
  326. simtools/schemas/model_parameters/store_photoelectrons.schema.yml +0 -7
  327. simtools/schemas/model_parameters/tailcut_scale.schema.yml +0 -7
  328. simtools/schemas/model_parameters/telescope_axis_height.schema.yml +0 -7
  329. simtools/schemas/model_parameters/telescope_random_angle.schema.yml +0 -7
  330. simtools/schemas/model_parameters/telescope_random_error.schema.yml +0 -7
  331. simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +0 -7
  332. simtools/schemas/model_parameters/telescope_transmission.schema.yml +0 -7
  333. simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +0 -7
  334. simtools/schemas/model_parameters/teltrig_min_time.schema.yml +0 -7
  335. simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +0 -7
  336. simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +0 -7
  337. simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +0 -7
  338. simtools/schemas/model_parameters/transit_time_error.schema.yml +0 -7
  339. simtools/schemas/model_parameters/transit_time_jitter.schema.yml +0 -7
  340. simtools/schemas/model_parameters/transit_time_random.schema.yml +29 -0
  341. simtools/schemas/model_parameters/trigger_current_limit.schema.yml +0 -7
  342. simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +0 -7
  343. simtools/schemas/model_parameters/trigger_pixels.schema.yml +0 -7
  344. simtools/schemas/production_tables.schema.yml +8 -8
  345. simtools/schemas/simulation_models_info.schema.yml +78 -0
  346. simtools/simtel/simtel_config_reader.py +0 -2
  347. simtools/simtel/simtel_config_writer.py +118 -26
  348. simtools/simtel/simtel_io_metadata.py +3 -3
  349. simtools/simtel/simulator_array.py +43 -85
  350. simtools/simtel/simulator_camera_efficiency.py +0 -2
  351. simtools/simtel/simulator_light_emission.py +336 -631
  352. simtools/simtel/simulator_ray_tracing.py +2 -4
  353. simtools/simulator.py +45 -19
  354. simtools/testing/assertions.py +2 -2
  355. simtools/testing/configuration.py +21 -6
  356. simtools/testing/sim_telarray_metadata.py +4 -4
  357. simtools/utils/general.py +5 -13
  358. simtools/utils/geometry.py +34 -5
  359. simtools/utils/names.py +1 -13
  360. simtools/version.py +83 -0
  361. simtools/visualization/plot_array_layout.py +129 -23
  362. simtools/visualization/plot_incident_angles.py +0 -2
  363. simtools/visualization/plot_psf.py +163 -61
  364. simtools/visualization/plot_simtel_events.py +1 -12
  365. simtools/visualization/visualize.py +0 -12
  366. gammasimtools-0.21.0.dist-info/RECORD +0 -396
  367. simtools/model/flasher_model.py +0 -106
  368. {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/WHEEL +0 -0
  369. {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/licenses/LICENSE +0 -0
  370. {gammasimtools-0.21.0.dist-info → gammasimtools-0.23.0.dist-info}/top_level.txt +0 -0
@@ -164,36 +164,19 @@ r"""
164
164
  Total time needed: 8s.
165
165
  """
166
166
 
167
- import logging
168
167
  import time
169
- from pathlib import Path
170
168
 
171
- import simtools.utils.general as gen
169
+ from simtools.application_control import get_application_label, startup_application
172
170
  from simtools.configuration import configurator
173
171
  from simtools.corsika.corsika_histograms import CorsikaHistograms
174
- from simtools.io import io_handler
175
172
 
176
- logger = logging.getLogger()
177
173
 
178
-
179
- def _parse(label, description):
180
- """
181
- Parse command line configuration.
182
-
183
- Parameters
184
- ----------
185
- label: str
186
- Label describing the application.
187
- description: str
188
- Description of the application.
189
-
190
- Returns
191
- -------
192
- CommandLineParser
193
- Command line parser object
194
-
195
- """
196
- config = configurator.Configurator(label=label, description=description)
174
+ def _parse():
175
+ """Parse command line configuration."""
176
+ config = configurator.Configurator(
177
+ label=get_application_label(__file__),
178
+ description="Generate histograms for the Cherenkov photons saved in the CORSIKA IACT file.",
179
+ )
197
180
 
198
181
  config.parser.add_argument(
199
182
  "--iact_file",
@@ -280,34 +263,30 @@ def _parse(label, description):
280
263
  return config_parser, _
281
264
 
282
265
 
283
- def main(): # noqa: D103
284
- label = Path(__file__).stem
285
- description = "Generate histograms for the Cherenkov photons saved in the CORSIKA IACT file."
286
- io_handler_instance = io_handler.IOHandler()
287
- args_dict, _ = _parse(label, description)
288
-
289
- output_path = io_handler_instance.get_output_directory(label, sub_dir="application-plots")
266
+ def main():
267
+ """Generate a set of histograms for the Cherenkov photons saved in the CORSIKA IACT file."""
268
+ app_context = startup_application(_parse)
290
269
 
291
- logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
292
270
  initial_time = time.time()
293
- logger.info("Starting the application.")
294
271
 
295
272
  corsika_histograms_instance = CorsikaHistograms(
296
- args_dict["iact_file"], output_path=output_path, hdf5_file_name=args_dict["hdf5_file_name"]
273
+ app_context.args["iact_file"],
274
+ output_path=app_context.io_handler.get_output_directory(),
275
+ hdf5_file_name=app_context.args["hdf5_file_name"],
297
276
  )
298
277
  corsika_histograms_instance.run_export_pipeline(
299
- individual_telescopes=args_dict["individual_telescopes"],
300
- hist_config=args_dict["hist_config"],
301
- indices_arg=args_dict["telescope_indices"],
302
- write_pdf=args_dict["pdf"],
303
- write_hdf5=args_dict["hdf5"],
304
- event1d=args_dict["event_1d_histograms"],
305
- event2d=args_dict["event_2d_histograms"],
306
- test=args_dict["test"],
278
+ individual_telescopes=app_context.args["individual_telescopes"],
279
+ hist_config=app_context.args["hist_config"],
280
+ indices_arg=app_context.args["telescope_indices"],
281
+ write_pdf=app_context.args["pdf"],
282
+ write_hdf5=app_context.args["hdf5"],
283
+ event1d=app_context.args["event_1d_histograms"],
284
+ event2d=app_context.args["event_2d_histograms"],
285
+ test=app_context.args["test"],
307
286
  )
308
287
 
309
288
  final_time = time.time()
310
- logger.info(
289
+ app_context.logger.info(
311
290
  f"Finalizing the application. Total time needed: {round(final_time - initial_time)}s."
312
291
  )
313
292
 
@@ -21,33 +21,18 @@ r"""
21
21
 
22
22
  """
23
23
 
24
- import logging
25
- from pathlib import Path
26
-
27
- import simtools.utils.general as gen
24
+ from simtools.application_control import get_application_label, startup_application
28
25
  from simtools.configuration import configurator
29
26
  from simtools.data_model import metadata_model
30
- from simtools.io import ascii_handler, io_handler
31
-
32
-
33
- def _parse(label, description):
34
- """
35
- Parse command line configuration.
36
-
37
- Parameters
38
- ----------
39
- label: str
40
- Label describing application.
41
- description: str
42
- Description of application.
27
+ from simtools.io import ascii_handler
43
28
 
44
- Returns
45
- -------
46
- CommandLineParser
47
- Command line parser object
48
29
 
49
- """
50
- config = configurator.Configurator(label=label, description=description)
30
+ def _parse():
31
+ """Parse command line configuration."""
32
+ config = configurator.Configurator(
33
+ label=get_application_label(__file__),
34
+ description="Generate a default simtools metadata file from a json schema.",
35
+ )
51
36
 
52
37
  config.parser.add_argument(
53
38
  "--schema",
@@ -65,23 +50,17 @@ def _parse(label, description):
65
50
  return config.initialize(output=False, require_command_line=True)
66
51
 
67
52
 
68
- def main(): # noqa: D103
69
- label = Path(__file__).stem
70
- args_dict, _ = _parse(
71
- label, description="Generate a default simtools metadata file from a json schema."
72
- )
73
-
74
- logger = logging.getLogger()
75
- logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
53
+ def main():
54
+ """Generate a default simtools metadata file from a json schema."""
55
+ app_context = startup_application(_parse)
76
56
 
77
- default_values = metadata_model.get_default_metadata_dict(args_dict["schema"])
57
+ default_values = metadata_model.get_default_metadata_dict(app_context.args["schema"])
78
58
 
79
- if args_dict["output_file"] is None:
59
+ if app_context.args["output_file"] is None:
80
60
  print(default_values)
81
61
  else:
82
- _io_handler = io_handler.IOHandler()
83
- output_file = _io_handler.get_output_file(args_dict["output_file"])
84
- logger.info(f"Writing default values to {output_file}")
62
+ output_file = app_context.io_handler.get_output_file(app_context.args["output_file"])
63
+ app_context.logger.info(f"Writing default values to {output_file}")
85
64
  ascii_handler.write_data_to_file(
86
65
  data=default_values, output_file=output_file, sort_keys=False
87
66
  )
@@ -24,14 +24,13 @@ Runtime < 10 s.
24
24
  simtools-generate-regular-arrays --site=North
25
25
  """
26
26
 
27
- import logging
28
27
  from pathlib import Path
29
28
 
30
29
  import astropy.units as u
31
30
  from astropy.table import QTable
32
31
 
33
32
  import simtools.data_model.model_data_writer as writer
34
- import simtools.utils.general as gen
33
+ from simtools.application_control import get_application_label, startup_application
35
34
  from simtools.configuration import configurator
36
35
  from simtools.utils import names
37
36
 
@@ -42,7 +41,7 @@ telescope_distance = {"LST": 57.5 * u.m, "MST": 70 * u.m, "SST": 80 * u.m}
42
41
 
43
42
  def _parse():
44
43
  config = configurator.Configurator(
45
- label=Path(__file__).stem,
44
+ label=get_application_label(__file__),
46
45
  description=(
47
46
  "Generate a regular array of telescope and save as astropy table.\n"
48
47
  "Default telescope distances for 4 telescope square arrays are: \n"
@@ -58,18 +57,15 @@ def _parse():
58
57
 
59
58
  def main():
60
59
  """Create layout array files (ecsv) of regular arrays."""
61
- args_dict, _ = _parse()
60
+ app_context = startup_application(_parse)
62
61
 
63
- logger = logging.getLogger()
64
- logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
65
-
66
- if args_dict["site"] == "South":
62
+ if app_context.args["site"] == "South":
67
63
  array_list = ["1SST", "4SST", "1MST", "4MST", "1LST", "4LST"]
68
64
  else:
69
65
  array_list = ["1MST", "4MST", "1LST", "4LST"]
70
66
 
71
67
  for array_name in array_list:
72
- logger.info(f"Processing array {array_name}")
68
+ app_context.logger.info(f"Processing array {array_name}")
73
69
 
74
70
  tel_name, pos_x, pos_y, pos_z = [], [], [], []
75
71
  tel_size = array_name[1:4]
@@ -78,7 +74,7 @@ def main():
78
74
  if array_name[0] == "1":
79
75
  tel_name.append(
80
76
  names.generate_array_element_name_from_type_site_id(
81
- tel_size, args_dict["site"], "01"
77
+ tel_size, app_context.args["site"], "01"
82
78
  )
83
79
  )
84
80
  pos_x.append(0 * u.m)
@@ -89,14 +85,14 @@ def main():
89
85
  for i in range(1, 5):
90
86
  tel_name.append(
91
87
  names.generate_array_element_name_from_type_site_id(
92
- tel_size, args_dict["site"], f"0{i}"
88
+ tel_size, app_context.args["site"], f"0{i}"
93
89
  )
94
90
  )
95
91
  pos_x.append(telescope_distance[tel_size] * (-1) ** (i // 2))
96
92
  pos_y.append(telescope_distance[tel_size] * (-1) ** (i % 2))
97
93
  pos_z.append(0 * u.m)
98
94
 
99
- table = QTable(meta={"array_name": array_name, "site": args_dict["site"]})
95
+ table = QTable(meta={"array_name": array_name, "site": app_context.args["site"]})
100
96
  table["telescope_name"] = tel_name
101
97
  table["position_x"] = pos_x
102
98
  table["position_y"] = pos_y
@@ -104,14 +100,14 @@ def main():
104
100
  table.sort("telescope_name")
105
101
  table.pprint()
106
102
 
107
- output_file = args_dict.get("output_file")
103
+ output_file = app_context.args.get("output_file")
108
104
  if output_file:
109
105
  output_path = Path(output_file)
110
106
  output_file = output_path.with_name(
111
- f"{output_path.stem}-{args_dict['site']}-{array_name}{output_path.suffix}"
107
+ f"{output_path.stem}-{app_context.args['site']}-{array_name}{output_path.suffix}"
112
108
  )
113
109
  writer.ModelDataWriter.dump(
114
- args_dict=args_dict,
110
+ args_dict=app_context.args,
115
111
  output_file=output_file,
116
112
  metadata=None,
117
113
  product_data=table,
@@ -124,26 +124,24 @@ To read a reduced event data file, use the following command reading on of the t
124
124
 
125
125
  """
126
126
 
127
- import logging
128
127
  from pathlib import Path
129
128
 
130
- import simtools.utils.general as gen
129
+ from simtools.application_control import get_application_label, startup_application
131
130
  from simtools.configuration import configurator
132
131
  from simtools.data_model.metadata_collector import MetadataCollector
133
132
  from simtools.io import io_handler, table_handler
134
133
  from simtools.simtel.simtel_io_event_writer import SimtelIOEventDataWriter
135
134
 
136
135
 
137
- def _parse(label, description):
138
- """
139
- Parse command line arguments.
140
-
141
- Returns
142
- -------
143
- dict
144
- Parsed command-line arguments.
145
- """
146
- config = configurator.Configurator(label=label, description=description)
136
+ def _parse():
137
+ """Parse command line arguments."""
138
+ config = configurator.Configurator(
139
+ label=get_application_label(__file__),
140
+ description=(
141
+ "Process files and store reduced dataset with event information, "
142
+ "array information and triggered telescopes."
143
+ ),
144
+ )
147
145
 
148
146
  config.parser.add_argument(
149
147
  "--input",
@@ -163,36 +161,28 @@ def _parse(label, description):
163
161
  return config.initialize(db_config=False, output=True)
164
162
 
165
163
 
166
- def main(): # noqa: D103
167
- label = Path(__file__).stem
168
-
169
- args_dict, _ = _parse(
170
- label=label,
171
- description=(
172
- "Process files and store reduced dataset with event information, "
173
- "array information and triggered telescopes."
174
- ),
175
- )
176
-
177
- logger = logging.getLogger()
178
- logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
179
- logger.info(f"Loading input files from: {args_dict['input']}")
164
+ def main():
165
+ """Generate a reduced dataset of event data from output of telescope simulations."""
166
+ app_context = startup_application(_parse, setup_io_handler=False)
167
+ app_context.logger.info(f"Loading input files from: {app_context.args['input']}")
180
168
 
181
- input_pattern = Path(args_dict["input"])
169
+ input_pattern = Path(app_context.args["input"])
182
170
  files = list(input_pattern.parent.glob(input_pattern.name))
183
171
  if not files:
184
- logger.warning("No matching input files found.")
172
+ app_context.logger.warning("No matching input files found.")
185
173
  return
186
174
 
187
- output_filepath = io_handler.IOHandler().get_output_file(args_dict["output_file"])
188
- generator = SimtelIOEventDataWriter(files, args_dict["max_files"])
175
+ output_filepath = io_handler.IOHandler().get_output_file(app_context.args["output_file"])
176
+ generator = SimtelIOEventDataWriter(files, app_context.args["max_files"])
189
177
  tables = generator.process_files()
190
178
  table_handler.write_tables(tables, output_filepath, overwrite_existing=True)
191
- MetadataCollector.dump(args_dict=args_dict, output_file=output_filepath.with_suffix(".yml"))
179
+ MetadataCollector.dump(
180
+ args_dict=app_context.args, output_file=output_filepath.with_suffix(".yml")
181
+ )
192
182
 
193
- if args_dict["print_dataset_information"] > 0:
183
+ if app_context.args["print_dataset_information"] > 0:
194
184
  for table in tables:
195
- table.pprint(max_lines=args_dict["print_dataset_information"], max_width=-1)
185
+ table.pprint(max_lines=app_context.args["print_dataset_information"], max_width=-1)
196
186
 
197
187
 
198
188
  if __name__ == "__main__":
@@ -7,11 +7,11 @@ to production tables and model parameters as provided in a YAML file (see the ex
7
7
 
8
8
  Two main use cases are covered by this script:
9
9
 
10
- 1. full_update: Create a complete new set of production tables (e.g. for new major or minor
10
+ 1. full update: Create a complete new set of production tables (e.g. for new major or minor
11
11
  versions of the simulation models). This will copy all production tables from the source
12
12
  directory and apply the modifications to the tables that are listed in the modifications file.
13
13
 
14
- 2. patch_update: Create a set of new production tables including the changes defined in the
14
+ 2. patch update: Create a set of new production tables including the changes defined in the
15
15
  modifications file. No unmodified tables are copied. For new production tables with patch
16
16
  modifications, the key-value pair 'base_model_version: <base_model version>' is added.
17
17
 
@@ -27,78 +27,47 @@ The following example applies a patch update with changes defined in a YAML file
27
27
 
28
28
  simtools-maintain-simulation-model-add-new-production \\
29
29
  --simulation_models_path ../simulation-models-dev/simulation-models/ \\
30
- --base_model_version 6.0.0 \\
31
- --modifications tests/resources/production_tables_changes_for_threshold_study_6.2.0.yml \\
32
- --patch_update
30
+ --modifications tests/resources/production_tables_changes_for_threshold_study_6.2.0.yml
33
31
 
34
32
  """
35
33
 
36
- import logging
37
34
  from pathlib import Path
38
35
 
39
- import simtools.utils.general as gen
36
+ from simtools.application_control import get_application_label, startup_application
40
37
  from simtools.configuration import configurator
41
38
  from simtools.model import model_repository
42
39
 
43
40
 
44
- def _parse(label, description):
45
- """
46
- Parse command line arguments.
47
-
48
- Returns
49
- -------
50
- dict
51
- Parsed command-line arguments.
52
- """
53
- config = configurator.Configurator(label=label, description=description)
41
+ def _parse():
42
+ """Parse command line arguments."""
43
+ config = configurator.Configurator(
44
+ label=get_application_label(__file__),
45
+ description="Generate a new simulation model production",
46
+ )
54
47
  config.parser.add_argument(
55
48
  "--simulation_models_path",
56
49
  type=str,
57
50
  required=True,
58
51
  help="Path to the simulation models repository.",
59
52
  )
60
- config.parser.add_argument(
61
- "--base_model_version",
62
- type=str,
63
- required=True,
64
- help="Base model version (which is the source production table subdirectory to copy from).",
65
- )
66
53
  config.parser.add_argument(
67
54
  "--modifications",
68
55
  type=str,
69
56
  required=True,
70
57
  help="File containing the list of changes to apply.",
71
58
  )
72
- update_group = config.parser.add_mutually_exclusive_group(required=True)
73
- update_group.add_argument(
74
- "--full_update",
75
- action="store_true",
76
- default=False,
77
- help=(
78
- "Create a full new set of production tables by copying all tables from the "
79
- "base version and applying the modifications to the relevant tables."
80
- ),
81
- )
82
- update_group.add_argument(
83
- "--patch_update",
84
- action="store_true",
85
- default=False,
86
- help=(
87
- "Create a new set of production tables including only the changes defined in the "
88
- "modifications file. No unmodified tables are copied."
89
- ),
90
- )
91
59
 
92
60
  return config.initialize(db_config=False, output=False)
93
61
 
94
62
 
95
- def main(): # noqa: D103
96
- label = Path(__file__).stem
97
- args_dict, _ = _parse(label=label, description="Generate a new simulation model production")
98
- logger = logging.getLogger()
99
- logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
63
+ def main():
64
+ """Generate a new simulation model production."""
65
+ app_context = startup_application(_parse)
100
66
 
101
- model_repository.generate_new_production(args_dict)
67
+ model_repository.generate_new_production(
68
+ modifications=app_context.args["modifications"],
69
+ simulation_models_path=Path(app_context.args["simulation_models_path"]),
70
+ )
102
71
 
103
72
 
104
73
  if __name__ == "__main__":
@@ -13,17 +13,20 @@ Example
13
13
 
14
14
  """
15
15
 
16
- import logging
17
16
  from pathlib import Path
18
17
 
19
18
  import simtools.utils.general as gen
19
+ from simtools.application_control import get_application_label, startup_application
20
20
  from simtools.configuration import configurator
21
21
  from simtools.io import ascii_handler
22
22
 
23
23
 
24
- def _parse(label, description):
24
+ def _parse():
25
25
  """Parse command line arguments."""
26
- config = configurator.Configurator(label=label, description=description)
26
+ config = configurator.Configurator(
27
+ label=get_application_label(__file__),
28
+ description="Compare two directories with model production tables in JSON format.",
29
+ )
27
30
  config.parser.add_argument(
28
31
  "--directory_1",
29
32
  type=str,
@@ -82,16 +85,11 @@ def _compare_json_dirs(dir1, dir2, ignore_key="model_version"):
82
85
  print(f"Missing in dir1: {rel_path}")
83
86
 
84
87
 
85
- def main(): # noqa: D103
86
- label = Path(__file__).stem
87
- args_dict, _ = _parse(
88
- label=label,
89
- description=("Compare two directories with model production tables in JSON format."),
90
- )
91
- logger = logging.getLogger()
92
- logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
88
+ def main():
89
+ """Compare two directories with model production tables in JSON format."""
90
+ app_context = startup_application(_parse, setup_io_handler=False)
93
91
 
94
- _compare_json_dirs(Path(args_dict["directory_1"]), Path(args_dict["directory_2"]))
92
+ _compare_json_dirs(Path(app_context.args["directory_1"]), Path(app_context.args["directory_2"]))
95
93
 
96
94
 
97
95
  if __name__ == "__main__":
@@ -17,21 +17,20 @@ Example
17
17
 
18
18
  """
19
19
 
20
- import logging
21
-
20
+ from simtools.application_control import get_application_label, startup_application
22
21
  from simtools.configuration import configurator
23
22
  from simtools.model import model_repository
24
- from simtools.utils import general as gen
25
23
 
26
24
 
27
25
  def _parse():
28
- """Parse command line arguments."""
26
+ """Parse command line configuration."""
29
27
  config = configurator.Configurator(
28
+ label=get_application_label(__file__),
30
29
  description=(
31
30
  "Verify simulation model production tables and model parameters for completeness. "
32
31
  "This application checks that all model parameters defined in the production tables "
33
32
  "exist in the simulation models repository."
34
- )
33
+ ),
35
34
  )
36
35
  config.parser.add_argument(
37
36
  "--simulation_models_path",
@@ -42,14 +41,12 @@ def _parse():
42
41
  return config.initialize(db_config=False, output=False, paths=False)
43
42
 
44
43
 
45
- def main(): # noqa: D103
46
- args_dict, _ = _parse()
47
-
48
- logger = logging.getLogger()
49
- logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
44
+ def main():
45
+ """Verify simulation model production tables."""
46
+ app_context = startup_application(_parse)
50
47
 
51
48
  if not model_repository.verify_simulation_model_production_tables(
52
- simulation_models_path=args_dict["simulation_models_path"]
49
+ simulation_models_path=app_context.args["simulation_models_path"]
53
50
  ):
54
51
  raise RuntimeError(
55
52
  "Verification failed: Some model parameters are missing in the repository."
@@ -36,24 +36,20 @@ Merge tables from two files generated with 'simtools-generate-simtel-event-data'
36
36
 
37
37
  """
38
38
 
39
- import logging
40
39
  from pathlib import Path
41
40
 
42
41
  import simtools.utils.general as gen
42
+ from simtools.application_control import get_application_label, startup_application
43
43
  from simtools.configuration import configurator
44
44
  from simtools.io import io_handler, table_handler
45
45
 
46
46
 
47
- def _parse(label, description):
48
- """
49
- Parse command line arguments.
50
-
51
- Returns
52
- -------
53
- dict
54
- Parsed command-line arguments.
55
- """
56
- config = configurator.Configurator(label=label, description=description)
47
+ def _parse():
48
+ """Parse command line arguments."""
49
+ config = configurator.Configurator(
50
+ label=get_application_label(__file__),
51
+ description="Merge tables from multiple input files into single tables.",
52
+ )
57
53
 
58
54
  input_group = config.parser.add_mutually_exclusive_group(required=True)
59
55
  input_group.add_argument(
@@ -72,28 +68,23 @@ def _parse(label, description):
72
68
  return config.initialize(db_config=False, output=True)
73
69
 
74
70
 
75
- def main(): # noqa: D103
76
- label = Path(__file__).stem
71
+ def main():
72
+ """Merge tables from multiple input files into single tables."""
73
+ app_context = startup_application(_parse)
77
74
 
78
- args_dict, _ = _parse(
79
- label=label,
80
- description=("Merge tables from multiple input files into single tables."),
81
- )
82
- logger = logging.getLogger()
83
- logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
84
- logger.info(f"Loading input files: {args_dict['input_files']}")
75
+ app_context.logger.info(f"Loading input files: {app_context.args['input_files']}")
85
76
 
86
77
  # accept fits.gz files (.gz)
87
78
  input_files = gen.get_list_of_files_from_command_line(
88
- args_dict["input_files"], [".hdf5", ".gz"]
79
+ app_context.args["input_files"], [".hdf5", ".gz"]
89
80
  )
90
81
 
91
- output_path = io_handler.IOHandler().get_output_directory(label)
92
- output_filepath = Path(output_path).joinpath(f"{args_dict['output_file']}")
82
+ output_path = io_handler.IOHandler().get_output_directory()
83
+ output_filepath = Path(output_path).joinpath(f"{app_context.args['output_file']}")
93
84
 
94
85
  table_handler.merge_tables(
95
86
  input_files,
96
- input_table_names=args_dict["table_names"],
87
+ input_table_names=app_context.args["table_names"],
97
88
  output_file=output_filepath,
98
89
  )
99
90