gammasimtools 0.18.0__py3-none-any.whl → 0.20.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 (367) hide show
  1. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/METADATA +24 -69
  2. gammasimtools-0.20.0.dist-info/RECORD +395 -0
  3. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/entry_points.txt +11 -4
  4. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/licenses/LICENSE +1 -1
  5. simtools/_version.py +16 -3
  6. simtools/applications/calculate_incident_angles.py +182 -0
  7. simtools/applications/convert_all_model_parameters_from_simtel.py +4 -3
  8. simtools/applications/convert_geo_coordinates_of_array_elements.py +3 -3
  9. simtools/applications/db_add_simulation_model_from_repository_to_db.py +17 -14
  10. simtools/applications/db_add_value_from_json_to_db.py +8 -10
  11. simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +8 -13
  12. simtools/applications/db_generate_compound_indexes.py +65 -0
  13. simtools/applications/db_get_file_from_db.py +12 -24
  14. simtools/applications/db_get_parameter_from_db.py +4 -4
  15. simtools/applications/db_inspect_databases.py +20 -10
  16. simtools/applications/derive_mirror_rnda.py +17 -11
  17. simtools/applications/derive_psf_parameters.py +59 -309
  18. simtools/applications/derive_trigger_rates.py +91 -0
  19. simtools/applications/docs_produce_array_element_report.py +1 -1
  20. simtools/applications/docs_produce_calibration_reports.py +1 -1
  21. simtools/applications/docs_produce_model_parameter_reports.py +1 -1
  22. simtools/applications/docs_produce_simulation_configuration_report.py +1 -1
  23. simtools/applications/generate_corsika_histograms.py +1 -1
  24. simtools/applications/generate_default_metadata.py +8 -24
  25. simtools/applications/generate_simtel_event_data.py +11 -11
  26. simtools/applications/maintain_simulation_model_add_production_table.py +71 -0
  27. simtools/applications/maintain_simulation_model_compare_productions.py +98 -0
  28. simtools/applications/{verify_simulation_model_production_tables.py → maintain_simulation_model_verify_production_tables.py} +9 -1
  29. simtools/applications/merge_tables.py +2 -2
  30. simtools/applications/plot_array_layout.py +3 -3
  31. simtools/applications/plot_simtel_events.py +421 -0
  32. simtools/applications/plot_tabular_data.py +9 -2
  33. simtools/applications/plot_tabular_data_for_model_parameter.py +2 -1
  34. simtools/applications/print_version.py +8 -9
  35. simtools/applications/production_derive_corsika_limits.py +6 -7
  36. simtools/applications/production_derive_statistics.py +1 -1
  37. simtools/applications/production_generate_grid.py +2 -2
  38. simtools/applications/production_merge_corsika_limits.py +214 -0
  39. simtools/applications/run_application.py +47 -113
  40. simtools/applications/simulate_calibration_events.py +166 -0
  41. simtools/applications/simulate_flasher.py +141 -0
  42. simtools/applications/{simulate_light_emission.py → simulate_illuminator.py} +35 -99
  43. simtools/applications/simulate_prod.py +6 -24
  44. simtools/applications/simulate_prod_htcondor_generator.py +7 -0
  45. simtools/applications/submit_array_layouts.py +2 -1
  46. simtools/applications/submit_model_parameter_from_external.py +1 -1
  47. simtools/applications/validate_camera_efficiency.py +30 -12
  48. simtools/applications/validate_camera_fov.py +1 -1
  49. simtools/applications/validate_cumulative_psf.py +1 -1
  50. simtools/applications/validate_file_using_schema.py +9 -5
  51. simtools/applications/validate_optics.py +1 -1
  52. simtools/camera/camera_efficiency.py +61 -45
  53. simtools/camera/single_photon_electron_spectrum.py +1 -1
  54. simtools/configuration/commandline_parser.py +46 -11
  55. simtools/configuration/configurator.py +4 -4
  56. simtools/corsika/corsika_config.py +45 -25
  57. simtools/corsika/corsika_histograms.py +6 -5
  58. simtools/data_model/data_reader.py +2 -3
  59. simtools/data_model/metadata_collector.py +32 -36
  60. simtools/data_model/metadata_model.py +15 -12
  61. simtools/data_model/model_data_writer.py +13 -32
  62. simtools/data_model/schema.py +74 -24
  63. simtools/data_model/validate_data.py +42 -12
  64. simtools/db/db_handler.py +125 -62
  65. simtools/db/db_model_upload.py +14 -19
  66. simtools/dependencies.py +98 -30
  67. simtools/io/ascii_handler.py +279 -0
  68. simtools/{io_operations → io}/io_handler.py +25 -3
  69. simtools/job_execution/htcondor_script_generator.py +15 -4
  70. simtools/layout/array_layout.py +1 -1
  71. simtools/layout/array_layout_utils.py +51 -12
  72. simtools/model/array_model.py +41 -5
  73. simtools/model/flasher_model.py +106 -0
  74. simtools/model/model_parameter.py +4 -4
  75. simtools/model/model_repository.py +197 -2
  76. simtools/model/site_model.py +25 -0
  77. simtools/model/telescope_model.py +3 -1
  78. simtools/production_configuration/derive_corsika_limits.py +336 -427
  79. simtools/production_configuration/derive_production_statistics_handler.py +7 -6
  80. simtools/production_configuration/generate_production_grid.py +9 -11
  81. simtools/production_configuration/merge_corsika_limits.py +528 -0
  82. simtools/ray_tracing/incident_angles.py +706 -0
  83. simtools/ray_tracing/mirror_panel_psf.py +1 -0
  84. simtools/ray_tracing/psf_parameter_optimisation.py +792 -0
  85. simtools/ray_tracing/ray_tracing.py +6 -2
  86. simtools/reporting/docs_read_parameters.py +150 -62
  87. simtools/runners/corsika_runner.py +1 -1
  88. simtools/runners/corsika_simtel_runner.py +14 -5
  89. simtools/runners/runner_services.py +10 -5
  90. simtools/runners/simtools_runner.py +267 -0
  91. simtools/schemas/application_workflow.metaschema.yml +101 -68
  92. simtools/schemas/input/MST_mirror_2f_measurements.schema.yml +1 -1
  93. simtools/schemas/input/single_pe_spectrum.schema.yml +1 -1
  94. simtools/schemas/metadata.metaschema.yml +577 -3
  95. simtools/schemas/model_parameter.metaschema.yml +6 -6
  96. simtools/schemas/model_parameter_and_data_schema.metaschema.yml +4 -4
  97. simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
  98. simtools/schemas/model_parameters/altitude.schema.yml +1 -1
  99. simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
  100. simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +1 -1
  101. simtools/schemas/model_parameters/array_element_position_ground.schema.yml +1 -1
  102. simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
  103. simtools/schemas/model_parameters/array_layouts.schema.yml +1 -1
  104. simtools/schemas/model_parameters/array_triggers.schema.yml +1 -1
  105. simtools/schemas/model_parameters/array_window.schema.yml +1 -1
  106. simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
  107. simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
  108. simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
  109. simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
  110. simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
  111. simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +1 -1
  112. simtools/schemas/model_parameters/axes_offsets.schema.yml +1 -1
  113. simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
  114. simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
  115. simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
  116. simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
  117. simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
  118. simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
  119. simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
  120. simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
  121. simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +1 -1
  122. simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
  123. simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
  124. simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
  125. simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
  126. simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +1 -1
  127. simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +1 -1
  128. simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +1 -1
  129. simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
  130. simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
  131. simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
  132. simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +1 -1
  133. simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
  134. simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +1 -1
  135. simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +3 -3
  136. simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
  137. simtools/schemas/model_parameters/default_trigger.schema.yml +1 -1
  138. simtools/schemas/model_parameters/design_model.schema.yml +1 -1
  139. simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +1 -1
  140. simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
  141. simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
  142. simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
  143. simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
  144. simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
  145. simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
  146. simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
  147. simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
  148. simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +1 -1
  149. simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
  150. simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
  151. simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
  152. simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
  153. simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
  154. simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
  155. simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
  156. simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
  157. simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
  158. simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
  159. simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
  160. simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
  161. simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
  162. simtools/schemas/model_parameters/dsum_pedsub.schema.yml +1 -1
  163. simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
  164. simtools/schemas/model_parameters/dsum_prescale.schema.yml +1 -1
  165. simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
  166. simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
  167. simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
  168. simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +1 -1
  169. simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -2
  170. simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
  171. simtools/schemas/model_parameters/effective_focal_length.schema.yml +1 -1
  172. simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
  173. simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +1 -1
  174. simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
  175. simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
  176. simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
  177. simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
  178. simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
  179. simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
  180. simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
  181. simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
  182. simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
  183. simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
  184. simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
  185. simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
  186. simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
  187. simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
  188. simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
  189. simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
  190. simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
  191. simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
  192. simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
  193. simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +35 -0
  194. simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +41 -0
  195. simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +38 -0
  196. simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
  197. simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
  198. simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
  199. simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
  200. simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
  201. simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +1 -1
  202. simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
  203. simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
  204. simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
  205. simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
  206. simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
  207. simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
  208. simtools/schemas/model_parameters/fake_mirror_list.schema.yml +1 -1
  209. simtools/schemas/model_parameters/flatfielding.schema.yml +1 -1
  210. simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
  211. simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +1 -1
  212. simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
  213. simtools/schemas/model_parameters/focus_offset.schema.yml +1 -1
  214. simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
  215. simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
  216. simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
  217. simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
  218. simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
  219. simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
  220. simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
  221. simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
  222. simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
  223. simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
  224. simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
  225. simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
  226. simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
  227. simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
  228. simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
  229. simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
  230. simtools/schemas/model_parameters/led_events.schema.yml +1 -1
  231. simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
  232. simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
  233. simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
  234. simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
  235. simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
  236. simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +50 -1
  237. simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
  238. simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
  239. simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
  240. simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +1 -1
  241. simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +1 -1
  242. simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
  243. simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
  244. simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
  245. simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
  246. simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
  247. simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +1 -1
  248. simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +1 -1
  249. simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +1 -1
  250. simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
  251. simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +1 -1
  252. simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +1 -1
  253. simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
  254. simtools/schemas/model_parameters/nsb_offaxis.schema.yml +1 -1
  255. simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
  256. simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +2 -2
  257. simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
  258. simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
  259. simtools/schemas/model_parameters/nsb_sky_map.schema.yml +1 -1
  260. simtools/schemas/model_parameters/nsb_spectrum.schema.yml +23 -30
  261. simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
  262. simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +1 -1
  263. simtools/schemas/model_parameters/optics_properties.schema.yml +1 -1
  264. simtools/schemas/model_parameters/parabolic_dish.schema.yml +1 -1
  265. simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
  266. simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
  267. simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
  268. simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
  269. simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
  270. simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
  271. simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
  272. simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
  273. simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
  274. simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +1 -1
  275. simtools/schemas/model_parameters/pm_transit_time.schema.yml +1 -1
  276. simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
  277. simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +1 -1
  278. simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
  279. simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
  280. simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +11 -1
  281. simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +1 -1
  282. simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
  283. simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
  284. simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
  285. simtools/schemas/model_parameters/quantum_efficiency.schema.yml +1 -1
  286. simtools/schemas/model_parameters/random_focal_length.schema.yml +1 -1
  287. simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
  288. simtools/schemas/model_parameters/random_mono_probability.schema.yml +1 -1
  289. simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
  290. simtools/schemas/model_parameters/reference_point_latitude.schema.yml +1 -1
  291. simtools/schemas/model_parameters/reference_point_longitude.schema.yml +1 -1
  292. simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
  293. simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
  294. simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
  295. simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
  296. simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +1 -1
  297. simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
  298. simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
  299. simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
  300. simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
  301. simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +11 -1
  302. simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +1 -1
  303. simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
  304. simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +11 -1
  305. simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
  306. simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
  307. simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
  308. simtools/schemas/model_parameters/stars.schema.yml +2 -2
  309. simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
  310. simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
  311. simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
  312. simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
  313. simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
  314. simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
  315. simtools/schemas/model_parameters/telescope_transmission.schema.yml +1 -1
  316. simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
  317. simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
  318. simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
  319. simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
  320. simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
  321. simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
  322. simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
  323. simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
  324. simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +1 -1
  325. simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
  326. simtools/schemas/plot_configuration.metaschema.yml +5 -2
  327. simtools/schemas/production_configuration_metrics.schema.yml +12 -2
  328. simtools/schemas/production_tables.schema.yml +7 -2
  329. simtools/simtel/simtel_config_reader.py +2 -2
  330. simtools/simtel/simtel_config_writer.py +33 -23
  331. simtools/simtel/simtel_io_event_histograms.py +483 -0
  332. simtools/simtel/simtel_io_event_reader.py +65 -43
  333. simtools/simtel/simtel_io_event_writer.py +40 -20
  334. simtools/simtel/simtel_io_metadata.py +1 -1
  335. simtools/simtel/simtel_table_reader.py +95 -13
  336. simtools/simtel/simulator_array.py +138 -10
  337. simtools/simtel/simulator_camera_efficiency.py +32 -23
  338. simtools/simtel/simulator_light_emission.py +437 -271
  339. simtools/simtel/simulator_ray_tracing.py +1 -1
  340. simtools/simulator.py +105 -147
  341. simtools/telescope_trigger_rates.py +119 -0
  342. simtools/testing/configuration.py +24 -26
  343. simtools/testing/helpers.py +2 -2
  344. simtools/testing/log_inspector.py +52 -0
  345. simtools/testing/validate_output.py +87 -37
  346. simtools/utils/general.py +125 -255
  347. simtools/utils/geometry.py +56 -0
  348. simtools/utils/names.py +1 -1
  349. simtools/visualization/legend_handlers.py +180 -264
  350. simtools/visualization/plot_array_layout.py +20 -8
  351. simtools/visualization/plot_incident_angles.py +431 -0
  352. simtools/visualization/plot_pixels.py +1 -1
  353. simtools/visualization/plot_simtel_event_histograms.py +376 -0
  354. simtools/visualization/plot_simtel_events.py +816 -0
  355. simtools/visualization/plot_tables.py +133 -37
  356. simtools/visualization/visualize.py +1 -100
  357. gammasimtools-0.18.0.dist-info/RECORD +0 -376
  358. simtools/applications/calculate_trigger_rate.py +0 -187
  359. simtools/applications/generate_sim_telarray_histograms.py +0 -196
  360. simtools/production_configuration/derive_corsika_limits_grid.py +0 -232
  361. simtools/simtel/simtel_io_histogram.py +0 -621
  362. simtools/simtel/simtel_io_histograms.py +0 -552
  363. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/WHEEL +0 -0
  364. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/top_level.txt +0 -0
  365. /simtools/{io_operations → io}/hdf5_handler.py +0 -0
  366. /simtools/{io_operations → io}/legacy_data_handler.py +0 -0
  367. /simtools/{io_operations/io_table_handler.py → io/table_handler.py} +0 -0
@@ -20,6 +20,7 @@ from simtools.corsika.primary_particle import PrimaryParticle
20
20
  from simtools.simtel.simtel_io_file_info import get_corsika_run_header
21
21
  from simtools.simtel.simtel_io_metadata import (
22
22
  get_sim_telarray_telescope_id_to_telescope_name_mapping,
23
+ read_sim_telarray_metadata,
23
24
  )
24
25
  from simtools.utils.geometry import calculate_circular_mean
25
26
  from simtools.utils.names import get_common_identifier_from_array_element_name
@@ -36,8 +37,8 @@ class TableSchemas:
36
37
  "simulated_energy": (np.float64, u.TeV),
37
38
  "x_core": (np.float64, u.m),
38
39
  "y_core": (np.float64, u.m),
39
- "shower_azimuth": (np.float64, u.rad),
40
- "shower_altitude": (np.float64, u.rad),
40
+ "shower_azimuth": (np.float64, u.deg),
41
+ "shower_altitude": (np.float64, u.deg),
41
42
  "area_weight": (np.float64, None),
42
43
  }
43
44
 
@@ -45,8 +46,8 @@ class TableSchemas:
45
46
  "shower_id": (np.uint32, None),
46
47
  "event_id": (np.uint32, None),
47
48
  "file_id": (np.uint32, None),
48
- "array_altitude": (np.float64, u.rad),
49
- "array_azimuth": (np.float64, u.rad),
49
+ "array_altitude": (np.float64, u.deg),
50
+ "array_azimuth": (np.float64, u.deg),
50
51
  "telescope_list": (str, None), # Store as comma-separated string
51
52
  "telescope_list_common_id": (str, None), # Store as comma-separated string
52
53
  }
@@ -175,7 +176,7 @@ class SimtelIOEventDataWriter:
175
176
  "core_scatter_max": run_info["core_range"][1],
176
177
  "zenith": 90.0 - np.degrees(run_info["direction"][1]),
177
178
  "azimuth": np.degrees(run_info["direction"][0]),
178
- "nsb_level": self._get_preliminary_nsb_level(str(file)),
179
+ "nsb_level": self.get_nsb_level_from_sim_telarray_metadata(file),
179
180
  }
180
181
  )
181
182
 
@@ -196,8 +197,8 @@ class SimtelIOEventDataWriter:
196
197
  "simulated_energy": shower["energy"],
197
198
  "x_core": None, # filled in _process_mc_event
198
199
  "y_core": None, # filled in _process_mc_event
199
- "shower_azimuth": shower["azimuth"],
200
- "shower_altitude": shower["altitude"],
200
+ "shower_azimuth": np.degrees(shower["azimuth"]),
201
+ "shower_altitude": np.degrees(shower["altitude"]),
201
202
  "area_weight": None, # filled in _process_mc_event
202
203
  }
203
204
  for _ in range(self.n_use)
@@ -247,8 +248,8 @@ class SimtelIOEventDataWriter:
247
248
  tracking_position = obj.parse()
248
249
  tracking_positions.append(
249
250
  {
250
- "altitude": tracking_position["altitude_raw"],
251
- "azimuth": tracking_position["azimuth_raw"],
251
+ "altitude": np.degrees(tracking_position["altitude_raw"]),
252
+ "azimuth": np.degrees(tracking_position["azimuth_raw"]),
252
253
  }
253
254
  )
254
255
 
@@ -271,7 +272,7 @@ class SimtelIOEventDataWriter:
271
272
  "event_id": event_id,
272
273
  "file_id": file_id,
273
274
  "array_altitude": float(np.mean(altitudes)),
274
- "array_azimuth": float(calculate_circular_mean(azimuths)),
275
+ "array_azimuth": float(np.degrees(calculate_circular_mean(np.deg2rad(azimuths)))),
275
276
  "telescope_list": ",".join(map(str, telescopes)),
276
277
  "telescope_list_common_id": ",".join(
277
278
  [
@@ -300,14 +301,33 @@ class SimtelIOEventDataWriter:
300
301
  self.telescope_id_to_name.get(tel_id, f"Unknown_{tel_id}") for tel_id in telescope_ids
301
302
  ]
302
303
 
303
- def _get_preliminary_nsb_level(self, file):
304
+ def get_nsb_level_from_sim_telarray_metadata(self, file):
304
305
  """
305
- Return preliminary NSB level from file name.
306
+ Return NSB level from sim_telarray metadata.
306
307
 
307
- Hardwired values are used for "dark", "half", and "full" NSB levels
308
- (actual values are made up for this example). Will be replaced with
309
- reading of sim_telarray metadata entry for NSB level (to be implemented,
310
- see issue #1572).
308
+ Falls back to preliminary NSB level if not found.
309
+
310
+ Parameters
311
+ ----------
312
+ file : Path
313
+ Path to the sim_telarray file.
314
+
315
+ Returns
316
+ -------
317
+ float
318
+ NSB level.
319
+ """
320
+ metadata, _ = read_sim_telarray_metadata(file)
321
+ nsb_integrated_flux = metadata.get("nsb_integrated_flux")
322
+ return nsb_integrated_flux or self._get_nsb_level_from_file_name(str(file))
323
+
324
+ def _get_nsb_level_from_file_name(self, file):
325
+ """
326
+ Return NSB level from file name.
327
+
328
+ Hardwired values are used for "dark", "half", and "full" NSB levels.
329
+ Allows to read legacy sim_telarray files without 'nsb_integrated_flux'
330
+ metadata field.
311
331
 
312
332
  Parameters
313
333
  ----------
@@ -319,15 +339,15 @@ class SimtelIOEventDataWriter:
319
339
  float
320
340
  NSB level extracted from file name.
321
341
  """
322
- nsb_levels = {"dark": 1.0, "half": 2.0, "full": 5.0}
342
+ nsb_levels = {"dark": 0.24, "half": 0.835, "full": 1.2}
323
343
 
324
344
  for key, value in nsb_levels.items():
325
345
  try:
326
346
  if key in file.lower():
327
- self._logger.warning(f"NSB level set to hardwired value of {value}")
347
+ self._logger.warning(f"NSB level set to hardwired value of {value} for {file}")
328
348
  return value
329
349
  except AttributeError as exc:
330
350
  raise AttributeError("Invalid file name.") from exc
331
351
 
332
- self._logger.warning("No NSB level found in file name, defaulting to 1.0")
333
- return 1.0
352
+ self._logger.warning(f"No NSB level found in {file}, defaulting to None")
353
+ return None
@@ -78,7 +78,7 @@ def _decode_dictionary(meta, encoding="utf8"):
78
78
  return {k.decode(encoding, errors="ignore"): v.decode(encoding) for k, v in meta.items()}
79
79
  except UnicodeDecodeError as e:
80
80
  _logger.warning(
81
- f"Failed to decode metadata with encoding {encoding}: {e}. "
81
+ f"Unable to decode metadata with encoding {encoding}: {e}. "
82
82
  "Falling back to 'utf-8' with errors='ignore'."
83
83
  )
84
84
  return {safe_decode(k, encoding): safe_decode(v, encoding) for k, v in meta.items()}
@@ -6,9 +6,10 @@ import re
6
6
  from pathlib import Path
7
7
 
8
8
  import astropy.units as u
9
+ import numpy as np
9
10
  from astropy.table import Table
10
11
 
11
- from simtools.utils import general as gen
12
+ from simtools.io import ascii_handler
12
13
 
13
14
  logger = logging.getLogger(__name__)
14
15
 
@@ -132,11 +133,6 @@ def _data_columns_camera_filter():
132
133
  )
133
134
 
134
135
 
135
- def _data_columns_lightguide_efficiency_vs_wavelength():
136
- """Column description for parameter lightguide_efficiency_vs_wavelength."""
137
- return _data_columns_lightguide_efficiency_vs_incidence_angle()
138
-
139
-
140
136
  def _data_columns_lightguide_efficiency_vs_incidence_angle():
141
137
  """Column description for (parameter lightguide_efficiency_vs_incidence_angle."""
142
138
  return (
@@ -201,6 +197,16 @@ def _data_columns_mirror_reflectivity(n_columns, n_dim):
201
197
  return _columns, "Mirror reflectivity"
202
198
 
203
199
 
200
+ def _data_columns_secondary_mirror_reflectivity():
201
+ """Column description for secondary mirror reflectivity."""
202
+ columns = [
203
+ {"name": "wavelength", "description": "Wavelength", "unit": "nm"},
204
+ {"name": "reflectivity", "description": "Reflectivity", "unit": None},
205
+ ]
206
+
207
+ return columns, "Secondary mirror reflectivity vs wavelength"
208
+
209
+
204
210
  def _data_columns_pulse_shape(n_columns):
205
211
  """Column description for parameters discriminator_pulse_shape, fadc_pulse_shape."""
206
212
  _columns = [
@@ -223,8 +229,8 @@ def _data_columns_pulse_shape(n_columns):
223
229
  return _columns, "Pulse shape"
224
230
 
225
231
 
226
- def _data_columns_nsb_reference_spectrum():
227
- """Column description for parameter nsb_reference_spectrum."""
232
+ def _data_columns_nsb_spectrum():
233
+ """Column description for parameters describing the nsb spectrum."""
228
234
  return (
229
235
  [
230
236
  {"name": "wavelength", "description": "Wavelength", "unit": "nm"},
@@ -234,7 +240,7 @@ def _data_columns_nsb_reference_spectrum():
234
240
  "unit": "1.e9 / (nm s m^2 sr)",
235
241
  },
236
242
  ],
237
- "NSB reference spectrum",
243
+ "NSB spectrum",
238
244
  )
239
245
 
240
246
 
@@ -259,6 +265,8 @@ def read_simtel_table(parameter_name, file_path):
259
265
 
260
266
  if parameter_name == "atmospheric_transmission":
261
267
  return _read_simtel_data_for_atmospheric_transmission(file_path)
268
+ if parameter_name == "lightguide_efficiency_vs_wavelength":
269
+ return _read_simtel_data_for_lightguide_efficiency(file_path)
262
270
 
263
271
  rows, meta_from_simtel, n_columns, n_dim = _read_simtel_data(file_path)
264
272
  columns_info, description = _data_columns(parameter_name, n_columns, n_dim)
@@ -291,6 +299,17 @@ def _adjust_columns_length(rows, n_columns):
291
299
  return [row[:n_columns] + [0.0] * max(0, n_columns - len(row)) for row in rows]
292
300
 
293
301
 
302
+ def _process_line_parts(parts):
303
+ """Convert parts to floats, skipping non-float entries."""
304
+ row = []
305
+ for p in parts:
306
+ try:
307
+ row.append(float(p))
308
+ except ValueError:
309
+ logger.debug(f"Skipping non-float part: {p}")
310
+ return row
311
+
312
+
294
313
  def _read_simtel_data(file_path):
295
314
  """
296
315
  Read data, comments, and (if available) axis definition from sim_telarray table.
@@ -311,7 +330,7 @@ def _read_simtel_data(file_path):
311
330
  n_dim_axis = None
312
331
  r_pol_axis = None
313
332
 
314
- lines = gen.read_file_encoded_in_utf_or_latin(file_path)
333
+ lines = ascii_handler.read_file_encoded_in_utf_or_latin(file_path)
315
334
 
316
335
  for line in lines:
317
336
  stripped = line.strip()
@@ -326,12 +345,75 @@ def _read_simtel_data(file_path):
326
345
  elif stripped: # Data
327
346
  data_lines.append(stripped.split("%%%")[0].split("#")[0].strip()) # Remove comments
328
347
 
329
- rows = [[float(part) for part in line.split()] for line in data_lines]
348
+ rows = [_process_line_parts(line.split()) for line in data_lines]
330
349
  n_columns = max(len(row) for row in rows) if rows else 0
331
350
 
332
351
  return rows, "\n".join(meta_lines), n_columns, n_dim_axis
333
352
 
334
353
 
354
+ def _read_simtel_data_for_lightguide_efficiency(file_path):
355
+ """
356
+ Read angular efficiency data and return a table with columns: angle, wavelength, efficiency.
357
+
358
+ Parameters
359
+ ----------
360
+ file_path : str or Path
361
+
362
+ Returns
363
+ -------
364
+ astropy.table.Table
365
+ """
366
+ wavelengths = []
367
+ data = []
368
+ meta_lines = []
369
+
370
+ lines = ascii_handler.read_file_encoded_in_utf_or_latin(file_path)
371
+
372
+ def extract_wavelengths_from_header(line):
373
+ match = re.search(r"orig\.:\s*(.*)", line)
374
+ return [float(wl.replace("nm", "")) for wl in match.group(1).split()]
375
+
376
+ for line in lines:
377
+ line = line.strip()
378
+
379
+ if not line:
380
+ continue
381
+
382
+ if line.startswith("#"):
383
+ meta_lines.append(line.lstrip("#").strip())
384
+ if "orig.:" in line:
385
+ wavelengths = extract_wavelengths_from_header(line)
386
+ continue
387
+
388
+ parts = line.split()
389
+ try:
390
+ theta = float(parts[0])
391
+ eff_values = list(map(float, parts[-len(wavelengths) :]))
392
+ data.extend((theta, wl, eff) for wl, eff in zip(wavelengths, eff_values))
393
+ except (ValueError, IndexError):
394
+ logger.debug(f"Skipping malformed line: {line}")
395
+ continue
396
+
397
+ if not data or not wavelengths:
398
+ raise ValueError("No valid data or wavelengths found in file")
399
+
400
+ table = Table(rows=data, names=["angle", "wavelength", "efficiency"])
401
+ table["angle"].unit = u.deg
402
+ table["wavelength"].unit = u.nm
403
+ table["efficiency"].unit = u.dimensionless_unscaled
404
+
405
+ table.meta.update(
406
+ {
407
+ "Name": "angular_efficiency",
408
+ "File": str(file_path),
409
+ "Description": "Angular efficiency vs wavelength",
410
+ "Context_from_sim_telarray": "\n".join(meta_lines),
411
+ }
412
+ )
413
+
414
+ return table
415
+
416
+
335
417
  def _read_simtel_data_for_atmospheric_transmission(file_path):
336
418
  """
337
419
  Read data and comments from sim_telarray table for atmospheric_transmission.
@@ -346,7 +428,7 @@ def _read_simtel_data_for_atmospheric_transmission(file_path):
346
428
  astropy table
347
429
  Table with atmospheric transmission.
348
430
  """
349
- lines = lines = gen.read_file_encoded_in_utf_or_latin(file_path)
431
+ lines = ascii_handler.read_file_encoded_in_utf_or_latin(file_path)
350
432
 
351
433
  observatory_level, height_bins = _read_header_line_for_atmospheric_transmission(
352
434
  lines, file_path
@@ -366,7 +448,7 @@ def _read_simtel_data_for_atmospheric_transmission(file_path):
366
448
  wl = float(parts[0])
367
449
  for i, height in enumerate(height_bins):
368
450
  extinction_value = float(parts[i + 1])
369
- if extinction_value == 99999.0:
451
+ if np.isclose(extinction_value, 99999.0):
370
452
  continue
371
453
  wavelengths.append(wl)
372
454
  heights.append(height)
@@ -2,7 +2,7 @@
2
2
 
3
3
  import logging
4
4
 
5
- from simtools.io_operations import io_handler
5
+ from simtools.io import io_handler
6
6
  from simtools.runners.simtel_runner import InvalidOutputFileError, SimtelRunner
7
7
  from simtools.utils.general import clear_default_sim_telarray_cfg_directories
8
8
 
@@ -68,6 +68,73 @@ class SimulatorArray(SimtelRunner):
68
68
  str
69
69
  Command to run sim_telarray.
70
70
  """
71
+ command = self._common_run_command(run_number, weak_pointing)
72
+
73
+ command += f" {input_file}"
74
+ command += f" | gzip > {self._log_file} 2>&1 || exit"
75
+ command += super().get_config_option(
76
+ "power_law",
77
+ SimulatorArray.get_power_law_for_sim_telarray_histograms(
78
+ self.corsika_config.primary_particle
79
+ ),
80
+ )
81
+
82
+ return clear_default_sim_telarray_cfg_directories(command)
83
+
84
+ def make_run_command_for_calibration_simulations(
85
+ self, run_number=None, input_file=None, calibration_runner_args=None
86
+ ):
87
+ """
88
+ Build and return the command to run sim_telarray for calibration simulations.
89
+
90
+ Parameters
91
+ ----------
92
+ calibration_runner_args: dict
93
+ Dictionary with calibration runner arguments.
94
+ input_file: str
95
+ Full path of the input CORSIKA file
96
+ run_number: int (optional)
97
+ run number
98
+
99
+ Returns
100
+ -------
101
+ str
102
+ Command to run sim_telarray for pedestal simulations.
103
+ """
104
+ command = self._common_run_command(run_number)
105
+
106
+ command += super().get_config_option(
107
+ "Altitude",
108
+ self.corsika_config.array_model.site_model.get_parameter_value_with_unit(
109
+ "reference_point_altitude"
110
+ ).to_value("m"),
111
+ )
112
+ command += super().get_config_option(
113
+ "nsb_scaling_factor", calibration_runner_args["nsb_scaling_factor"]
114
+ )
115
+ if calibration_runner_args.get("stars"):
116
+ command += super().get_config_option("stars", calibration_runner_args["stars"])
117
+
118
+ if calibration_runner_args.get("run_mode") in ("pedestals", "nsb_only_pedestals"):
119
+ command += super().get_config_option(
120
+ "pedestal_events", calibration_runner_args["number_of_events"]
121
+ )
122
+ if calibration_runner_args.get("run_mode") == "nsb_only_pedestals":
123
+ command += self._nsb_only_pedestals_command()
124
+ if calibration_runner_args.get("run_mode") == "dark_pedestals":
125
+ command += super().get_config_option(
126
+ "dark_events", calibration_runner_args["number_of_events"]
127
+ )
128
+ if calibration_runner_args.get("run_mode") == "flasher":
129
+ command += self._flasher_command(calibration_runner_args)
130
+
131
+ command += f" {input_file}"
132
+ command += f" | gzip > {self._log_file} 2>&1 || exit"
133
+
134
+ return clear_default_sim_telarray_cfg_directories(command)
135
+
136
+ def _common_run_command(self, run_number, weak_pointing=None):
137
+ """Build generic run command for sim_telarray."""
71
138
  config_dir = self.corsika_config.array_model.get_config_directory()
72
139
  self._log_file = self.get_file_name(file_type="log", run_number=run_number)
73
140
  histogram_file = self.get_file_name(file_type="histogram", run_number=run_number)
@@ -83,12 +150,6 @@ class SimulatorArray(SimtelRunner):
83
150
  command += super().get_config_option(
84
151
  "telescope_phi", self.corsika_config.azimuth_angle, weak_pointing
85
152
  )
86
- command += super().get_config_option(
87
- "power_law",
88
- SimulatorArray.get_power_law_for_sim_telarray_histograms(
89
- self.corsika_config.primary_particle
90
- ),
91
- )
92
153
  command += super().get_config_option("histogram_file", histogram_file)
93
154
  command += super().get_config_option("random_state", "none")
94
155
  if self.sim_telarray_seeds and self.sim_telarray_seeds.get("random_instrument_instances"):
@@ -100,10 +161,77 @@ class SimulatorArray(SimtelRunner):
100
161
  command += super().get_config_option("random_seed", self.sim_telarray_seeds["seed"])
101
162
  command += super().get_config_option("show", "all")
102
163
  command += super().get_config_option("output_file", output_file)
103
- command += f" {input_file}"
104
- command += f" | gzip > {self._log_file} 2>&1 || exit"
105
164
 
106
- return clear_default_sim_telarray_cfg_directories(command)
165
+ return command
166
+
167
+ def _flasher_command(self, calibration_runner_args):
168
+ """
169
+ Generate the command to run sim_telarray for flasher simulations.
170
+
171
+ Parameters
172
+ ----------
173
+ calibration_runner_args: dict
174
+ Dictionary with calibration runner arguments.
175
+
176
+ Returns
177
+ -------
178
+ str
179
+ Command to run sim_telarray for flasher simulations.
180
+ """
181
+ command = super().get_config_option(
182
+ "laser_events", calibration_runner_args["number_of_events"]
183
+ )
184
+ command += super().get_config_option(
185
+ "laser_photons", calibration_runner_args["flasher_photons"]
186
+ )
187
+ command += super().get_config_option(
188
+ "laser_var_photons", calibration_runner_args["flasher_var_photons"]
189
+ )
190
+ command += super().get_config_option(
191
+ "laser_pulse_exptime", calibration_runner_args["flasher_exp_time"]
192
+ )
193
+ command += super().get_config_option(
194
+ "laser_pulse_sigtime", calibration_runner_args["flasher_sig_time"]
195
+ )
196
+ command += super().get_config_option("laser_external_trigger", 1)
197
+
198
+ return command
199
+
200
+ def _nsb_only_pedestals_command(self):
201
+ """
202
+ Generate the command to run sim_telarray for nsb-only pedestal simulations.
203
+
204
+ Returns
205
+ -------
206
+ str
207
+ Command to run sim_telarray.
208
+ """
209
+ null_values = [
210
+ "fadc_noise",
211
+ "fadc_lg_noise",
212
+ "qe_variation",
213
+ "gain_variation",
214
+ "fadc_var_pedestal",
215
+ "fadc_err_pedestal",
216
+ "fadc_sysvar_pedestal",
217
+ "fadc_dev_pedestal",
218
+ ]
219
+ null_command_parts = []
220
+ for param in null_values:
221
+ null_command_parts.append(super().get_config_option(param, 0.0))
222
+ command = " ".join(null_command_parts)
223
+
224
+ one_values = [
225
+ "fadc_lg_var_pedestal",
226
+ "fadc_lg_err_pedestal",
227
+ "fadc_lg_dev_pedestal",
228
+ "fadc_lg_sysvar_pedestal",
229
+ ]
230
+ one_command_parts = []
231
+ for param in one_values:
232
+ one_command_parts.append(super().get_config_option(param, -1.0))
233
+ command += " " + " ".join(one_command_parts)
234
+ return command
107
235
 
108
236
  def _check_run_result(self, run_number=None):
109
237
  """
@@ -3,7 +3,7 @@
3
3
  import logging
4
4
  from pathlib import Path
5
5
 
6
- from simtools.model.model_parameter import InvalidModelParameterError
6
+ from simtools.io import ascii_handler
7
7
  from simtools.runners.simtel_runner import SimtelRunner
8
8
  from simtools.utils import general
9
9
 
@@ -82,41 +82,27 @@ class SimulatorCameraEfficiency(SimtelRunner):
82
82
  """Prepare the command used to run testeff."""
83
83
  self._logger.debug("Preparing the command to run testeff")
84
84
 
85
- # Processing camera pixel features
86
85
  pixel_shape = self._telescope_model.camera.get_pixel_shape()
87
86
  pixel_shape_cmd = "-hpix" if pixel_shape in [1, 3] else "-spix"
88
87
  pixel_diameter = self._telescope_model.camera.get_pixel_diameter()
89
88
 
90
- # Processing focal length
91
89
  focal_length = self._telescope_model.get_telescope_effective_focal_length("m", True)
92
90
 
93
- # Processing mirror class
94
- mirror_class = 1
95
- try:
96
- mirror_class = self._telescope_model.get_parameter_value("mirror_class")
97
- except InvalidModelParameterError:
98
- pass
99
-
100
- # Processing camera transmission
101
- camera_transmission = 1
102
- try:
103
- camera_transmission = self._telescope_model.get_parameter_value("camera_transmission")
104
- except KeyError:
105
- pass
106
-
107
- # Processing camera filter
108
- # A special case is testeff does not support 2D distributions
91
+ mirror_class = self._telescope_model.get_parameter_value("mirror_class")
92
+ curvature_radius = self._get_curvature_radius(mirror_class)
93
+ camera_transmission = self._telescope_model.get_parameter_value("camera_transmission")
94
+
109
95
  camera_filter_file = self._telescope_model.get_parameter_value("camera_filter")
96
+ # testeff does not support 2D distributions
110
97
  if self._telescope_model.is_file_2d("camera_filter"):
111
98
  camera_filter_file = self._get_one_dim_distribution(
112
99
  "camera_filter", "camera_filter_incidence_angle"
113
100
  )
114
101
 
115
- # Processing mirror reflectivity
116
- # A special case is testeff does not support 2D distributions
117
102
  mirror_reflectivity = self._telescope_model.get_parameter_value("mirror_reflectivity")
118
103
  if mirror_class == 2:
119
104
  mirror_reflectivity_secondary = mirror_reflectivity
105
+ # testeff does not support 2D distributions
120
106
  if self._telescope_model.is_file_2d("mirror_reflectivity"):
121
107
  mirror_reflectivity = self._get_one_dim_distribution(
122
108
  "mirror_reflectivity", "primary_mirror_incidence_angle"
@@ -136,6 +122,7 @@ class SimulatorCameraEfficiency(SimtelRunner):
136
122
  command += f" -alt {self._site_model.get_parameter_value('corsika_observation_level')}"
137
123
  command += f" -fatm {self._site_model.get_parameter_value('atmospheric_transmission')}"
138
124
  command += f" -flen {focal_length}"
125
+ command += f" -fcur {curvature_radius:.3f}"
139
126
  command += f" {pixel_shape_cmd} {pixel_diameter}"
140
127
  if mirror_class == 0:
141
128
  command += f" -fmir {self._telescope_model.get_parameter_value('mirror_list')}"
@@ -227,7 +214,8 @@ class SimulatorCameraEfficiency(SimtelRunner):
227
214
  two_dim_distribution, incidence_angle_distribution
228
215
  )
229
216
  new_file_name = (
230
- f"weighted_average_1D_{self._telescope_model.get_parameter_value(two_dim_parameter)}"
217
+ f"weighted_average_1D_{weighting_distribution_parameter}"
218
+ f"_{self._telescope_model.get_parameter_value(two_dim_parameter)}"
231
219
  )
232
220
  return self._telescope_model.export_table_to_model_directory(
233
221
  new_file_name, distribution_to_export
@@ -257,7 +245,7 @@ class SimulatorCameraEfficiency(SimtelRunner):
257
245
  self._telescope_model.config_file_directory / Path(nsb_spectrum_file).name
258
246
  )
259
247
 
260
- lines = general.read_file_encoded_in_utf_or_latin(nsb_spectrum_file)
248
+ lines = ascii_handler.read_file_encoded_in_utf_or_latin(nsb_spectrum_file)
261
249
 
262
250
  with open(validated_nsb_spectrum_file, "w", encoding="utf-8") as file:
263
251
  for line in lines:
@@ -271,3 +259,24 @@ class SimulatorCameraEfficiency(SimtelRunner):
271
259
  else:
272
260
  file.write(line)
273
261
  return validated_nsb_spectrum_file
262
+
263
+ def _get_curvature_radius(self, mirror_class=1):
264
+ """Get radius of curvature of dish."""
265
+ if mirror_class == 2:
266
+ return (
267
+ self._telescope_model.get_parameter_value_with_unit("primary_mirror_diameter")
268
+ .to("m")
269
+ .value
270
+ )
271
+
272
+ if self._telescope_model.get_parameter_value("parabolic_dish"):
273
+ return (
274
+ 2.0
275
+ * self._telescope_model.get_parameter_value_with_unit("dish_shape_length")
276
+ .to("m")
277
+ .value
278
+ )
279
+
280
+ return (
281
+ self._telescope_model.get_parameter_value_with_unit("dish_shape_length").to("m").value
282
+ )