gammasimtools 0.18.0__py3-none-any.whl → 0.19.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 (358) hide show
  1. {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/METADATA +26 -69
  2. gammasimtools-0.19.0.dist-info/RECORD +393 -0
  3. {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/entry_points.txt +9 -2
  4. {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/licenses/LICENSE +1 -1
  5. simtools/_version.py +16 -3
  6. simtools/applications/calculate_trigger_rate.py +1 -1
  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_value_from_json_to_db.py +2 -1
  10. simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +8 -13
  11. simtools/applications/db_generate_compound_indexes.py +61 -0
  12. simtools/applications/db_get_file_from_db.py +1 -1
  13. simtools/applications/db_get_parameter_from_db.py +4 -4
  14. simtools/applications/db_inspect_databases.py +20 -10
  15. simtools/applications/derive_mirror_rnda.py +17 -11
  16. simtools/applications/derive_psf_parameters.py +59 -309
  17. simtools/applications/docs_produce_array_element_report.py +1 -1
  18. simtools/applications/docs_produce_calibration_reports.py +1 -1
  19. simtools/applications/docs_produce_model_parameter_reports.py +1 -1
  20. simtools/applications/docs_produce_simulation_configuration_report.py +1 -1
  21. simtools/applications/generate_corsika_histograms.py +1 -1
  22. simtools/applications/generate_default_metadata.py +8 -24
  23. simtools/applications/generate_sim_telarray_histograms.py +1 -1
  24. simtools/applications/generate_simtel_event_data.py +11 -11
  25. simtools/applications/maintain_simulation_model_add_production_table.py +71 -0
  26. simtools/applications/maintain_simulation_model_compare_productions.py +98 -0
  27. simtools/applications/{verify_simulation_model_production_tables.py → maintain_simulation_model_verify_production_tables.py} +9 -1
  28. simtools/applications/merge_tables.py +2 -2
  29. simtools/applications/plot_array_layout.py +3 -3
  30. simtools/applications/plot_simtel_events.py +379 -0
  31. simtools/applications/plot_tabular_data.py +9 -2
  32. simtools/applications/plot_tabular_data_for_model_parameter.py +2 -1
  33. simtools/applications/print_version.py +8 -9
  34. simtools/applications/production_derive_corsika_limits.py +6 -7
  35. simtools/applications/production_derive_statistics.py +1 -1
  36. simtools/applications/production_generate_grid.py +2 -2
  37. simtools/applications/production_merge_corsika_limits.py +214 -0
  38. simtools/applications/run_application.py +47 -113
  39. simtools/applications/simulate_calibration_events.py +166 -0
  40. simtools/applications/simulate_flasher.py +141 -0
  41. simtools/applications/{simulate_light_emission.py → simulate_illuminator.py} +35 -99
  42. simtools/applications/simulate_prod.py +6 -24
  43. simtools/applications/simulate_prod_htcondor_generator.py +7 -0
  44. simtools/applications/submit_array_layouts.py +2 -1
  45. simtools/applications/submit_model_parameter_from_external.py +1 -1
  46. simtools/applications/validate_camera_efficiency.py +30 -12
  47. simtools/applications/validate_camera_fov.py +1 -1
  48. simtools/applications/validate_cumulative_psf.py +1 -1
  49. simtools/applications/validate_file_using_schema.py +2 -1
  50. simtools/applications/validate_optics.py +1 -1
  51. simtools/camera/camera_efficiency.py +61 -45
  52. simtools/camera/single_photon_electron_spectrum.py +1 -1
  53. simtools/configuration/commandline_parser.py +29 -0
  54. simtools/configuration/configurator.py +4 -4
  55. simtools/corsika/corsika_config.py +45 -25
  56. simtools/corsika/corsika_histograms.py +6 -5
  57. simtools/data_model/data_reader.py +2 -3
  58. simtools/data_model/metadata_collector.py +32 -36
  59. simtools/data_model/metadata_model.py +15 -12
  60. simtools/data_model/model_data_writer.py +13 -32
  61. simtools/data_model/schema.py +74 -24
  62. simtools/data_model/validate_data.py +34 -9
  63. simtools/db/db_handler.py +43 -37
  64. simtools/db/db_model_upload.py +3 -3
  65. simtools/dependencies.py +88 -25
  66. simtools/io/ascii_handler.py +279 -0
  67. simtools/{io_operations → io}/io_handler.py +25 -3
  68. simtools/job_execution/htcondor_script_generator.py +15 -4
  69. simtools/layout/array_layout.py +1 -1
  70. simtools/layout/array_layout_utils.py +14 -7
  71. simtools/model/array_model.py +23 -4
  72. simtools/model/flasher_model.py +106 -0
  73. simtools/model/model_parameter.py +4 -4
  74. simtools/model/model_repository.py +197 -2
  75. simtools/model/telescope_model.py +3 -1
  76. simtools/production_configuration/derive_corsika_limits.py +361 -427
  77. simtools/production_configuration/derive_production_statistics_handler.py +7 -6
  78. simtools/production_configuration/generate_production_grid.py +9 -11
  79. simtools/production_configuration/merge_corsika_limits.py +528 -0
  80. simtools/ray_tracing/mirror_panel_psf.py +1 -0
  81. simtools/ray_tracing/psf_parameter_optimisation.py +792 -0
  82. simtools/ray_tracing/ray_tracing.py +6 -2
  83. simtools/reporting/docs_read_parameters.py +150 -62
  84. simtools/runners/corsika_runner.py +1 -1
  85. simtools/runners/corsika_simtel_runner.py +14 -5
  86. simtools/runners/runner_services.py +10 -5
  87. simtools/runners/simtools_runner.py +267 -0
  88. simtools/schemas/application_workflow.metaschema.yml +101 -68
  89. simtools/schemas/input/MST_mirror_2f_measurements.schema.yml +1 -1
  90. simtools/schemas/input/single_pe_spectrum.schema.yml +1 -1
  91. simtools/schemas/metadata.metaschema.yml +577 -3
  92. simtools/schemas/model_parameter.metaschema.yml +6 -6
  93. simtools/schemas/model_parameter_and_data_schema.metaschema.yml +2 -2
  94. simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
  95. simtools/schemas/model_parameters/altitude.schema.yml +1 -1
  96. simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
  97. simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +1 -1
  98. simtools/schemas/model_parameters/array_element_position_ground.schema.yml +1 -1
  99. simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
  100. simtools/schemas/model_parameters/array_layouts.schema.yml +1 -1
  101. simtools/schemas/model_parameters/array_triggers.schema.yml +1 -1
  102. simtools/schemas/model_parameters/array_window.schema.yml +1 -1
  103. simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
  104. simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
  105. simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
  106. simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
  107. simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
  108. simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +1 -1
  109. simtools/schemas/model_parameters/axes_offsets.schema.yml +1 -1
  110. simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
  111. simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
  112. simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
  113. simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
  114. simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
  115. simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
  116. simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
  117. simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
  118. simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +1 -1
  119. simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
  120. simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
  121. simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
  122. simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
  123. simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +1 -1
  124. simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +1 -1
  125. simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +1 -1
  126. simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
  127. simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
  128. simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
  129. simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +1 -1
  130. simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
  131. simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +1 -1
  132. simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +3 -3
  133. simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
  134. simtools/schemas/model_parameters/default_trigger.schema.yml +1 -1
  135. simtools/schemas/model_parameters/design_model.schema.yml +1 -1
  136. simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +1 -1
  137. simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
  138. simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
  139. simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
  140. simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
  141. simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
  142. simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
  143. simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
  144. simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
  145. simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +1 -1
  146. simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
  147. simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
  148. simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
  149. simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
  150. simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
  151. simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
  152. simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
  153. simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
  154. simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
  155. simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
  156. simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
  157. simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
  158. simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
  159. simtools/schemas/model_parameters/dsum_pedsub.schema.yml +1 -1
  160. simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
  161. simtools/schemas/model_parameters/dsum_prescale.schema.yml +1 -1
  162. simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
  163. simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
  164. simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
  165. simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +1 -1
  166. simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -2
  167. simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
  168. simtools/schemas/model_parameters/effective_focal_length.schema.yml +1 -1
  169. simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
  170. simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +1 -1
  171. simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
  172. simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
  173. simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
  174. simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
  175. simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
  176. simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
  177. simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
  178. simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
  179. simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
  180. simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
  181. simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
  182. simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
  183. simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
  184. simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
  185. simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
  186. simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
  187. simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
  188. simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
  189. simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
  190. simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +35 -0
  191. simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +41 -0
  192. simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +38 -0
  193. simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
  194. simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
  195. simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
  196. simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
  197. simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
  198. simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +1 -1
  199. simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
  200. simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
  201. simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
  202. simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
  203. simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
  204. simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
  205. simtools/schemas/model_parameters/fake_mirror_list.schema.yml +1 -1
  206. simtools/schemas/model_parameters/flatfielding.schema.yml +1 -1
  207. simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
  208. simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +1 -1
  209. simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
  210. simtools/schemas/model_parameters/focus_offset.schema.yml +1 -1
  211. simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
  212. simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
  213. simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
  214. simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
  215. simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
  216. simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
  217. simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
  218. simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
  219. simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
  220. simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
  221. simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
  222. simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
  223. simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
  224. simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
  225. simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
  226. simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
  227. simtools/schemas/model_parameters/led_events.schema.yml +1 -1
  228. simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
  229. simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
  230. simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
  231. simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
  232. simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
  233. simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +50 -1
  234. simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
  235. simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
  236. simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
  237. simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +1 -1
  238. simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +1 -1
  239. simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
  240. simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
  241. simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
  242. simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
  243. simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
  244. simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +1 -1
  245. simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +1 -1
  246. simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +1 -1
  247. simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
  248. simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +1 -1
  249. simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +1 -1
  250. simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
  251. simtools/schemas/model_parameters/nsb_offaxis.schema.yml +1 -1
  252. simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
  253. simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +1 -1
  254. simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
  255. simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
  256. simtools/schemas/model_parameters/nsb_sky_map.schema.yml +1 -1
  257. simtools/schemas/model_parameters/nsb_spectrum.schema.yml +1 -1
  258. simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
  259. simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +1 -1
  260. simtools/schemas/model_parameters/optics_properties.schema.yml +1 -1
  261. simtools/schemas/model_parameters/parabolic_dish.schema.yml +1 -1
  262. simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
  263. simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
  264. simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
  265. simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
  266. simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
  267. simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
  268. simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
  269. simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
  270. simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
  271. simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +1 -1
  272. simtools/schemas/model_parameters/pm_transit_time.schema.yml +1 -1
  273. simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
  274. simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +1 -1
  275. simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
  276. simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
  277. simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +11 -1
  278. simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +1 -1
  279. simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
  280. simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
  281. simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
  282. simtools/schemas/model_parameters/quantum_efficiency.schema.yml +1 -1
  283. simtools/schemas/model_parameters/random_focal_length.schema.yml +1 -1
  284. simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
  285. simtools/schemas/model_parameters/random_mono_probability.schema.yml +1 -1
  286. simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
  287. simtools/schemas/model_parameters/reference_point_latitude.schema.yml +1 -1
  288. simtools/schemas/model_parameters/reference_point_longitude.schema.yml +1 -1
  289. simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
  290. simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
  291. simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
  292. simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
  293. simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +1 -1
  294. simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
  295. simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
  296. simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
  297. simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
  298. simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +11 -1
  299. simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +1 -1
  300. simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
  301. simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +11 -1
  302. simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
  303. simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
  304. simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
  305. simtools/schemas/model_parameters/stars.schema.yml +1 -1
  306. simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
  307. simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
  308. simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
  309. simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
  310. simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
  311. simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
  312. simtools/schemas/model_parameters/telescope_transmission.schema.yml +1 -1
  313. simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
  314. simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
  315. simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
  316. simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
  317. simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
  318. simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
  319. simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
  320. simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
  321. simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +1 -1
  322. simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
  323. simtools/schemas/plot_configuration.metaschema.yml +5 -2
  324. simtools/schemas/production_configuration_metrics.schema.yml +12 -2
  325. simtools/schemas/production_tables.schema.yml +2 -2
  326. simtools/simtel/simtel_config_reader.py +2 -2
  327. simtools/simtel/simtel_config_writer.py +16 -4
  328. simtools/simtel/simtel_io_event_histograms.py +746 -0
  329. simtools/simtel/simtel_io_event_reader.py +15 -42
  330. simtools/simtel/simtel_io_event_writer.py +9 -9
  331. simtools/simtel/simtel_io_histogram.py +3 -1
  332. simtools/simtel/simtel_io_histograms.py +7 -3
  333. simtools/simtel/simtel_table_reader.py +92 -10
  334. simtools/simtel/simulator_array.py +138 -10
  335. simtools/simtel/simulator_camera_efficiency.py +32 -23
  336. simtools/simtel/simulator_light_emission.py +437 -271
  337. simtools/simtel/simulator_ray_tracing.py +1 -1
  338. simtools/simulator.py +105 -147
  339. simtools/testing/configuration.py +24 -26
  340. simtools/testing/helpers.py +2 -2
  341. simtools/testing/log_inspector.py +50 -0
  342. simtools/testing/validate_output.py +87 -37
  343. simtools/utils/general.py +125 -255
  344. simtools/utils/geometry.py +36 -0
  345. simtools/utils/names.py +1 -1
  346. simtools/visualization/legend_handlers.py +180 -264
  347. simtools/visualization/plot_array_layout.py +20 -8
  348. simtools/visualization/plot_pixels.py +1 -1
  349. simtools/visualization/plot_tables.py +133 -37
  350. simtools/visualization/simtel_event_plots.py +816 -0
  351. simtools/visualization/visualize.py +4 -101
  352. gammasimtools-0.18.0.dist-info/RECORD +0 -376
  353. simtools/production_configuration/derive_corsika_limits_grid.py +0 -232
  354. {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/WHEEL +0 -0
  355. {gammasimtools-0.18.0.dist-info → gammasimtools-0.19.0.dist-info}/top_level.txt +0 -0
  356. /simtools/{io_operations → io}/hdf5_handler.py +0 -0
  357. /simtools/{io_operations → io}/legacy_data_handler.py +0 -0
  358. /simtools/{io_operations/io_table_handler.py → io/table_handler.py} +0 -0
@@ -4,99 +4,54 @@ import matplotlib.colors as mcolors
4
4
  import matplotlib.patches as mpatches
5
5
  import numpy as np
6
6
 
7
- __all__ = [
8
- "EdgePixelObject",
9
- "HexEdgePixelHandler",
10
- "HexOffPixelHandler",
11
- "HexPixelHandler",
12
- "LSTHandler",
13
- "LSTObject",
14
- "MSTHandler",
15
- "MSTObject",
16
- "MeanRadiusOuterEdgeHandler",
17
- "MeanRadiusOuterEdgeObject",
18
- "OffPixelObject",
19
- "PixelObject",
20
- "SCTHandler",
21
- "SCTObject",
22
- "SSTHandler",
23
- "SSTObject",
24
- "SquareEdgePixelHandler",
25
- "SquareOffPixelHandler",
26
- "SquarePixelHandler",
27
- "TelescopeHandler",
28
- ]
29
-
30
- # assume same size of telescope at both sides
31
- # (good assumption for plotting)
32
- lst = "LSTN"
33
- mst = "MSTN"
34
- sst = "SSTS"
35
- sct = "SCTS"
36
- hess = "HESS"
37
- magic = "MAGIC"
38
- veritas = "VERITAS"
7
+ """
8
+ Define properties of different telescope types for visualization purposes.
9
+
10
+ Radii are relative to a reference radius (REFERENCE_RADIUS).
11
+ """
12
+ TELESCOPE_CONFIG = {
13
+ "LST": {"color": "darkorange", "radius": 12.5, "shape": "circle", "filled": False},
14
+ "MST": {"color": "dodgerblue", "radius": 9.15, "shape": "circle", "filled": True},
15
+ "SCT": {"color": "black", "radius": 7.15, "shape": "square", "filled": True},
16
+ "SST": {"color": "darkgreen", "radius": 3.0, "shape": "circle", "filled": True},
17
+ "HESS": {"color": "grey", "radius": 6.0, "shape": "hexagon", "filled": True},
18
+ "MAGIC": {"color": "grey", "radius": 8.5, "shape": "hexagon", "filled": True},
19
+ "VERITAS": {"color": "grey", "radius": 6.0, "shape": "hexagon", "filled": True},
20
+ }
39
21
 
22
+ REFERENCE_RADIUS = 12.5
40
23
 
41
- def calculate_center(handlebox, width_factor=3, height_factor=3):
24
+
25
+ def get_telescope_config(telescope_type):
42
26
  """
43
- Calculate the center of the handlebox based on given factors.
27
+ Return the configuration for a given telescope type.
28
+
29
+ Try both site-dependent and site-independent configurations (e.g. "MSTS" and "MST").
44
30
 
45
31
  Parameters
46
32
  ----------
47
- handlebox: matplotlib.legend.Legend
48
- The handlebox object from the legend.
49
- width_factor: int, optional
50
- The factor to adjust the width.
51
- height_factor: int, optional
52
- The factor to adjust the height.
33
+ telescope_type : str
34
+ The type of the telescope (e.g., "LSTN", "MSTS").
53
35
 
54
36
  Returns
55
37
  -------
56
- tuple
57
- The calculated (x0, y0) position.
38
+ dict
39
+ The configuration dictionary for the telescope type.
58
40
  """
41
+ config = TELESCOPE_CONFIG.get(telescope_type)
42
+ if not config and len(telescope_type) >= 3:
43
+ config = TELESCOPE_CONFIG.get(telescope_type[:3])
44
+ return config
45
+
46
+
47
+ def calculate_center(handlebox, width_factor=3, height_factor=3):
48
+ """Calculate the center of the handlebox based on given factors."""
59
49
  x0 = handlebox.xdescent + handlebox.width / width_factor
60
50
  y0 = handlebox.ydescent + handlebox.height / height_factor
61
51
  return x0, y0
62
52
 
63
53
 
64
- class TelescopeHandler:
65
- """
66
- Telescope handler that centralizes the telescope information.
67
-
68
- Individual telescopes handlers inherit from this class.
69
- """
70
-
71
- def __init__(self, radius=None):
72
- self.colors_dict = {
73
- "LSTN": "darkorange",
74
- "MSTx": "dodgerblue",
75
- "MSTN": "dodgerblue",
76
- "LSTS": "darkorange",
77
- "MSTS": "dodgerblue",
78
- "SCTS": "black",
79
- "SSTS": "darkgreen",
80
- "HESS": "grey",
81
- "MAGIC": "grey",
82
- "VERITAS": "grey",
83
- }
84
-
85
- # hardwired values; this is for plotting purposes only
86
- self.radius_dict = {
87
- "LSTN": 12.5,
88
- "MSTx": 9.15,
89
- "MSTN": 9.15,
90
- "LSTS": 12.5,
91
- "MSTS": 9.15,
92
- "SCTS": 7.15,
93
- "SSTS": 3.0,
94
- "HESS": 6.0,
95
- "MAGIC": 8.5,
96
- "VERITAS": 6.0,
97
- }
98
-
99
-
54
+ # Object classes for legend mapping
100
55
  class PixelObject:
101
56
  """Pixel Object."""
102
57
 
@@ -141,248 +96,228 @@ class MeanRadiusOuterEdgeObject:
141
96
  """Object for Mean radius outer edge."""
142
97
 
143
98
 
144
- class HexPixelHandler:
145
- """Legend handler class to plot a hexagonal "on" pixel."""
99
+ # Pixel handlers
100
+ class _BaseHexPixelHandler:
101
+ """Base class for hexagonal pixel handlers."""
146
102
 
147
103
  @staticmethod
148
- def legend_artist(_, __, ___, handlebox): # noqa: D102
104
+ def _create_hex_patch(handlebox, facecolor, edgecolor):
105
+ """Create a hexagonal patch with specified colors."""
149
106
  x0, y0 = calculate_center(handlebox)
150
107
  patch = mpatches.RegularPolygon(
151
108
  (x0, y0),
152
109
  numVertices=6,
153
110
  radius=0.7 * handlebox.height,
154
111
  orientation=np.deg2rad(30),
155
- facecolor=(1, 1, 1, 0),
156
- edgecolor=(0, 0, 0, 1),
112
+ facecolor=facecolor,
113
+ edgecolor=edgecolor,
157
114
  transform=handlebox.get_transform(),
158
115
  )
159
116
  handlebox.add_artist(patch)
160
117
  return patch
161
118
 
162
119
 
163
- class HexEdgePixelHandler:
120
+ class HexPixelHandler(_BaseHexPixelHandler):
121
+ """Legend handler class to plot a hexagonal "on" pixel."""
122
+
123
+ @staticmethod
124
+ def legend_artist(_, __, ___, handlebox):
125
+ """Legend artist."""
126
+ return HexPixelHandler._create_hex_patch(
127
+ handlebox, facecolor=(1, 1, 1, 0), edgecolor=(0, 0, 0, 1)
128
+ )
129
+
130
+
131
+ class HexEdgePixelHandler(_BaseHexPixelHandler):
164
132
  """Legend handler class to plot a hexagonal "edge" pixel."""
165
133
 
166
134
  @staticmethod
167
- def legend_artist(_, __, ___, handlebox): # noqa: D102
168
- x0, y0 = calculate_center(handlebox)
169
- patch = mpatches.RegularPolygon(
170
- (x0, y0),
171
- numVertices=6,
172
- radius=0.7 * handlebox.height,
173
- orientation=np.deg2rad(30),
135
+ def legend_artist(_, __, ___, handlebox):
136
+ """Legend artist."""
137
+ return HexEdgePixelHandler._create_hex_patch(
138
+ handlebox,
174
139
  facecolor=(*mcolors.to_rgb("brown"), 0.5),
175
140
  edgecolor=(*mcolors.to_rgb("black"), 1),
176
- transform=handlebox.get_transform(),
177
141
  )
178
- handlebox.add_artist(patch)
179
- return patch
180
142
 
181
143
 
182
- class HexOffPixelHandler:
144
+ class HexOffPixelHandler(_BaseHexPixelHandler):
183
145
  """Legend handler class to plot a hexagonal "off" pixel."""
184
146
 
185
147
  @staticmethod
186
- def legend_artist(_, __, ___, handlebox): # noqa: D102
187
- x0, y0 = calculate_center(handlebox)
188
- patch = mpatches.RegularPolygon(
189
- (x0, y0),
190
- numVertices=6,
191
- radius=0.7 * handlebox.height,
192
- orientation=np.deg2rad(30),
193
- facecolor="black",
194
- edgecolor="black",
195
- transform=handlebox.get_transform(),
196
- )
197
- handlebox.add_artist(patch)
198
- return patch
148
+ def legend_artist(_, __, ___, handlebox):
149
+ """Legend artist."""
150
+ return HexOffPixelHandler._create_hex_patch(handlebox, facecolor="black", edgecolor="black")
199
151
 
200
152
 
201
- class SquarePixelHandler:
202
- """Legend handler class to plot a square "on" pixel."""
153
+ class _BaseSquarePixelHandler:
154
+ """Base class for square pixel handlers."""
203
155
 
204
156
  @staticmethod
205
- def legend_artist(_, __, ___, handlebox): # noqa: D102
157
+ def _create_square_patch(handlebox, facecolor, edgecolor):
158
+ """Create a square patch with specified colors."""
206
159
  x0, y0 = handlebox.xdescent, handlebox.ydescent
207
160
  width = height = handlebox.height
208
161
  patch = mpatches.Rectangle(
209
162
  [x0, y0],
210
163
  width,
211
164
  height,
212
- facecolor=(1, 1, 1, 0),
213
- edgecolor=(0, 0, 0, 1),
165
+ facecolor=facecolor,
166
+ edgecolor=edgecolor,
214
167
  transform=handlebox.get_transform(),
215
168
  )
216
169
  handlebox.add_artist(patch)
217
170
  return patch
218
171
 
219
172
 
220
- class SquareEdgePixelHandler:
173
+ class SquarePixelHandler(_BaseSquarePixelHandler):
174
+ """Legend handler class to plot a square "on" pixel."""
175
+
176
+ @staticmethod
177
+ def legend_artist(_, __, ___, handlebox):
178
+ """Legend artist."""
179
+ return SquarePixelHandler._create_square_patch(
180
+ handlebox, facecolor=(1, 1, 1, 0), edgecolor=(0, 0, 0, 1)
181
+ )
182
+
183
+
184
+ class SquareEdgePixelHandler(_BaseSquarePixelHandler):
221
185
  """Legend handler class to plot a square "edge" pixel."""
222
186
 
223
187
  @staticmethod
224
- def legend_artist(_, __, ___, handlebox): # noqa: D102
225
- x0, y0 = handlebox.xdescent, handlebox.ydescent
226
- width = height = handlebox.height
227
- patch = mpatches.Rectangle(
228
- [x0, y0],
229
- width,
230
- height,
188
+ def legend_artist(_, __, ___, handlebox):
189
+ """Legend artist."""
190
+ return SquareEdgePixelHandler._create_square_patch(
191
+ handlebox,
231
192
  facecolor=(*mcolors.to_rgb("brown"), 0.5),
232
193
  edgecolor=(*mcolors.to_rgb("black"), 1),
233
- transform=handlebox.get_transform(),
234
194
  )
235
- handlebox.add_artist(patch)
236
- return patch
237
195
 
238
196
 
239
- class SquareOffPixelHandler:
197
+ class SquareOffPixelHandler(_BaseSquarePixelHandler):
240
198
  """Legend handler class to plot a square "off" pixel."""
241
199
 
242
200
  @staticmethod
243
- def legend_artist(_, __, ___, handlebox): # noqa: D102
244
- x0, y0 = handlebox.xdescent, handlebox.ydescent
245
- width = height = handlebox.height
246
- patch = mpatches.Rectangle(
247
- [x0, y0],
248
- width,
249
- height,
250
- facecolor="black",
251
- edgecolor="black",
252
- transform=handlebox.get_transform(),
201
+ def legend_artist(_, __, ___, handlebox):
202
+ """Legend artist."""
203
+ return SquareOffPixelHandler._create_square_patch(
204
+ handlebox, facecolor="black", edgecolor="black"
253
205
  )
254
- handlebox.add_artist(patch)
255
- return patch
256
206
 
257
207
 
258
- class LSTHandler(TelescopeHandler):
259
- """Legend handler class to plot a representation of an LST in an array layout."""
208
+ class BaseLegendHandler:
209
+ """Base telescope handler that can handle any telescope type."""
260
210
 
261
- def legend_artist(self, _, __, ___, handlebox): # noqa: D102
262
- x0, y0 = calculate_center(handlebox, 10 / 3, 2)
263
- radius = handlebox.height
264
- patch = mpatches.Circle(
211
+ def __init__(self, telescope_type):
212
+ self.telescope_type = telescope_type
213
+ self.config = get_telescope_config(telescope_type)
214
+
215
+ def _create_circle(self, handlebox, x0, y0, radius):
216
+ """Create a circle patch."""
217
+ facecolor = self.config["color"] if self.config["filled"] else "none"
218
+ return mpatches.Circle(
265
219
  xy=(x0, y0),
266
- radius=radius * self.radius_dict[lst] / self.radius_dict[lst],
267
- facecolor="none",
268
- edgecolor=self.colors_dict[lst],
220
+ radius=radius * self.config["radius"] / REFERENCE_RADIUS,
221
+ facecolor=facecolor,
222
+ edgecolor=self.config["color"],
269
223
  transform=handlebox.get_transform(),
270
224
  )
271
- handlebox.add_artist(patch)
272
- return patch
273
225
 
226
+ def _create_square(self, handlebox, x0, y0, size):
227
+ """Create a square patch."""
228
+ return mpatches.Rectangle(
229
+ [x0, y0],
230
+ size,
231
+ size,
232
+ facecolor=self.config["color"],
233
+ edgecolor=self.config["color"],
234
+ transform=handlebox.get_transform(),
235
+ )
274
236
 
275
- class MSTHandler(TelescopeHandler):
276
- """Legend handler class to plot a representation of an MST in an array layout."""
277
-
278
- def legend_artist(self, _, __, ___, handlebox): # noqa: D102
279
- x0, y0 = calculate_center(handlebox, 4, 2)
280
- radius = handlebox.height
281
- patch = mpatches.Circle(
282
- xy=(x0, y0),
283
- radius=radius * self.radius_dict[mst] / self.radius_dict[lst],
284
- facecolor=self.colors_dict[mst],
285
- edgecolor=self.colors_dict[mst],
237
+ def _create_hexagon(self, handlebox, x0, y0, radius):
238
+ """Create a hexagon patch."""
239
+ return mpatches.RegularPolygon(
240
+ (x0, y0),
241
+ numVertices=6,
242
+ radius=0.7 * radius * self.config["radius"] / REFERENCE_RADIUS,
243
+ orientation=np.deg2rad(30),
244
+ facecolor=self.config["color"],
245
+ edgecolor=self.config["color"],
286
246
  transform=handlebox.get_transform(),
287
247
  )
248
+
249
+ def legend_artist(self, _, __, ___, handlebox):
250
+ """Create the appropriate patch based on telescope type."""
251
+ shape = self.config["shape"]
252
+
253
+ if shape == "circle":
254
+ x0, y0 = calculate_center(handlebox, 4, 2)
255
+ radius = handlebox.height
256
+ patch = self._create_circle(handlebox, x0, y0, radius)
257
+ elif shape == "square":
258
+ x0, y0 = calculate_center(handlebox, 10, 1)
259
+ size = handlebox.height
260
+ patch = self._create_square(handlebox, x0, y0, size)
261
+ elif shape == "hexagon":
262
+ x0, y0 = calculate_center(handlebox)
263
+ radius = handlebox.height
264
+ patch = self._create_hexagon(handlebox, x0, y0, radius)
265
+
288
266
  handlebox.add_artist(patch)
289
267
  return patch
290
268
 
291
269
 
292
- class SSTHandler(TelescopeHandler):
293
- """Legend handler class to plot a representation of an SST in an array layout."""
270
+ class LSTHandler(BaseLegendHandler):
271
+ """Legend handler for LST telescopes."""
294
272
 
295
- def legend_artist(self, _, __, ___, handlebox): # noqa: D102
296
- x0, y0 = calculate_center(handlebox, 4, 2)
297
- radius = handlebox.height
298
- patch = mpatches.Circle(
299
- xy=(x0, y0),
300
- radius=radius * self.radius_dict[sst] / self.radius_dict[lst],
301
- facecolor=self.colors_dict[sst],
302
- edgecolor=self.colors_dict[sst],
303
- transform=handlebox.get_transform(),
304
- )
305
- handlebox.add_artist(patch)
306
- return patch
273
+ def __init__(self):
274
+ super().__init__("LST")
307
275
 
308
276
 
309
- class SCTHandler(TelescopeHandler):
310
- """Legend handler class to plot a representation of an SCT in an array layout."""
277
+ class MSTHandler(BaseLegendHandler):
278
+ """Legend handler for MST telescopes."""
311
279
 
312
- def legend_artist(self, _, __, ___, handlebox): # noqa: D102
313
- x0, y0 = calculate_center(handlebox, 10, 1)
314
- width = height = handlebox.height
315
- patch = mpatches.Rectangle(
316
- [x0, y0],
317
- width,
318
- height,
319
- facecolor=self.colors_dict[sct],
320
- edgecolor=self.colors_dict[sct],
321
- transform=handlebox.get_transform(),
322
- )
323
- handlebox.add_artist(patch)
324
- return patch
280
+ def __init__(self):
281
+ super().__init__("MST")
325
282
 
326
283
 
327
- class HESSHandler(TelescopeHandler):
328
- """Legend handler class to plot a representation of an HESS in an array layout."""
284
+ class SSTHandler(BaseLegendHandler):
285
+ """Legend handler for SST telescopes."""
329
286
 
330
- def legend_artist(self, _, __, ___, handlebox):
331
- x0, y0 = calculate_center(handlebox)
332
- radius = handlebox.height
333
- patch = mpatches.RegularPolygon(
334
- (x0, y0),
335
- numVertices=6,
336
- radius=0.7 * radius * self.radius_dict[hess] / self.radius_dict[lst],
337
- orientation=np.deg2rad(30),
338
- facecolor=self.colors_dict[hess],
339
- edgecolor=self.colors_dict[hess],
340
- transform=handlebox.get_transform(),
341
- )
342
- handlebox.add_artist(patch)
343
- return patch
287
+ def __init__(self):
288
+ super().__init__("SST")
344
289
 
345
290
 
346
- class MAGICHandler(TelescopeHandler):
347
- """Legend handler class to plot a representation of an MAGIC in an array layout."""
291
+ class SCTHandler(BaseLegendHandler):
292
+ """Legend handler for SCT telescopes."""
348
293
 
349
- def legend_artist(self, _, __, ___, handlebox):
350
- x0, y0 = calculate_center(handlebox)
351
- radius = handlebox.height
352
- patch = mpatches.RegularPolygon(
353
- (x0, y0),
354
- numVertices=6,
355
- radius=0.7 * radius * self.radius_dict[magic] / self.radius_dict[lst],
356
- orientation=np.deg2rad(30),
357
- facecolor=self.colors_dict[magic],
358
- edgecolor=self.colors_dict[magic],
359
- transform=handlebox.get_transform(),
360
- )
361
- handlebox.add_artist(patch)
362
- return patch
294
+ def __init__(self):
295
+ super().__init__("SCT")
363
296
 
364
297
 
365
- class VERITASHandler(TelescopeHandler):
366
- """Legend handler class to plot a representation of an VERITAS in an array layout."""
298
+ class HESSHandler(BaseLegendHandler):
299
+ """Legend handler for HESS telescopes."""
367
300
 
368
- def legend_artist(self, _, __, ___, handlebox):
369
- x0, y0 = calculate_center(handlebox)
370
- radius = handlebox.height
371
- patch = mpatches.RegularPolygon(
372
- (x0, y0),
373
- numVertices=6,
374
- radius=0.7 * radius * self.radius_dict[veritas] / self.radius_dict[lst],
375
- orientation=np.deg2rad(30),
376
- facecolor=self.colors_dict[veritas],
377
- edgecolor=self.colors_dict[veritas],
378
- transform=handlebox.get_transform(),
379
- )
380
- handlebox.add_artist(patch)
381
- return patch
301
+ def __init__(self):
302
+ super().__init__("HESS")
303
+
304
+
305
+ class MAGICHandler(BaseLegendHandler):
306
+ """Legend handler for MAGIC telescopes."""
307
+
308
+ def __init__(self):
309
+ super().__init__("MAGIC")
310
+
311
+
312
+ class VERITASHandler(BaseLegendHandler):
313
+ """Legend handler for VERITAS telescopes."""
314
+
315
+ def __init__(self):
316
+ super().__init__("VERITAS")
382
317
 
383
318
 
384
319
  class MeanRadiusOuterEdgeHandler:
385
- """Legend handler class to plot a the mean radius outer edge of the dish."""
320
+ """Legend handler class to plot the mean radius outer edge of the dish."""
386
321
 
387
322
  @staticmethod
388
323
  def legend_artist(_, __, ___, handlebox): # noqa: D102
@@ -399,31 +334,12 @@ class MeanRadiusOuterEdgeHandler:
399
334
  return patch
400
335
 
401
336
 
402
- all_telescope_objects = {
403
- "LSTN": LSTObject,
404
- "LSTS": LSTObject,
405
- "MSTN": MSTObject,
406
- "MSTS": MSTObject,
407
- sct: SCTObject,
408
- sst: SSTObject,
409
- hess: HESSObject,
410
- magic: MAGICObject,
411
- veritas: VERITASObject,
412
- }
413
- all_telescope_handlers = {
414
- "LSTN": LSTHandler,
415
- "LSTS": LSTHandler,
416
- "MSTN": MSTHandler,
417
- "MSTS": MSTHandler,
418
- sct: SCTHandler,
419
- sst: SSTHandler,
420
- hess: HESSHandler,
421
- magic: MAGICHandler,
422
- veritas: VERITASHandler,
337
+ legend_handler_map = {
338
+ LSTObject: LSTHandler,
339
+ MSTObject: MSTHandler,
340
+ SSTObject: SSTHandler,
341
+ SCTObject: SCTHandler,
342
+ HESSObject: HESSHandler,
343
+ MAGICObject: MAGICHandler,
344
+ VERITASObject: VERITASHandler,
423
345
  }
424
- legend_handler_map = {}
425
- try:
426
- for tel_type in all_telescope_objects.keys():
427
- legend_handler_map[all_telescope_objects[tel_type]] = all_telescope_handlers[tel_type]
428
- except KeyError:
429
- pass
@@ -100,7 +100,6 @@ def get_telescope_patch(name, x, y, radius):
100
100
  patch : Patch
101
101
  Circle or rectangle patch.
102
102
  """
103
- tel_obj = leg_h.TelescopeHandler()
104
103
  tel_type = names.get_array_element_type_from_name(name)
105
104
  x, y, r = x.to(u.m), y.to(u.m), radius.to(u.m)
106
105
 
@@ -110,14 +109,14 @@ def get_telescope_patch(name, x, y, radius):
110
109
  width=r.value,
111
110
  height=r.value,
112
111
  fill=False,
113
- color=tel_obj.colors_dict[tel_type],
112
+ color=leg_h.get_telescope_config(tel_type)["color"],
114
113
  )
115
114
 
116
115
  return mpatches.Circle(
117
116
  (x.value, y.value),
118
117
  radius=r.value,
119
118
  fill=tel_type.startswith("MST"),
120
- color=tel_obj.colors_dict[tel_type],
119
+ color=leg_h.get_telescope_config(tel_type)["color"],
121
120
  )
122
121
 
123
122
 
@@ -221,12 +220,25 @@ def update_legend(ax, telescopes):
221
220
  counts = Counter(types)
222
221
 
223
222
  objs, labels = [], []
224
- for t in names.get_list_of_array_element_types():
225
- if counts[t]:
226
- objs.append(leg_h.all_telescope_objects[t]())
227
- labels.append(f"{t} ({counts[t]})")
223
+ handler_map = {}
224
+
225
+ for telescope_type in names.get_list_of_array_element_types():
226
+ if counts[telescope_type]:
227
+ objs.append(telescope_type)
228
+ labels.append(f"{telescope_type} ({counts[telescope_type]})")
229
+
230
+ class BaseLegendHandlerWrapper: # pylint: disable=R0903
231
+ """Wrapper for BaseLegendHandler to use in legend."""
232
+
233
+ def __init__(self, tel_type):
234
+ self.tel_type = tel_type
235
+
236
+ def legend_artist(self, legend, orig_handle, fontsize, handlebox):
237
+ handler = leg_h.BaseLegendHandler(self.tel_type)
238
+ return handler.legend_artist(legend, orig_handle, fontsize, handlebox)
239
+
240
+ handler_map[telescope_type] = BaseLegendHandlerWrapper(telescope_type)
228
241
 
229
- handler_map = {k: v() for k, v in leg_h.legend_handler_map.items()}
230
242
  ax.legend(objs, labels, handler_map=handler_map, prop={"size": 11}, loc="best")
231
243
 
232
244
 
@@ -12,7 +12,7 @@ import numpy as np
12
12
  from matplotlib.collections import PatchCollection
13
13
 
14
14
  from simtools.db import db_handler
15
- from simtools.io_operations import io_handler
15
+ from simtools.io import io_handler
16
16
  from simtools.model.model_utils import is_two_mirror_telescope
17
17
  from simtools.utils import names
18
18
  from simtools.visualization import legend_handlers as leg_h