gammasimtools 0.21.0__py3-none-any.whl → 0.22.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 (312) hide show
  1. {gammasimtools-0.21.0.dist-info → gammasimtools-0.22.0.dist-info}/METADATA +2 -3
  2. {gammasimtools-0.21.0.dist-info → gammasimtools-0.22.0.dist-info}/RECORD +311 -295
  3. {gammasimtools-0.21.0.dist-info → gammasimtools-0.22.0.dist-info}/entry_points.txt +2 -1
  4. simtools/_version.py +2 -2
  5. simtools/applications/calculate_incident_angles.py +1 -4
  6. simtools/applications/convert_all_model_parameters_from_simtel.py +1 -2
  7. simtools/applications/convert_model_parameter_from_simtel.py +0 -1
  8. simtools/applications/db_generate_compound_indexes.py +3 -16
  9. simtools/applications/db_upload_model_repository.py +122 -0
  10. simtools/applications/derive_psf_parameters.py +13 -3
  11. simtools/applications/docs_produce_array_element_report.py +1 -1
  12. simtools/applications/docs_produce_calibration_reports.py +1 -1
  13. simtools/applications/docs_produce_model_parameter_reports.py +1 -1
  14. simtools/applications/docs_produce_simulation_configuration_report.py +1 -1
  15. simtools/applications/generate_corsika_histograms.py +1 -1
  16. simtools/applications/maintain_simulation_model_add_production.py +7 -31
  17. simtools/applications/merge_tables.py +1 -1
  18. simtools/applications/plot_array_layout.py +1 -2
  19. simtools/applications/print_version.py +1 -1
  20. simtools/applications/production_derive_statistics.py +1 -2
  21. simtools/applications/production_generate_grid.py +1 -1
  22. simtools/applications/simulate_flasher.py +74 -72
  23. simtools/applications/simulate_illuminator.py +52 -186
  24. simtools/applications/{simulate_calibration_events.py → simulate_pedestals.py} +9 -55
  25. simtools/applications/submit_model_parameter_from_external.py +0 -1
  26. simtools/applications/validate_camera_efficiency.py +0 -1
  27. simtools/applications/validate_camera_fov.py +1 -2
  28. simtools/applications/validate_cumulative_psf.py +2 -3
  29. simtools/applications/validate_file_using_schema.py +20 -12
  30. simtools/applications/validate_optics.py +2 -2
  31. simtools/camera/camera_efficiency.py +8 -11
  32. simtools/configuration/commandline_parser.py +1 -7
  33. simtools/configuration/configurator.py +0 -2
  34. simtools/corsika/corsika_config.py +9 -11
  35. simtools/corsika/corsika_histograms.py +1 -1
  36. simtools/data_model/model_data_writer.py +87 -25
  37. simtools/data_model/schema.py +61 -2
  38. simtools/data_model/validate_data.py +1 -1
  39. simtools/db/db_handler.py +58 -37
  40. simtools/db/db_model_upload.py +210 -5
  41. simtools/io/io_handler.py +31 -83
  42. simtools/job_execution/job_manager.py +45 -0
  43. simtools/layout/array_layout_utils.py +1 -5
  44. simtools/model/array_model.py +93 -42
  45. simtools/model/model_parameter.py +20 -9
  46. simtools/model/model_repository.py +139 -106
  47. simtools/model/model_utils.py +21 -6
  48. simtools/model/telescope_model.py +20 -0
  49. simtools/production_configuration/derive_corsika_limits.py +1 -1
  50. simtools/ray_tracing/incident_angles.py +7 -7
  51. simtools/ray_tracing/mirror_panel_psf.py +1 -1
  52. simtools/ray_tracing/psf_parameter_optimisation.py +180 -73
  53. simtools/ray_tracing/ray_tracing.py +1 -3
  54. simtools/reporting/docs_read_parameters.py +171 -101
  55. simtools/resources/array_elements.yml +26 -0
  56. simtools/runners/corsika_simtel_runner.py +11 -17
  57. simtools/runners/runner_services.py +5 -6
  58. simtools/runners/simtools_runner.py +0 -2
  59. simtools/schemas/application_workflow.metaschema.yml +1 -1
  60. simtools/schemas/common_definitions.schema.yml +39 -0
  61. simtools/schemas/model_parameter.metaschema.yml +19 -13
  62. simtools/schemas/model_parameter_and_data_schema.metaschema.yml +6 -12
  63. simtools/schemas/model_parameters/adjust_gain.schema.yml +0 -5
  64. simtools/schemas/model_parameters/altitude.schema.yml +0 -5
  65. simtools/schemas/model_parameters/array_coordinates.schema.yml +0 -5
  66. simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +0 -5
  67. simtools/schemas/model_parameters/array_element_position_ground.schema.yml +0 -7
  68. simtools/schemas/model_parameters/array_element_position_utm.schema.yml +0 -7
  69. simtools/schemas/model_parameters/array_layouts.schema.yml +0 -5
  70. simtools/schemas/model_parameters/array_triggers.schema.yml +0 -5
  71. simtools/schemas/model_parameters/array_window.schema.yml +0 -7
  72. simtools/schemas/model_parameters/asum_clipping.schema.yml +0 -3
  73. simtools/schemas/model_parameters/asum_offset.schema.yml +0 -7
  74. simtools/schemas/model_parameters/asum_shaping.schema.yml +0 -7
  75. simtools/schemas/model_parameters/asum_threshold.schema.yml +0 -7
  76. simtools/schemas/model_parameters/atmospheric_profile.schema.yml +0 -5
  77. simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +0 -5
  78. simtools/schemas/model_parameters/axes_offsets.schema.yml +0 -7
  79. simtools/schemas/model_parameters/calibration_devices.schema.yml +30 -0
  80. simtools/schemas/model_parameters/camera_body_diameter.schema.yml +0 -7
  81. simtools/schemas/model_parameters/camera_body_shape.schema.yml +0 -7
  82. simtools/schemas/model_parameters/camera_config_file.schema.yml +0 -7
  83. simtools/schemas/model_parameters/camera_config_rotate.schema.yml +0 -7
  84. simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +0 -7
  85. simtools/schemas/model_parameters/camera_degraded_map.schema.yml +0 -7
  86. simtools/schemas/model_parameters/camera_depth.schema.yml +0 -7
  87. simtools/schemas/model_parameters/camera_filter.schema.yml +0 -7
  88. simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +0 -3
  89. simtools/schemas/model_parameters/camera_pixels.schema.yml +0 -7
  90. simtools/schemas/model_parameters/camera_transmission.schema.yml +0 -7
  91. simtools/schemas/model_parameters/channels_per_chip.schema.yml +0 -7
  92. simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +0 -7
  93. simtools/schemas/model_parameters/corsika_observation_level.schema.yml +0 -5
  94. simtools/schemas/model_parameters/dark_events.schema.yml +4 -3
  95. simtools/schemas/model_parameters/default_trigger.schema.yml +0 -7
  96. simtools/schemas/model_parameters/design_model.schema.yml +0 -7
  97. simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +0 -7
  98. simtools/schemas/model_parameters/disc_bins.schema.yml +0 -7
  99. simtools/schemas/model_parameters/disc_start.schema.yml +0 -7
  100. simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +0 -7
  101. simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +0 -7
  102. simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +0 -7
  103. simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +0 -7
  104. simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +0 -7
  105. simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +0 -7
  106. simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +0 -7
  107. simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +0 -7
  108. simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +0 -7
  109. simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +0 -7
  110. simtools/schemas/model_parameters/discriminator_threshold.schema.yml +0 -7
  111. simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -9
  112. simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +0 -7
  113. simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +0 -7
  114. simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +0 -7
  115. simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +0 -7
  116. simtools/schemas/model_parameters/dish_shape_length.schema.yml +0 -5
  117. simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -5
  118. simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +0 -3
  119. simtools/schemas/model_parameters/dsum_offset.schema.yml +0 -3
  120. simtools/schemas/model_parameters/dsum_pedsub.schema.yml +0 -3
  121. simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +0 -3
  122. simtools/schemas/model_parameters/dsum_prescale.schema.yml +0 -3
  123. simtools/schemas/model_parameters/dsum_presum_max.schema.yml +0 -3
  124. simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +0 -3
  125. simtools/schemas/model_parameters/dsum_shaping.schema.yml +0 -3
  126. simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +0 -3
  127. simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -12
  128. simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +0 -3
  129. simtools/schemas/model_parameters/effective_focal_length.schema.yml +0 -7
  130. simtools/schemas/model_parameters/epsg_code.schema.yml +0 -5
  131. simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +0 -7
  132. simtools/schemas/model_parameters/fadc_amplitude.schema.yml +2 -9
  133. simtools/schemas/model_parameters/fadc_bins.schema.yml +0 -7
  134. simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +0 -7
  135. simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +0 -2
  136. simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +0 -7
  137. simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +0 -7
  138. simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +2 -9
  139. simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +0 -7
  140. simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +0 -2
  141. simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +0 -7
  142. simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +0 -7
  143. simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +0 -7
  144. simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +0 -2
  145. simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +0 -7
  146. simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +0 -7
  147. simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +0 -7
  148. simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +0 -7
  149. simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +0 -7
  150. simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +0 -7
  151. simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +0 -3
  152. simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +0 -3
  153. simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +0 -3
  154. simtools/schemas/model_parameters/fadc_max_signal.schema.yml +0 -7
  155. simtools/schemas/model_parameters/fadc_max_sum.schema.yml +0 -2
  156. simtools/schemas/model_parameters/fadc_mhz.schema.yml +0 -7
  157. simtools/schemas/model_parameters/fadc_noise.schema.yml +0 -7
  158. simtools/schemas/model_parameters/fadc_pedestal.schema.yml +0 -7
  159. simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +0 -7
  160. simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +0 -7
  161. simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +0 -7
  162. simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +0 -7
  163. simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +0 -7
  164. simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +0 -7
  165. simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +0 -7
  166. simtools/schemas/model_parameters/fake_mirror_list.schema.yml +0 -3
  167. simtools/schemas/model_parameters/flasher_angular_distribution.schema.yml +32 -0
  168. simtools/schemas/model_parameters/flasher_angular_distribution_width.schema.yml +32 -0
  169. simtools/schemas/model_parameters/flasher_bunch_size.schema.yml +28 -0
  170. simtools/schemas/model_parameters/flasher_external_trigger.schema.yml +32 -0
  171. simtools/schemas/model_parameters/flasher_photons.schema.yml +34 -0
  172. simtools/schemas/model_parameters/flasher_position.schema.yml +43 -0
  173. simtools/schemas/model_parameters/flasher_pulse_exp_decay.schema.yml +29 -0
  174. simtools/schemas/model_parameters/flasher_pulse_offset.schema.yml +35 -0
  175. simtools/schemas/model_parameters/flasher_pulse_shape.schema.yml +30 -0
  176. simtools/schemas/model_parameters/flasher_pulse_width.schema.yml +32 -0
  177. simtools/schemas/model_parameters/flasher_type.schema.yml +28 -0
  178. simtools/schemas/model_parameters/flasher_var_photons.schema.yml +31 -0
  179. simtools/schemas/model_parameters/flasher_wavelength.schema.yml +33 -0
  180. simtools/schemas/model_parameters/flatfielding.schema.yml +0 -7
  181. simtools/schemas/model_parameters/focal_length.schema.yml +0 -7
  182. simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +0 -3
  183. simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +0 -3
  184. simtools/schemas/model_parameters/focus_offset.schema.yml +0 -7
  185. simtools/schemas/model_parameters/gain_variation.schema.yml +0 -7
  186. simtools/schemas/model_parameters/geomag_horizontal.schema.yml +2 -7
  187. simtools/schemas/model_parameters/geomag_rotation.schema.yml +2 -7
  188. simtools/schemas/model_parameters/geomag_vertical.schema.yml +2 -7
  189. simtools/schemas/model_parameters/hg_lg_variation.schema.yml +0 -5
  190. simtools/schemas/model_parameters/iobuf_maximum.schema.yml +0 -7
  191. simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +0 -7
  192. simtools/schemas/model_parameters/laser_events.schema.yml +4 -3
  193. simtools/schemas/model_parameters/laser_external_trigger.schema.yml +4 -3
  194. simtools/schemas/model_parameters/laser_photons.schema.yml +4 -3
  195. simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +4 -3
  196. simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +4 -3
  197. simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +4 -3
  198. simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +4 -3
  199. simtools/schemas/model_parameters/laser_var_photons.schema.yml +4 -3
  200. simtools/schemas/model_parameters/laser_wavelength.schema.yml +4 -3
  201. simtools/schemas/model_parameters/led_events.schema.yml +4 -3
  202. simtools/schemas/model_parameters/led_photons.schema.yml +4 -3
  203. simtools/schemas/model_parameters/led_pulse_offset.schema.yml +4 -3
  204. simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +4 -3
  205. simtools/schemas/model_parameters/led_var_photons.schema.yml +4 -3
  206. simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +0 -7
  207. simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +0 -7
  208. simtools/schemas/model_parameters/min_photoelectrons.schema.yml +0 -7
  209. simtools/schemas/model_parameters/min_photons.schema.yml +0 -7
  210. simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +0 -5
  211. simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +0 -7
  212. simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +0 -7
  213. simtools/schemas/model_parameters/mirror_class.schema.yml +2 -9
  214. simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +0 -7
  215. simtools/schemas/model_parameters/mirror_focal_length.schema.yml +0 -5
  216. simtools/schemas/model_parameters/mirror_list.schema.yml +0 -7
  217. simtools/schemas/model_parameters/mirror_offset.schema.yml +0 -7
  218. simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +0 -7
  219. simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +0 -7
  220. simtools/schemas/model_parameters/multiplicity_offset.schema.yml +0 -7
  221. simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +0 -7
  222. simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +0 -7
  223. simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +0 -3
  224. simtools/schemas/model_parameters/nsb_offaxis.schema.yml +0 -7
  225. simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +0 -7
  226. simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +0 -5
  227. simtools/schemas/model_parameters/nsb_reference_value.schema.yml +0 -5
  228. simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +0 -5
  229. simtools/schemas/model_parameters/nsb_sky_map.schema.yml +0 -5
  230. simtools/schemas/model_parameters/nsb_spectrum.schema.yml +0 -5
  231. simtools/schemas/model_parameters/num_gains.schema.yml +0 -7
  232. simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +0 -7
  233. simtools/schemas/model_parameters/optics_properties.schema.yml +0 -7
  234. simtools/schemas/model_parameters/parabolic_dish.schema.yml +0 -3
  235. simtools/schemas/model_parameters/pedestal_events.schema.yml +4 -7
  236. simtools/schemas/model_parameters/photon_delay.schema.yml +0 -7
  237. simtools/schemas/model_parameters/photons_per_run.schema.yml +4 -4
  238. simtools/schemas/model_parameters/pixel_cells.schema.yml +0 -3
  239. simtools/schemas/model_parameters/pixels_parallel.schema.yml +0 -3
  240. simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +0 -7
  241. simtools/schemas/model_parameters/pm_average_gain.schema.yml +0 -5
  242. simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +0 -5
  243. simtools/schemas/model_parameters/pm_gain_index.schema.yml +0 -5
  244. simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +0 -7
  245. simtools/schemas/model_parameters/pm_transit_time.schema.yml +4 -9
  246. simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +0 -5
  247. simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +0 -7
  248. simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +0 -3
  249. simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +0 -3
  250. simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +0 -3
  251. simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +0 -3
  252. simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +0 -3
  253. simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +0 -3
  254. simtools/schemas/model_parameters/qe_variation.schema.yml +0 -7
  255. simtools/schemas/model_parameters/quantum_efficiency.schema.yml +0 -7
  256. simtools/schemas/model_parameters/random_focal_length.schema.yml +2 -7
  257. simtools/schemas/model_parameters/random_generator.schema.yml +0 -7
  258. simtools/schemas/model_parameters/random_mono_probability.schema.yml +0 -7
  259. simtools/schemas/model_parameters/reference_point_altitude.schema.yml +0 -5
  260. simtools/schemas/model_parameters/reference_point_latitude.schema.yml +0 -5
  261. simtools/schemas/model_parameters/reference_point_longitude.schema.yml +0 -5
  262. simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +0 -5
  263. simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +0 -5
  264. simtools/schemas/model_parameters/sampled_output.schema.yml +0 -7
  265. simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +0 -7
  266. simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +0 -3
  267. simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +0 -3
  268. simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +0 -3
  269. simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +0 -3
  270. simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +0 -3
  271. simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +0 -3
  272. simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +0 -3
  273. simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +0 -3
  274. simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +0 -3
  275. simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +0 -3
  276. simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +0 -3
  277. simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +0 -3
  278. simtools/schemas/model_parameters/stars.schema.yml +0 -5
  279. simtools/schemas/model_parameters/store_photoelectrons.schema.yml +0 -7
  280. simtools/schemas/model_parameters/tailcut_scale.schema.yml +0 -7
  281. simtools/schemas/model_parameters/telescope_axis_height.schema.yml +0 -7
  282. simtools/schemas/model_parameters/telescope_random_angle.schema.yml +0 -7
  283. simtools/schemas/model_parameters/telescope_random_error.schema.yml +0 -7
  284. simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +0 -7
  285. simtools/schemas/model_parameters/telescope_transmission.schema.yml +0 -7
  286. simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +0 -7
  287. simtools/schemas/model_parameters/teltrig_min_time.schema.yml +0 -7
  288. simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +0 -7
  289. simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +0 -7
  290. simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +0 -7
  291. simtools/schemas/model_parameters/transit_time_error.schema.yml +0 -7
  292. simtools/schemas/model_parameters/transit_time_jitter.schema.yml +0 -7
  293. simtools/schemas/model_parameters/trigger_current_limit.schema.yml +0 -7
  294. simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +0 -7
  295. simtools/schemas/model_parameters/trigger_pixels.schema.yml +0 -7
  296. simtools/schemas/production_tables.schema.yml +8 -8
  297. simtools/schemas/simulation_models_info.schema.yml +78 -0
  298. simtools/simtel/simtel_config_writer.py +87 -13
  299. simtools/simtel/simulator_array.py +44 -74
  300. simtools/simtel/simulator_light_emission.py +336 -629
  301. simtools/simtel/simulator_ray_tracing.py +2 -2
  302. simtools/simulator.py +45 -14
  303. simtools/testing/configuration.py +4 -2
  304. simtools/testing/sim_telarray_metadata.py +4 -4
  305. simtools/utils/geometry.py +34 -0
  306. simtools/version.py +22 -0
  307. simtools/visualization/plot_psf.py +163 -61
  308. simtools/visualization/plot_simtel_events.py +1 -1
  309. simtools/model/flasher_model.py +0 -106
  310. {gammasimtools-0.21.0.dist-info → gammasimtools-0.22.0.dist-info}/WHEEL +0 -0
  311. {gammasimtools-0.21.0.dist-info → gammasimtools-0.22.0.dist-info}/licenses/LICENSE +0 -0
  312. {gammasimtools-0.21.0.dist-info → gammasimtools-0.22.0.dist-info}/top_level.txt +0 -0
@@ -11,6 +11,7 @@ simtools-db-get-array-layouts-from-db = simtools.applications.db_get_array_layou
11
11
  simtools-db-get-file-from-db = simtools.applications.db_get_file_from_db:main
12
12
  simtools-db-get-parameter-from-db = simtools.applications.db_get_parameter_from_db:main
13
13
  simtools-db-inspect-databases = simtools.applications.db_inspect_databases:main
14
+ simtools-db-upload-model-repository = simtools.applications.db_upload_model_repository:main
14
15
  simtools-derive-ctao-array-layouts = simtools.applications.derive_ctao_array_layouts:main
15
16
  simtools-derive-mirror-rnda = simtools.applications.derive_mirror_rnda:main
16
17
  simtools-derive-photon-electron-spectrum = simtools.applications.derive_photon_electron_spectrum:main
@@ -39,9 +40,9 @@ simtools-production-derive-statistics = simtools.applications.production_derive_
39
40
  simtools-production-generate-grid = simtools.applications.production_generate_grid:main
40
41
  simtools-production-merge-corsika-limits = simtools.applications.production_merge_corsika_limits:main
41
42
  simtools-run-application = simtools.applications.run_application:main
42
- simtools-simulate-calibration-events = simtools.applications.simulate_calibration_events:main
43
43
  simtools-simulate-flasher = simtools.applications.simulate_flasher:main
44
44
  simtools-simulate-illuminator = simtools.applications.simulate_illuminator:main
45
+ simtools-simulate-pedestals = simtools.applications.simulate_pedestals:main
45
46
  simtools-simulate-prod = simtools.applications.simulate_prod:main
46
47
  simtools-simulate-prod-htcondor-generator = simtools.applications.simulate_prod_htcondor_generator:main
47
48
  simtools-submit-array-layouts = simtools.applications.submit_array_layouts:main
simtools/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '0.21.0'
32
- __version_tuple__ = version_tuple = (0, 21, 0)
31
+ __version__ = version = '0.22.0'
32
+ __version_tuple__ = version_tuple = (0, 22, 0)
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -144,10 +144,7 @@ def main():
144
144
 
145
145
  logger.info("Starting calculation of incident angles")
146
146
 
147
- output_base = Path(args_dict.get("output_path", "./"))
148
- output_dir = (
149
- output_base / label if not args_dict.get("use_plain_output_path", False) else output_base
150
- )
147
+ output_dir = Path(args_dict.get("output_path", "./"))
151
148
  base_label = args_dict.get("label", label)
152
149
  telescope_name = args_dict["telescope"]
153
150
  label_with_telescope = f"{base_label}_{telescope_name}"
@@ -233,8 +233,7 @@ def read_and_export_parameters(args_dict, logger):
233
233
  parameter_version=args_dict["parameter_version"],
234
234
  output_file=io_handler.get_output_file(
235
235
  f"{_parameter}-{args_dict['parameter_version']}.json",
236
- label=f"{args_dict['telescope']}",
237
- sub_dir=f"{_parameter}",
236
+ sub_dir=[f"{args_dict['telescope']}", f"{_parameter}"],
238
237
  ),
239
238
  )
240
239
 
@@ -109,7 +109,6 @@ def main(): # noqa: D103
109
109
  parameter_version=args_dict["parameter_version"],
110
110
  output_file=args_dict["output_file"],
111
111
  output_path=args_dict.get("output_path"),
112
- use_plain_output_path=args_dict.get("use_plain_output_path"),
113
112
  )
114
113
  logger.info(f"Validated parameter: {_json_dict}")
115
114
 
@@ -40,25 +40,12 @@ def main(): # noqa: D103
40
40
  logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
41
41
 
42
42
  db = db_handler.DatabaseHandler(mongo_db_config=db_config)
43
- # databases without internal databases we don't have rights to modify
44
- databases = [
45
- d for d in db.db_client.list_database_names() if d not in ("config", "admin", "local")
46
- ]
47
- requested = db.get_db_name(
43
+
44
+ db.generate_compound_indexes_for_databases(
48
45
  db_name=args_dict["db_name"],
46
+ db_simulation_model=args_dict.get("db_simulation_model"),
49
47
  db_simulation_model_version=args_dict.get("db_simulation_model_version"),
50
- model_name=args_dict.get("db_simulation_model"),
51
48
  )
52
- if requested != "all" and requested not in databases:
53
- raise ValueError(
54
- f"Requested database '{requested}' not found. "
55
- f"Following databases are available: {', '.join(databases)}"
56
- )
57
-
58
- databases = databases if requested == "all" else [requested]
59
- for db_name in databases:
60
- logger.info(f"Generating compound indexes for database: {db_name}")
61
- db.generate_compound_indexes(db_name=db_name)
62
49
 
63
50
 
64
51
  if __name__ == "__main__":
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/python3
2
+ r"""
3
+ Upload model parameters from simulation model repository to a local or remote database.
4
+
5
+ This script clones the CTAO simulation model repository and uploads model parameters
6
+ and production tables to a MongoDB database. It includes retry functionality for
7
+ network operations and confirmation prompts for remote database uploads.
8
+
9
+ Command line arguments
10
+ ----------------------
11
+ db_simulation_model (str, required)
12
+ Name of the database simulation model.
13
+ db_simulation_model_version (str, required)
14
+ Version of the database simulation model.
15
+ branch (str, optional)
16
+ Repository branch to clone (if not provided, uses the version tag).
17
+ tmp_dir (str, optional)
18
+ Temporary directory for cloning the repository (default: ./tmp_model_parameters).
19
+
20
+ Examples
21
+ --------
22
+ Upload model repository to database using a version tag
23
+ (see simulation model repository for available tags):
24
+
25
+ .. code-block:: console
26
+
27
+ simtools-db-upload-model-repository \\
28
+ --db_simulation_model CTAO-Simulation-Model \\
29
+ --db_simulation_model_version v10.10.10
30
+
31
+ Upload model repository using specific branch (the version tag is
32
+ used to name the database, but no tag checkout is done):
33
+
34
+ .. code-block:: console
35
+
36
+ simtools-db-upload-model-repository \\
37
+ --db_simulation_model CTAO-Simulation-Model \\
38
+ --db_simulation_model_version v10.10.10 \\
39
+ --branch main
40
+
41
+ """
42
+
43
+ import logging
44
+ from pathlib import Path
45
+
46
+ import simtools.utils.general as gen
47
+ from simtools.configuration import configurator
48
+ from simtools.db import db_handler, db_model_upload
49
+
50
+ DEFAULT_REPOSITORY_URL = (
51
+ "https://gitlab.cta-observatory.org/cta-science/simulations/"
52
+ "simulation-model/simulation-models.git"
53
+ )
54
+
55
+
56
+ def _parse(label=None, description=None):
57
+ """
58
+ Parse command line configuration.
59
+
60
+ Parameters
61
+ ----------
62
+ label : str
63
+ Label describing application.
64
+ description : str
65
+ Description of application.
66
+
67
+ Returns
68
+ -------
69
+ tuple
70
+ Command line parser object and database configuration.
71
+ """
72
+ config = configurator.Configurator(label=label, description=description)
73
+ config.parser.add_argument(
74
+ "--branch",
75
+ help="Repository branch to clone (optional, defaults to using version tag).",
76
+ type=str,
77
+ required=False,
78
+ )
79
+ config.parser.add_argument(
80
+ "--tmp_dir",
81
+ help="Temporary directory for cloning the repository (default: ./tmp_model_parameters).",
82
+ type=str,
83
+ default="tmp_model_parameters",
84
+ required=False,
85
+ )
86
+
87
+ args_dict, db_config = config.initialize(output=True, require_command_line=True, db_config=True)
88
+
89
+ if args_dict.get("db_simulation_model_version"):
90
+ db_config["db_simulation_model"] = args_dict.get(
91
+ "db_simulation_model", "CTAO-Simulation-Model"
92
+ )
93
+ db_config["db_simulation_model_version"] = args_dict["db_simulation_model_version"]
94
+ else:
95
+ raise ValueError("Setting of db_simulation_model_version is required.")
96
+
97
+ return args_dict, db_config
98
+
99
+
100
+ def main():
101
+ """Application main."""
102
+ args_dict, db_config = _parse(
103
+ label=Path(__file__).stem, description="Upload model parameters from repository to database"
104
+ )
105
+ logger = logging.getLogger()
106
+ logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
107
+
108
+ db = db_handler.DatabaseHandler(mongo_db_config=db_config)
109
+ db.print_connection_info()
110
+
111
+ db_model_upload.add_complete_model(
112
+ tmp_dir=args_dict.get("tmp_dir"),
113
+ db=db,
114
+ db_simulation_model=args_dict.get("db_simulation_model"),
115
+ db_simulation_model_version=args_dict.get("db_simulation_model_version"),
116
+ repository_url=DEFAULT_REPOSITORY_URL,
117
+ repository_branch=args_dict.get("branch"),
118
+ )
119
+
120
+
121
+ if __name__ == "__main__":
122
+ main()
@@ -184,6 +184,12 @@ def _parse():
184
184
  help="Use KS statistic for monte carlo uncertainty analysis.",
185
185
  action="store_true",
186
186
  )
187
+ config.parser.add_argument(
188
+ "--fraction",
189
+ help="PSF containment fraction for diameter calculation (e.g., 0.8 for D80, 0.95 for D95).",
190
+ type=float,
191
+ default=0.8,
192
+ )
187
193
  return config.initialize(
188
194
  db_config=True,
189
195
  simulation_model=["telescope", "model_version", "parameter_version"],
@@ -198,8 +204,7 @@ def main(): # noqa: D103
198
204
  logger.setLevel(get_log_level_from_user(args_dict["log_level"]))
199
205
 
200
206
  _io_handler = io_handler.IOHandler()
201
- output_dir = _io_handler.get_output_directory(label, sub_dir="application-plots")
202
- tel_model, site_model = initialize_simulation_models(
207
+ tel_model, site_model, _ = initialize_simulation_models(
203
208
  label=label,
204
209
  db_config=db_config,
205
210
  site=args_dict["site"],
@@ -207,7 +212,12 @@ def main(): # noqa: D103
207
212
  model_version=args_dict["model_version"],
208
213
  )
209
214
 
210
- psf_opt.run_psf_optimization_workflow(tel_model, site_model, args_dict, output_dir)
215
+ psf_opt.run_psf_optimization_workflow(
216
+ tel_model,
217
+ site_model,
218
+ args_dict,
219
+ _io_handler.get_output_directory(),
220
+ )
211
221
 
212
222
 
213
223
  if __name__ == "__main__":
@@ -56,7 +56,7 @@ def main(): # noqa: D103
56
56
  args, db_config = _parse(label_name)
57
57
 
58
58
  io_handler_instance = io_handler.IOHandler()
59
- output_path = io_handler_instance.get_output_directory(label=label_name, sub_dir="productions")
59
+ output_path = io_handler_instance.get_output_directory()
60
60
 
61
61
  logger = logging.getLogger()
62
62
  logger.setLevel(gen.get_log_level_from_user(args["log_level"]))
@@ -28,7 +28,7 @@ def main(): # noqa: D103
28
28
  args, db_config = _parse(label_name)
29
29
 
30
30
  io_handler_instance = io_handler.IOHandler()
31
- output_path = io_handler_instance.get_output_directory(label=label_name, sub_dir="productions")
31
+ output_path = io_handler_instance.get_output_directory()
32
32
 
33
33
  logger = logging.getLogger()
34
34
  logger.setLevel(gen.get_log_level_from_user(args["log_level"]))
@@ -41,7 +41,7 @@ def main(): # noqa: D103
41
41
  label_name = "reports"
42
42
  args, db_config = _parse(label_name)
43
43
  io_handler_instance = io_handler.IOHandler()
44
- output_path = io_handler_instance.get_output_directory(label=label_name, sub_dir="parameters")
44
+ output_path = io_handler_instance.get_output_directory()
45
45
 
46
46
  logger = logging.getLogger()
47
47
  logger.setLevel(gen.get_log_level_from_user(args["log_level"]))
@@ -29,7 +29,7 @@ def main(): # noqa: D103
29
29
  args, db_config = _parse(label_name)
30
30
 
31
31
  io_handler_instance = io_handler.IOHandler()
32
- output_path = io_handler_instance.get_output_directory(label=label_name, sub_dir="productions")
32
+ output_path = io_handler_instance.get_output_directory()
33
33
 
34
34
  logger = logging.getLogger()
35
35
  logger.setLevel(gen.get_log_level_from_user(args["log_level"]))
@@ -286,7 +286,7 @@ def main(): # noqa: D103
286
286
  io_handler_instance = io_handler.IOHandler()
287
287
  args_dict, _ = _parse(label, description)
288
288
 
289
- output_path = io_handler_instance.get_output_directory(label, sub_dir="application-plots")
289
+ output_path = io_handler_instance.get_output_directory()
290
290
 
291
291
  logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
292
292
  initial_time = time.time()
@@ -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,9 +27,7 @@ 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
 
@@ -57,37 +55,12 @@ def _parse(label, description):
57
55
  required=True,
58
56
  help="Path to the simulation models repository.",
59
57
  )
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
58
  config.parser.add_argument(
67
59
  "--modifications",
68
60
  type=str,
69
61
  required=True,
70
62
  help="File containing the list of changes to apply.",
71
63
  )
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
64
 
92
65
  return config.initialize(db_config=False, output=False)
93
66
 
@@ -98,7 +71,10 @@ def main(): # noqa: D103
98
71
  logger = logging.getLogger()
99
72
  logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
100
73
 
101
- model_repository.generate_new_production(args_dict)
74
+ model_repository.generate_new_production(
75
+ modifications=args_dict["modifications"],
76
+ simulation_models_path=Path(args_dict["simulation_models_path"]),
77
+ )
102
78
 
103
79
 
104
80
  if __name__ == "__main__":
@@ -88,7 +88,7 @@ def main(): # noqa: D103
88
88
  args_dict["input_files"], [".hdf5", ".gz"]
89
89
  )
90
90
 
91
- output_path = io_handler.IOHandler().get_output_directory(label)
91
+ output_path = io_handler.IOHandler().get_output_directory()
92
92
  output_filepath = Path(output_path).joinpath(f"{args_dict['output_file']}")
93
93
 
94
94
  table_handler.merge_tables(
@@ -299,8 +299,7 @@ def main():
299
299
 
300
300
  visualize.save_figure(
301
301
  fig_out,
302
- io_handler_instance.get_output_directory(label, sub_dir="application-plots")
303
- / plot_file_name,
302
+ io_handler_instance.get_output_directory() / plot_file_name,
304
303
  dpi=400,
305
304
  )
306
305
  plt.close()
@@ -72,7 +72,7 @@ def main():
72
72
  ascii_handler.write_data_to_file(
73
73
  data=version_dict,
74
74
  output_file=io_handler_instance.get_output_file(
75
- args_dict.get("output_file", "simtools_version.json"), label=label
75
+ args_dict.get("output_file", "simtools_version.json")
76
76
  ),
77
77
  )
78
78
 
@@ -149,9 +149,8 @@ def main():
149
149
  logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
150
150
 
151
151
  _io_handler = io_handler.IOHandler()
152
- output_path = _io_handler.get_output_directory(label, sub_dir="")
153
152
 
154
- manager = ProductionStatisticsHandler(args_dict, output_path=output_path)
153
+ manager = ProductionStatisticsHandler(args_dict, output_path=_io_handler.get_output_directory())
155
154
  manager.run()
156
155
 
157
156
 
@@ -157,7 +157,7 @@ def main():
157
157
  _logger = logging.getLogger()
158
158
  _logger.setLevel(logging.INFO)
159
159
 
160
- output_path = io_handler.IOHandler().get_output_directory(label)
160
+ output_path = io_handler.IOHandler().get_output_directory()
161
161
  output_filepath = Path(output_path).joinpath(f"{args_dict['output_file']}")
162
162
 
163
163
  axes = load_axes(args_dict["axes"])
@@ -1,48 +1,59 @@
1
1
  #!/usr/bin/python3
2
2
 
3
3
  r"""
4
- Simulate flasher devices using the light emission package.
4
+ Simulate flasher devices used e.g. for camera flat fielding.
5
5
 
6
- Run the application in the command line.
6
+ The flasher simulation allows for two different run modes:
7
+
8
+ 1. Direct injection of light into the camera (bypassing the telescope optics).
9
+ 2. Simulation of the full light path (using the light-emission package from sim_telarray).
10
+
11
+ The direct injection mode uses a simplified model for the flasher light source. Both run modes
12
+ provide events in sim_telarray format that can be processed by standard analysis steps or
13
+ visualized using e.g. the 'simtools-plot-simtel-events' application.
7
14
 
8
15
  Example Usage
9
16
  -------------
10
17
 
11
- 1. Simulate flashers for a telescope:
18
+ 1. Simulate flashers for a telescope (direct injection):
19
+
20
+ .. code-block:: console
21
+
22
+ simtools-simulate-flasher --run_mode direct_injection \
23
+ --light_source MSFx-FlashCam --model_version 6.0.0 \
24
+ --array_layout_name subsystem_msts --site South \
25
+ --run_number 3
26
+
27
+ 2. Simulate flashers for a telescope (detailed simulation):
12
28
 
13
29
  .. code-block:: console
14
30
 
15
- simtools-simulate-flasher --telescope MSTN-04 --site North \
16
- --flasher FLSN-01 --model_version 6.0.0
31
+ simtools-simulate-flasher --run_mode full_simulation \
32
+ --light_source MSFx-FlashCam --model_version 6.0.0 \
33
+ --telescope MSTS-04 --site South
17
34
 
18
35
  Command Line Arguments
19
36
  ----------------------
37
+ run_mode (str, required)
38
+ Run mode, either "direct_injection" or "full_simulation".
20
39
  telescope (str, required)
21
40
  Telescope model name (e.g. LSTN-01, MSTN-04, SSTS-04, ...)
22
41
  site (str, required)
23
42
  Site name (North or South).
24
- flasher (str, required)
25
- Flasher device in array, e.g., FLSN-01.
43
+ light_source (str, required)
44
+ Calibration light source, e.g., MSFx-FlashCam
26
45
  number_of_events (int, optional):
27
46
  Number of events to simulate (default: 1).
28
47
  output_prefix (str, optional):
29
48
  Prefix for output files (default: empty).
30
49
  model_version (str, optional)
31
50
  Version of the simulation model.
32
-
33
- Example
34
- -------
35
-
36
- Simulate flashers for MSTN-04:
37
-
38
- .. code-block:: console
39
-
40
- simtools-simulate-flasher --telescope MSTN-04 --site North \
41
- --flasher FLSN-01 --model_version 6.0.0
42
-
43
- Expected Output:
44
- The simulation will run the light emission package for the flasher
45
- devices and produce the output files.
51
+ array_layout_name (str, optional)
52
+ Name of the array layout to use (required for direct injection mode).
53
+ run_number (int, optional)
54
+ Run number to use (default: 1, required for direct injection mode).
55
+ telescope (str, optional)
56
+ Telescope name (required for full simulation mode).
46
57
  """
47
58
 
48
59
  import logging
@@ -50,91 +61,82 @@ from pathlib import Path
50
61
 
51
62
  import simtools.utils.general as gen
52
63
  from simtools.configuration import configurator
53
- from simtools.model.flasher_model import FlasherModel
54
- from simtools.model.model_utils import initialize_simulation_models
55
64
  from simtools.simtel.simulator_light_emission import SimulatorLightEmission
65
+ from simtools.simulator import Simulator
56
66
 
57
67
 
58
68
  def _parse(label):
59
69
  """Parse command line configuration."""
60
- config = configurator.Configurator(
61
- label=label,
62
- description=("Simulate flasher devices using the light emission package."),
70
+ config = configurator.Configurator(label=label, description="Simulate flasher devices.")
71
+ config.parser.add_argument(
72
+ "--run_mode",
73
+ help="Flasher simulation run mode",
74
+ type=str,
75
+ choices=["direct_injection", "full_simulation"],
76
+ required=True,
77
+ default="direct_injection",
63
78
  )
64
79
  config.parser.add_argument(
65
- "--flasher",
66
- help="Flasher device in array associated with a specific telescope, i.e. FLSN-01",
80
+ "--light_source",
81
+ help="Flasher device associated with a specific telescope, i.e. MSFx-FlashCam",
67
82
  type=str,
68
83
  required=True,
69
84
  )
70
85
  config.parser.add_argument(
71
- "--number_events",
72
- help="Number of number_events to simulate (default: 1)",
86
+ "--number_of_events",
87
+ help="Number of flasher events to simulate",
73
88
  type=int,
74
89
  default=1,
75
90
  required=False,
76
91
  )
77
92
  config.parser.add_argument(
78
93
  "--output_prefix",
79
- help="Prefix for output files (default: empty)",
94
+ help="Prefix for output files",
80
95
  type=str,
81
96
  default=None,
82
97
  required=False,
83
98
  )
84
-
85
99
  return config.initialize(
86
100
  db_config=True,
87
- simulation_model=["telescope", "model_version"],
88
- require_command_line=True,
101
+ simulation_model=["site", "layout", "telescope", "model_version"],
102
+ simulation_configuration={
103
+ "corsika_configuration": ["run_number"],
104
+ "sim_telarray_configuration": ["all"],
105
+ },
89
106
  )
90
107
 
91
108
 
92
- def flasher_configs():
93
- """Return default setup for flasher runs (no distances)."""
94
- return {"light_source_setup": "layout"}
95
-
96
-
97
109
  def main():
98
- """Run the application."""
110
+ """Simulate flasher devices."""
99
111
  label = Path(__file__).stem
100
- logger = logging.getLogger(__name__)
101
112
 
102
113
  args_dict, db_config = _parse(label)
114
+ logger = logging.getLogger()
103
115
  logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
104
116
 
105
- telescope_model, site_model = initialize_simulation_models(
106
- label=label,
107
- db_config=db_config,
108
- site=args_dict["site"],
109
- telescope_name=args_dict["telescope"],
110
- model_version=args_dict["model_version"],
117
+ logger.info(
118
+ f"Flasher simulation for telescope {args_dict['telescope']} "
119
+ f" with light source {args_dict['light_source']} "
120
+ f" ({args_dict['number_of_events']} events, run mode: {args_dict['run_mode']})"
111
121
  )
112
122
 
113
- flasher_model = FlasherModel(
114
- site=args_dict["site"],
115
- flasher_device_model_name=args_dict["flasher"],
116
- mongo_db_config=db_config,
117
- model_version=args_dict["model_version"],
118
- label=label,
119
- )
120
-
121
- flasher_cfg = flasher_configs()
122
-
123
- sim_runner = SimulatorLightEmission(
124
- telescope_model=telescope_model,
125
- flasher_model=flasher_model,
126
- site_model=site_model,
127
- light_emission_config=args_dict,
128
- light_source_setup=flasher_cfg["light_source_setup"],
129
- simtel_path=args_dict["simtel_path"],
130
- light_source_type="flasher",
131
- label=args_dict["label"],
132
- test=args_dict.get("test", False),
133
- )
134
-
135
- sim_runner.run_simulation()
136
-
137
- logger.info("Flasher simulation completed. Use simtools-plot-simtel-number_events for plots.")
123
+ if args_dict["run_mode"] == "full_simulation":
124
+ light_source = SimulatorLightEmission(
125
+ light_emission_config=args_dict,
126
+ db_config=db_config,
127
+ label=args_dict.get("label"),
128
+ )
129
+ elif args_dict["run_mode"] == "direct_injection":
130
+ light_source = Simulator(
131
+ args_dict=args_dict,
132
+ db_config=db_config,
133
+ label=args_dict.get("label"),
134
+ )
135
+ else:
136
+ raise ValueError(f"Unsupported run_mode: {args_dict['run_mode']}")
137
+
138
+ light_source.simulate()
139
+ logger.info("Flasher simulation completed.")
138
140
 
139
141
 
140
142
  if __name__ == "__main__":