gammasimtools 0.6.1__py3-none-any.whl → 0.8.2__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 (355) hide show
  1. gammasimtools-0.8.2.dist-info/METADATA +173 -0
  2. gammasimtools-0.8.2.dist-info/RECORD +345 -0
  3. {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/WHEEL +1 -1
  4. gammasimtools-0.8.2.dist-info/entry_points.txt +31 -0
  5. simtools/_dev_version/__init__.py +9 -0
  6. simtools/_version.py +2 -2
  7. simtools/applications/calculate_trigger_rate.py +210 -0
  8. simtools/applications/convert_all_model_parameters_from_simtel.py +372 -0
  9. simtools/applications/{print_array_elements.py → convert_geo_coordinates_of_array_elements.py} +58 -63
  10. simtools/applications/convert_model_parameter_from_simtel.py +119 -0
  11. simtools/applications/{add_file_to_db.py → db_add_file_to_db.py} +70 -60
  12. simtools/applications/db_add_model_parameters_from_repository_to_db.py +184 -0
  13. simtools/applications/db_add_value_from_json_to_db.py +105 -0
  14. simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +180 -0
  15. simtools/applications/db_get_array_layouts_from_db.py +162 -0
  16. simtools/applications/{get_file_from_db.py → db_get_file_from_db.py} +30 -34
  17. simtools/applications/db_get_parameter_from_db.py +131 -0
  18. simtools/applications/db_inspect_databases.py +52 -0
  19. simtools/applications/derive_mirror_rnda.py +39 -255
  20. simtools/applications/derive_psf_parameters.py +441 -0
  21. simtools/applications/generate_array_config.py +82 -0
  22. simtools/applications/generate_corsika_histograms.py +52 -52
  23. simtools/applications/generate_default_metadata.py +5 -8
  24. simtools/applications/generate_regular_arrays.py +117 -0
  25. simtools/applications/generate_simtel_array_histograms.py +97 -56
  26. simtools/applications/plot_array_layout.py +345 -115
  27. simtools/applications/production_generate_simulation_config.py +158 -0
  28. simtools/applications/production_scale_events.py +168 -0
  29. simtools/applications/simulate_light_emission.py +478 -0
  30. simtools/applications/simulate_prod.py +97 -175
  31. simtools/applications/submit_data_from_external.py +9 -12
  32. simtools/applications/submit_model_parameter_from_external.py +122 -0
  33. simtools/applications/validate_camera_efficiency.py +35 -102
  34. simtools/applications/validate_camera_fov.py +20 -19
  35. simtools/applications/{compare_cumulative_psf.py → validate_cumulative_psf.py} +45 -44
  36. simtools/applications/validate_file_using_schema.py +111 -47
  37. simtools/applications/validate_optics.py +17 -22
  38. simtools/camera_efficiency.py +193 -202
  39. simtools/configuration/commandline_parser.py +384 -96
  40. simtools/configuration/configurator.py +55 -71
  41. simtools/constants.py +5 -5
  42. simtools/corsika/corsika_config.py +482 -342
  43. simtools/corsika/corsika_histograms.py +226 -204
  44. simtools/corsika/corsika_histograms_visualize.py +23 -24
  45. simtools/corsika/primary_particle.py +159 -0
  46. simtools/data_model/data_reader.py +25 -20
  47. simtools/data_model/format_checkers.py +52 -0
  48. simtools/data_model/metadata_collector.py +211 -185
  49. simtools/data_model/metadata_model.py +115 -37
  50. simtools/data_model/model_data_writer.py +335 -26
  51. simtools/data_model/validate_data.py +366 -154
  52. simtools/db/db_array_elements.py +130 -0
  53. simtools/db/db_from_repo_handler.py +106 -0
  54. simtools/db/db_handler.py +1246 -0
  55. simtools/io_operations/hdf5_handler.py +3 -1
  56. simtools/io_operations/io_handler.py +32 -57
  57. simtools/job_execution/job_manager.py +82 -69
  58. simtools/layout/array_layout.py +325 -537
  59. simtools/layout/geo_coordinates.py +8 -11
  60. simtools/layout/telescope_position.py +163 -86
  61. simtools/model/array_model.py +312 -259
  62. simtools/model/calibration_model.py +50 -0
  63. simtools/model/camera.py +277 -523
  64. simtools/model/mirrors.py +68 -49
  65. simtools/model/model_parameter.py +602 -0
  66. simtools/model/model_utils.py +11 -39
  67. simtools/model/site_model.py +161 -0
  68. simtools/model/telescope_model.py +143 -633
  69. simtools/production_configuration/calculate_statistical_errors_grid_point.py +454 -0
  70. simtools/production_configuration/event_scaler.py +146 -0
  71. simtools/production_configuration/generate_simulation_config.py +193 -0
  72. simtools/production_configuration/interpolation_handler.py +197 -0
  73. simtools/ray_tracing/__init__.py +0 -0
  74. simtools/ray_tracing/mirror_panel_psf.py +280 -0
  75. simtools/{psf_analysis.py → ray_tracing/psf_analysis.py} +133 -47
  76. simtools/ray_tracing/ray_tracing.py +646 -0
  77. simtools/runners/__init__.py +0 -0
  78. simtools/runners/corsika_runner.py +240 -0
  79. simtools/runners/corsika_simtel_runner.py +225 -0
  80. simtools/runners/runner_services.py +307 -0
  81. simtools/runners/simtel_runner.py +224 -0
  82. simtools/schemas/array_elements.yml +137 -0
  83. simtools/schemas/integration_tests_config.metaschema.yml +93 -0
  84. simtools/schemas/metadata.metaschema.yml +6 -0
  85. simtools/schemas/model_parameter.metaschema.yml +78 -0
  86. simtools/schemas/{data.metaschema.yml → model_parameter_and_data_schema.metaschema.yml} +27 -44
  87. simtools/schemas/model_parameters/adjust_gain.schema.yml +37 -0
  88. simtools/schemas/model_parameters/altitude.schema.yml +37 -0
  89. simtools/schemas/model_parameters/array_coordinates.schema.yml +33 -0
  90. simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +77 -0
  91. simtools/schemas/model_parameters/array_element_position_ground.schema.yml +39 -0
  92. simtools/schemas/model_parameters/array_element_position_utm.schema.yml +39 -0
  93. simtools/schemas/model_parameters/array_layouts.schema.yml +48 -0
  94. simtools/schemas/model_parameters/array_triggers.schema.yml +93 -0
  95. simtools/schemas/model_parameters/asum_clipping.schema.yml +38 -0
  96. simtools/schemas/model_parameters/asum_offset.schema.yml +35 -0
  97. simtools/schemas/model_parameters/asum_shaping.schema.yml +35 -0
  98. simtools/schemas/model_parameters/asum_threshold.schema.yml +38 -0
  99. simtools/schemas/model_parameters/atmospheric_profile.schema.yml +32 -0
  100. simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +35 -0
  101. simtools/schemas/model_parameters/axes_offsets.schema.yml +53 -0
  102. simtools/schemas/model_parameters/camera_body_diameter.schema.yml +40 -0
  103. simtools/schemas/model_parameters/camera_body_shape.schema.yml +45 -0
  104. simtools/schemas/model_parameters/camera_config_file.schema.yml +40 -0
  105. simtools/schemas/model_parameters/camera_config_rotate.schema.yml +36 -0
  106. simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +43 -0
  107. simtools/schemas/model_parameters/camera_degraded_map.schema.yml +42 -0
  108. simtools/schemas/model_parameters/camera_depth.schema.yml +42 -0
  109. simtools/schemas/model_parameters/camera_filter.schema.yml +45 -0
  110. simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +29 -0
  111. simtools/schemas/model_parameters/camera_pixels.schema.yml +36 -0
  112. simtools/schemas/model_parameters/camera_transmission.schema.yml +41 -0
  113. simtools/schemas/model_parameters/channels_per_chip.schema.yml +36 -0
  114. simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +35 -0
  115. simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +27 -0
  116. simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +38 -0
  117. simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +28 -0
  118. simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +23 -0
  119. simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +27 -0
  120. simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +28 -0
  121. simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +27 -0
  122. simtools/schemas/model_parameters/corsika_observation_level.schema.yml +38 -0
  123. simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +52 -0
  124. simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +27 -0
  125. simtools/schemas/model_parameters/dark_events.schema.yml +32 -0
  126. simtools/schemas/model_parameters/default_trigger.schema.yml +35 -0
  127. simtools/schemas/model_parameters/design_model.schema.yml +31 -0
  128. simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +32 -0
  129. simtools/schemas/model_parameters/disc_bins.schema.yml +39 -0
  130. simtools/schemas/model_parameters/disc_start.schema.yml +41 -0
  131. simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +42 -0
  132. simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +41 -0
  133. simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +41 -0
  134. simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +39 -0
  135. simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +40 -0
  136. simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +41 -0
  137. simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +33 -0
  138. simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +42 -0
  139. simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +37 -0
  140. simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +44 -0
  141. simtools/schemas/model_parameters/discriminator_threshold.schema.yml +36 -0
  142. simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +45 -0
  143. simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +40 -0
  144. simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +41 -0
  145. simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +38 -0
  146. simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +38 -0
  147. simtools/schemas/model_parameters/dish_shape_length.schema.yml +41 -0
  148. simtools/schemas/model_parameters/dsum_clipping.schema.yml +38 -0
  149. simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +38 -0
  150. simtools/schemas/model_parameters/dsum_offset.schema.yml +37 -0
  151. simtools/schemas/model_parameters/dsum_pedsub.schema.yml +33 -0
  152. simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +39 -0
  153. simtools/schemas/model_parameters/dsum_prescale.schema.yml +44 -0
  154. simtools/schemas/model_parameters/dsum_presum_max.schema.yml +38 -0
  155. simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +45 -0
  156. simtools/schemas/model_parameters/dsum_shaping.schema.yml +44 -0
  157. simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +32 -0
  158. simtools/schemas/model_parameters/dsum_threshold.schema.yml +43 -0
  159. simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +42 -0
  160. simtools/schemas/model_parameters/effective_focal_length.schema.yml +61 -0
  161. simtools/schemas/model_parameters/epsg_code.schema.yml +37 -0
  162. simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +35 -0
  163. simtools/schemas/model_parameters/fadc_amplitude.schema.yml +46 -0
  164. simtools/schemas/model_parameters/fadc_bins.schema.yml +40 -0
  165. simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +50 -0
  166. simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +38 -0
  167. simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +42 -0
  168. simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +49 -0
  169. simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +47 -0
  170. simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +51 -0
  171. simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +37 -0
  172. simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +43 -0
  173. simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +49 -0
  174. simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +43 -0
  175. simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +39 -0
  176. simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +42 -0
  177. simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +40 -0
  178. simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +50 -0
  179. simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +42 -0
  180. simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +41 -0
  181. simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +42 -0
  182. simtools/schemas/model_parameters/fadc_max_signal.schema.yml +43 -0
  183. simtools/schemas/model_parameters/fadc_max_sum.schema.yml +39 -0
  184. simtools/schemas/model_parameters/fadc_mhz.schema.yml +31 -0
  185. simtools/schemas/model_parameters/fadc_noise.schema.yml +41 -0
  186. simtools/schemas/model_parameters/fadc_pedestal.schema.yml +40 -0
  187. simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +39 -0
  188. simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +50 -0
  189. simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +43 -0
  190. simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +43 -0
  191. simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +42 -0
  192. simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +41 -0
  193. simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +42 -0
  194. simtools/schemas/model_parameters/flatfielding.schema.yml +37 -0
  195. simtools/schemas/model_parameters/focal_length.schema.yml +45 -0
  196. simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +158 -0
  197. simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +29 -0
  198. simtools/schemas/model_parameters/focus_offset.schema.yml +66 -0
  199. simtools/schemas/model_parameters/gain_variation.schema.yml +43 -0
  200. simtools/schemas/model_parameters/geomag_horizontal.schema.yml +34 -0
  201. simtools/schemas/model_parameters/geomag_rotation.schema.yml +37 -0
  202. simtools/schemas/model_parameters/geomag_vertical.schema.yml +34 -0
  203. simtools/schemas/model_parameters/hg_lg_variation.schema.yml +36 -0
  204. simtools/schemas/model_parameters/iobuf_maximum.schema.yml +34 -0
  205. simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +34 -0
  206. simtools/schemas/model_parameters/laser_events.schema.yml +36 -0
  207. simtools/schemas/model_parameters/laser_external_trigger.schema.yml +35 -0
  208. simtools/schemas/model_parameters/laser_photons.schema.yml +32 -0
  209. simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +34 -0
  210. simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +34 -0
  211. simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +33 -0
  212. simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +33 -0
  213. simtools/schemas/model_parameters/laser_var_photons.schema.yml +33 -0
  214. simtools/schemas/model_parameters/laser_wavelength.schema.yml +33 -0
  215. simtools/schemas/model_parameters/led_events.schema.yml +34 -0
  216. simtools/schemas/model_parameters/led_photons.schema.yml +34 -0
  217. simtools/schemas/model_parameters/led_pulse_offset.schema.yml +32 -0
  218. simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +33 -0
  219. simtools/schemas/model_parameters/led_var_photons.schema.yml +34 -0
  220. simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +41 -0
  221. simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +43 -0
  222. simtools/schemas/model_parameters/min_photoelectrons.schema.yml +35 -0
  223. simtools/schemas/model_parameters/min_photons.schema.yml +32 -0
  224. simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +36 -0
  225. simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +64 -0
  226. simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +64 -0
  227. simtools/schemas/model_parameters/mirror_class.schema.yml +41 -0
  228. simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +51 -0
  229. simtools/schemas/model_parameters/mirror_focal_length.schema.yml +42 -0
  230. simtools/schemas/model_parameters/mirror_list.schema.yml +38 -0
  231. simtools/schemas/model_parameters/mirror_offset.schema.yml +41 -0
  232. simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +39 -0
  233. simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +61 -0
  234. simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +40 -0
  235. simtools/schemas/model_parameters/multiplicity_offset.schema.yml +46 -0
  236. simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +51 -0
  237. simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +37 -0
  238. simtools/schemas/model_parameters/nsb_offaxis.schema.yml +79 -0
  239. simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +47 -0
  240. simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +34 -0
  241. simtools/schemas/model_parameters/nsb_reference_value.schema.yml +33 -0
  242. simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +35 -0
  243. simtools/schemas/model_parameters/nsb_skymap.schema.yml +39 -0
  244. simtools/schemas/model_parameters/nsb_spectrum.schema.yml +50 -0
  245. simtools/schemas/model_parameters/num_gains.schema.yml +34 -0
  246. simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +33 -0
  247. simtools/schemas/model_parameters/optics_properties.schema.yml +31 -0
  248. simtools/schemas/model_parameters/parabolic_dish.schema.yml +32 -0
  249. simtools/schemas/model_parameters/pedestal_events.schema.yml +32 -0
  250. simtools/schemas/model_parameters/photon_delay.schema.yml +38 -0
  251. simtools/schemas/model_parameters/photons_per_run.schema.yml +33 -0
  252. simtools/schemas/model_parameters/pixel_cells.schema.yml +35 -0
  253. simtools/schemas/model_parameters/pixels_parallel.schema.yml +54 -0
  254. simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +40 -0
  255. simtools/schemas/model_parameters/pm_average_gain.schema.yml +34 -0
  256. simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +40 -0
  257. simtools/schemas/model_parameters/pm_gain_index.schema.yml +36 -0
  258. simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +41 -0
  259. simtools/schemas/model_parameters/pm_transit_time.schema.yml +63 -0
  260. simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +39 -0
  261. simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +42 -0
  262. simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +33 -0
  263. simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +33 -0
  264. simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +29 -0
  265. simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +168 -0
  266. simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +36 -0
  267. simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +34 -0
  268. simtools/schemas/model_parameters/qe_variation.schema.yml +43 -0
  269. simtools/schemas/model_parameters/quantum_efficiency.schema.yml +42 -0
  270. simtools/schemas/model_parameters/random_focal_length.schema.yml +45 -0
  271. simtools/schemas/model_parameters/random_generator.schema.yml +36 -0
  272. simtools/schemas/model_parameters/reference_point_altitude.schema.yml +35 -0
  273. simtools/schemas/model_parameters/reference_point_latitude.schema.yml +36 -0
  274. simtools/schemas/model_parameters/reference_point_longitude.schema.yml +36 -0
  275. simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +34 -0
  276. simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +34 -0
  277. simtools/schemas/model_parameters/sampled_output.schema.yml +31 -0
  278. simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +34 -0
  279. simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +79 -0
  280. simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +42 -0
  281. simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +41 -0
  282. simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +33 -0
  283. simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +36 -0
  284. simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +29 -0
  285. simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +168 -0
  286. simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +36 -0
  287. simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +35 -0
  288. simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +37 -0
  289. simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +40 -0
  290. simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +40 -0
  291. simtools/schemas/model_parameters/store_photoelectrons.schema.yml +41 -0
  292. simtools/schemas/model_parameters/tailcut_scale.schema.yml +40 -0
  293. simtools/schemas/model_parameters/telescope_axis_height.schema.yml +31 -0
  294. simtools/schemas/model_parameters/telescope_random_angle.schema.yml +35 -0
  295. simtools/schemas/model_parameters/telescope_random_error.schema.yml +34 -0
  296. simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +37 -0
  297. simtools/schemas/model_parameters/telescope_transmission.schema.yml +113 -0
  298. simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +41 -0
  299. simtools/schemas/model_parameters/teltrig_min_time.schema.yml +36 -0
  300. simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +36 -0
  301. simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +37 -0
  302. simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +38 -0
  303. simtools/schemas/model_parameters/transit_time_error.schema.yml +45 -0
  304. simtools/schemas/model_parameters/transit_time_jitter.schema.yml +36 -0
  305. simtools/schemas/model_parameters/trigger_current_limit.schema.yml +32 -0
  306. simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +53 -0
  307. simtools/schemas/model_parameters/trigger_pixels.schema.yml +40 -0
  308. simtools/simtel/simtel_config_reader.py +353 -0
  309. simtools/simtel/simtel_config_writer.py +244 -63
  310. simtools/simtel/{simtel_events.py → simtel_io_events.py} +26 -25
  311. simtools/simtel/simtel_io_histogram.py +661 -0
  312. simtools/simtel/simtel_io_histograms.py +569 -0
  313. simtools/simtel/simulator_array.py +145 -0
  314. simtools/simtel/{simtel_runner_camera_efficiency.py → simulator_camera_efficiency.py} +76 -52
  315. simtools/simtel/simulator_light_emission.py +473 -0
  316. simtools/simtel/simulator_ray_tracing.py +262 -0
  317. simtools/simulator.py +220 -446
  318. simtools/testing/__init__.py +0 -0
  319. simtools/testing/assertions.py +151 -0
  320. simtools/testing/configuration.py +226 -0
  321. simtools/testing/helpers.py +42 -0
  322. simtools/testing/validate_output.py +240 -0
  323. simtools/utils/general.py +340 -437
  324. simtools/utils/geometry.py +12 -12
  325. simtools/utils/names.py +257 -644
  326. simtools/utils/value_conversion.py +176 -0
  327. simtools/version.py +3 -1
  328. simtools/visualization/legend_handlers.py +135 -152
  329. simtools/visualization/plot_camera.py +379 -0
  330. simtools/visualization/visualize.py +346 -167
  331. gammasimtools-0.6.1.dist-info/METADATA +0 -180
  332. gammasimtools-0.6.1.dist-info/RECORD +0 -91
  333. gammasimtools-0.6.1.dist-info/entry_points.txt +0 -23
  334. simtools/_dev_version/scm_version.py +0 -10
  335. simtools/applications/db_development_tools/add_new_parameter_to_db.py +0 -81
  336. simtools/applications/db_development_tools/add_unit_to_parameter_in_db.py +0 -59
  337. simtools/applications/db_development_tools/mark_non_optics_parameters_non_applicable.py +0 -102
  338. simtools/applications/get_parameter.py +0 -92
  339. simtools/applications/make_regular_arrays.py +0 -160
  340. simtools/applications/produce_array_config.py +0 -136
  341. simtools/applications/production.py +0 -313
  342. simtools/applications/sim_showers_for_trigger_rates.py +0 -187
  343. simtools/applications/tune_psf.py +0 -334
  344. simtools/corsika/corsika_default_config.py +0 -282
  345. simtools/corsika/corsika_runner.py +0 -450
  346. simtools/corsika_simtel/corsika_simtel_runner.py +0 -197
  347. simtools/db_handler.py +0 -1480
  348. simtools/ray_tracing.py +0 -525
  349. simtools/simtel/simtel_histograms.py +0 -414
  350. simtools/simtel/simtel_runner.py +0 -244
  351. simtools/simtel/simtel_runner_array.py +0 -293
  352. simtools/simtel/simtel_runner_ray_tracing.py +0 -277
  353. {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/LICENSE +0 -0
  354. {gammasimtools-0.6.1.dist-info → gammasimtools-0.8.2.dist-info}/top_level.txt +0 -0
  355. /simtools/{corsika_simtel → db}/__init__.py +0 -0
@@ -0,0 +1,176 @@
1
+ """Value and quantity conversion."""
2
+
3
+ import logging
4
+ import re
5
+
6
+ import numpy as np
7
+ from astropy import units as u
8
+
9
+ import simtools.utils.general as gen
10
+
11
+ _logger = logging.getLogger(__name__)
12
+
13
+
14
+ def extract_type_of_value(value) -> str:
15
+ """
16
+ Extract the string representation of the the type of a value.
17
+
18
+ For example, for a string, it returns 'str' rather than '<class 'str'>'.
19
+ Take into account also the case where the value is a numpy type.
20
+ """
21
+ _type = str(type(value))
22
+ if "numpy" in _type:
23
+ return re.sub(r"\d+", "", _type.split("'")[1].split(".")[-1])
24
+ if "astropy" in _type:
25
+ raise NotImplementedError("Astropy types are not supported yet.")
26
+ return _type.split("'")[1]
27
+
28
+
29
+ def get_value_unit_type(value, unit_str=None):
30
+ """
31
+ Get the value, unit and type of a value.
32
+
33
+ The value is stripped of its unit and the unit is returned
34
+ in its string form (i.e., to_string()).
35
+ The type is returned as a string representation of the type.
36
+ For example, for a string, it returns 'str' rather than '<class 'str'>'.
37
+ An additional unit string can be given and the return value is converted to this units.
38
+
39
+ Note that Quantities are always floats, even if the original value is represented as an int.
40
+
41
+ Parameters
42
+ ----------
43
+ value: str, int, float, bool, u.Quantity
44
+ Value to be parsed.
45
+ unit_str: str
46
+ Unit to be used for the value.
47
+
48
+ Returns
49
+ -------
50
+ type of value, str, str
51
+ Value, unit in string representation (to_string())),
52
+ and string representation of the type of the value.
53
+ """
54
+ base_unit = None
55
+ if isinstance(value, str | u.Quantity):
56
+ try:
57
+ _quantity_value = u.Quantity(value)
58
+ base_value = _quantity_value.value
59
+ base_type = extract_type_of_value(base_value)
60
+ if _quantity_value.unit.to_string() != "":
61
+ base_unit = _quantity_value.unit.to_string()
62
+ try: # handle case of e.g., "0 0" and avoid unit.scale
63
+ float(base_unit)
64
+ base_value = value
65
+ base_type = "str"
66
+ base_unit = None
67
+ except ValueError:
68
+ pass
69
+ # ValueError: covers strings of type "5 not a unit"
70
+ except (TypeError, ValueError):
71
+ base_value = value
72
+ base_type = "str"
73
+ else:
74
+ base_value = value
75
+ base_type = extract_type_of_value(base_value)
76
+
77
+ if unit_str is not None:
78
+ try:
79
+ base_value = base_value * u.Unit(base_unit).to(u.Unit(unit_str))
80
+ except u.UnitConversionError:
81
+ _logger.error(f"Cannot convert {base_unit} to {unit_str}.")
82
+ raise
83
+ except TypeError:
84
+ pass
85
+ base_unit = unit_str
86
+
87
+ return base_value, base_unit, base_type
88
+
89
+
90
+ def split_value_and_unit(value):
91
+ """
92
+ Split a value into its value and unit.
93
+
94
+ Takes into account the case where the value is a Quantity, a number,
95
+ or a simtools-type string encoding a list of values and units.
96
+
97
+ Parameters
98
+ ----------
99
+ value: str, int, float, bool, u.Quantity
100
+ Value to be parsed.
101
+
102
+ Returns
103
+ -------
104
+ value, str
105
+ Value and units as (value, unit), or lists of values and unites
106
+ """
107
+ if isinstance(value, u.Quantity):
108
+ return _split_value_is_quantity(value)
109
+ if isinstance(value, str):
110
+ return _split_value_is_string(value)
111
+ if isinstance(value, list | np.ndarray):
112
+ return _split_value_is_list(value)
113
+ return value, None
114
+
115
+
116
+ def _split_value_is_quantity(value):
117
+ """Split value and unit for an astropy Quantity."""
118
+ if isinstance(value.value, list | np.ndarray): # type [100.0, 200] * u.m,
119
+ return list(value.value), [str(value.unit)] * len(value)
120
+ return value.value, str(value.unit)
121
+
122
+
123
+ def _split_value_is_string(value):
124
+ """Split vale and unit for a string."""
125
+ if value.isdigit(): # single integer value
126
+ return int(value), None
127
+ try: # single value with/without unit
128
+ return u.Quantity(value).value, str(u.Quantity(value).unit)
129
+ except ValueError:
130
+ return _split_value_is_list(gen.convert_string_to_list(value))
131
+ except TypeError: # string value (not numerical)
132
+ return value, None
133
+
134
+
135
+ def _split_value_is_list(value):
136
+ """Split value and unit for a list."""
137
+ value_list = []
138
+ unit_list = []
139
+ for item in value:
140
+ _value, _unit = split_value_and_unit(item)
141
+ value_list.append(_value)
142
+ if isinstance(_unit, str):
143
+ unit_list.append(_unit)
144
+ else:
145
+ unit_list.append(None)
146
+ return value_list, unit_list
147
+
148
+
149
+ def get_value_as_quantity(value, unit):
150
+ """
151
+ Get a value as a Quantity with a given unit. If value is a Quantity, convert to the given unit.
152
+
153
+ Parameters
154
+ ----------
155
+ value:
156
+ value to get a unit. It can be a float, int, or a Quantity (convertible to 'unit').
157
+ unit: astropy.units.Unit
158
+ Unit to apply to 'quantity'.
159
+
160
+ Returns
161
+ -------
162
+ astropy.units.Quantity
163
+ Quantity of value 'quantity' and unit 'unit'.
164
+
165
+ Raises
166
+ ------
167
+ u.UnitConversionError
168
+ If the value cannot be converted to the given unit.
169
+ """
170
+ if isinstance(value, u.Quantity):
171
+ try:
172
+ return value.to(unit)
173
+ except u.UnitConversionError:
174
+ _logger.error(f"Cannot convert {value.unit} to {unit}.")
175
+ raise
176
+ return value * unit
simtools/version.py CHANGED
@@ -1,10 +1,12 @@
1
+ """Software version setting."""
2
+
1
3
  # this is adapted from https://github.com/cta-observatory/ctapipe/blob/main/ctapipe/version.py
2
4
  # which is adapted from https://github.com/astropy/astropy/blob/master/astropy/version.py
3
5
  # see https://github.com/astropy/astropy/pull/10774 for a discussion on why this needed.
4
6
 
5
7
  try:
6
8
  try:
7
- from ._dev.scm_version import version
9
+ from ._dev_version import version
8
10
  except ImportError:
9
11
  from ._version import version
10
12
  except Exception:
@@ -1,12 +1,9 @@
1
+ """Helper functions for legend handlers used for plotting."""
2
+
1
3
  import matplotlib.colors as mcolors
2
4
  import matplotlib.patches as mpatches
3
5
  import numpy as np
4
6
 
5
- from simtools.corsika.corsika_config import CorsikaConfig
6
- from simtools.io_operations.io_handler import IOHandler
7
- from simtools.utils import names
8
- from simtools.utils.names import hess, lst, magic, mst, sct, sst, veritas
9
-
10
7
  __all__ = [
11
8
  "EdgePixelObject",
12
9
  "HexEdgePixelHandler",
@@ -30,87 +27,124 @@ __all__ = [
30
27
  "TelescopeHandler",
31
28
  ]
32
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"
39
+
33
40
 
34
- class TelescopeHandler(object):
41
+ def calculate_center(handlebox, width_factor=3, height_factor=3):
35
42
  """
36
- Telescope handler that centralizes the telescope information. Individual telescopes handlers
37
- inherit from this class.
43
+ Calculate the center of the handlebox based on given factors.
44
+
45
+ Parameters
46
+ ----------
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.
53
+
54
+ Returns
55
+ -------
56
+ tuple
57
+ The calculated (x0, y0) position.
38
58
  """
59
+ x0 = handlebox.xdescent + handlebox.width / width_factor
60
+ y0 = handlebox.ydescent + handlebox.height / height_factor
61
+ return x0, y0
39
62
 
40
- def __init__(self):
41
- io_handler = IOHandler()
42
- corsika_parameters_file = io_handler.get_input_data_file(
43
- "parameters", "corsika_parameters.yml"
44
- )
45
- corsika_info = CorsikaConfig.load_corsika_parameters_file(corsika_parameters_file)
46
63
 
47
- self.radius_dict = {}
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):
48
72
  self.colors_dict = {
49
- lst: "darkorange",
50
- mst: "dodgerblue",
51
- sct: "black",
52
- sst: "darkgreen",
53
- hess: "grey",
54
- magic: "grey",
55
- veritas: "grey",
73
+ "LSTN": "darkorange",
74
+ "MSTN": "dodgerblue",
75
+ "LSTS": "darkorange",
76
+ "MSTS": "dodgerblue",
77
+ "SCTS": "black",
78
+ "SSTS": "darkgreen",
79
+ "HESS": "grey",
80
+ "MAGIC": "grey",
81
+ "VERITAS": "grey",
82
+ }
83
+
84
+ # hardwired values; this is for plotting purposes only
85
+ self.radius_dict = {
86
+ "LSTN": 12.5,
87
+ "MSTN": 9.15,
88
+ "LSTS": 12.5,
89
+ "MSTS": 9.15,
90
+ "SCTS": 7.15,
91
+ "SSTS": 3.0,
92
+ "HESS": 6.0,
93
+ "MAGIC": 8.5,
94
+ "VERITAS": 6.0,
56
95
  }
57
- for key, value in corsika_info["corsika_sphere_radius"].items():
58
- self.radius_dict[key] = value["value"]
59
96
 
60
97
 
61
- class PixelObject(object):
98
+ class PixelObject:
62
99
  """Pixel Object."""
63
100
 
64
101
 
65
- class EdgePixelObject(object):
102
+ class EdgePixelObject:
66
103
  """Edge-Pixel Object."""
67
104
 
68
105
 
69
- class OffPixelObject(object):
106
+ class OffPixelObject:
70
107
  """Off-Pixel Object."""
71
108
 
72
109
 
73
- class LSTObject(object):
110
+ class LSTObject:
74
111
  """LST Object."""
75
112
 
76
113
 
77
- class MSTObject(object):
114
+ class MSTObject:
78
115
  """MST Object."""
79
116
 
80
117
 
81
- class SCTObject(object):
118
+ class SCTObject:
82
119
  """SCT Object."""
83
120
 
84
121
 
85
- class SSTObject(object):
122
+ class SSTObject:
86
123
  """SST Object."""
87
124
 
88
125
 
89
- class HESSObject(object):
126
+ class HESSObject:
90
127
  """HESS Object."""
91
128
 
92
129
 
93
- class MAGICObject(object):
130
+ class MAGICObject:
94
131
  """MAGIC Object."""
95
132
 
96
133
 
97
- class VERITASObject(object):
134
+ class VERITASObject:
98
135
  """VERITAS Object."""
99
136
 
100
137
 
101
- class MeanRadiusOuterEdgeObject(object):
138
+ class MeanRadiusOuterEdgeObject:
102
139
  """Object for Mean radius outer edge."""
103
140
 
104
141
 
105
- class HexPixelHandler(object):
106
- """
107
- Legend handler class to plot a hexagonal "on" pixel.
108
- """
142
+ class HexPixelHandler:
143
+ """Legend handler class to plot a hexagonal "on" pixel."""
109
144
 
110
145
  @staticmethod
111
- def legend_artist(legend, orig_handle, fontsize, handlebox):
112
- x0, y0 = handlebox.xdescent + handlebox.width / 3, handlebox.ydescent + handlebox.height / 3
113
- # width = height = handlebox.height
146
+ def legend_artist(_, __, ___, handlebox): # noqa: D102
147
+ x0, y0 = calculate_center(handlebox)
114
148
  patch = mpatches.RegularPolygon(
115
149
  (x0, y0),
116
150
  numVertices=6,
@@ -124,43 +158,31 @@ class HexPixelHandler(object):
124
158
  return patch
125
159
 
126
160
 
127
- class HexEdgePixelHandler(object):
128
- """
129
- Legend handler class to plot a hexagonal "edge" pixel.
130
- """
161
+ class HexEdgePixelHandler:
162
+ """Legend handler class to plot a hexagonal "edge" pixel."""
131
163
 
132
164
  @staticmethod
133
- def legend_artist(legend, orig_handle, fontsize, handlebox):
134
- x0, y0 = (
135
- handlebox.xdescent + handlebox.width / 3,
136
- handlebox.ydescent + handlebox.height / 3,
137
- )
138
- # width = height = handlebox.height
165
+ def legend_artist(_, __, ___, handlebox): # noqa: D102
166
+ x0, y0 = calculate_center(handlebox)
139
167
  patch = mpatches.RegularPolygon(
140
168
  (x0, y0),
141
169
  numVertices=6,
142
170
  radius=0.7 * handlebox.height,
143
171
  orientation=np.deg2rad(30),
144
- facecolor=mcolors.to_rgb("brown") + (0.5,),
145
- edgecolor=mcolors.to_rgb("black") + (1,),
172
+ facecolor=(*mcolors.to_rgb("brown"), 0.5),
173
+ edgecolor=(*mcolors.to_rgb("black"), 1),
146
174
  transform=handlebox.get_transform(),
147
175
  )
148
176
  handlebox.add_artist(patch)
149
177
  return patch
150
178
 
151
179
 
152
- class HexOffPixelHandler(object):
153
- """
154
- Legend handler class to plot a hexagonal "off" pixel.
155
- """
180
+ class HexOffPixelHandler:
181
+ """Legend handler class to plot a hexagonal "off" pixel."""
156
182
 
157
183
  @staticmethod
158
- def legend_artist(legend, orig_handle, fontsize, handlebox):
159
- x0, y0 = (
160
- handlebox.xdescent + handlebox.width / 3,
161
- handlebox.ydescent + handlebox.height / 3,
162
- )
163
- # width = height = handlebox.height
184
+ def legend_artist(_, __, ___, handlebox): # noqa: D102
185
+ x0, y0 = calculate_center(handlebox)
164
186
  patch = mpatches.RegularPolygon(
165
187
  (x0, y0),
166
188
  numVertices=6,
@@ -174,13 +196,11 @@ class HexOffPixelHandler(object):
174
196
  return patch
175
197
 
176
198
 
177
- class SquarePixelHandler(object):
178
- """
179
- Legend handler class to plot a square "on" pixel.
180
- """
199
+ class SquarePixelHandler:
200
+ """Legend handler class to plot a square "on" pixel."""
181
201
 
182
202
  @staticmethod
183
- def legend_artist(legend, orig_handle, fontsize, handlebox):
203
+ def legend_artist(_, __, ___, handlebox): # noqa: D102
184
204
  x0, y0 = handlebox.xdescent, handlebox.ydescent
185
205
  width = height = handlebox.height
186
206
  patch = mpatches.Rectangle(
@@ -195,34 +215,30 @@ class SquarePixelHandler(object):
195
215
  return patch
196
216
 
197
217
 
198
- class SquareEdgePixelHandler(object):
199
- """
200
- Legend handler class to plot a square "edge" pixel.
201
- """
218
+ class SquareEdgePixelHandler:
219
+ """Legend handler class to plot a square "edge" pixel."""
202
220
 
203
221
  @staticmethod
204
- def legend_artist(legend, orig_handle, fontsize, handlebox):
222
+ def legend_artist(_, __, ___, handlebox): # noqa: D102
205
223
  x0, y0 = handlebox.xdescent, handlebox.ydescent
206
224
  width = height = handlebox.height
207
225
  patch = mpatches.Rectangle(
208
226
  [x0, y0],
209
227
  width,
210
228
  height,
211
- facecolor=mcolors.to_rgb("brown") + (0.5,),
212
- edgecolor=mcolors.to_rgb("black") + (1,),
229
+ facecolor=(*mcolors.to_rgb("brown"), 0.5),
230
+ edgecolor=(*mcolors.to_rgb("black"), 1),
213
231
  transform=handlebox.get_transform(),
214
232
  )
215
233
  handlebox.add_artist(patch)
216
234
  return patch
217
235
 
218
236
 
219
- class SquareOffPixelHandler(object):
220
- """
221
- Legend handler class to plot a square "off" pixel.
222
- """
237
+ class SquareOffPixelHandler:
238
+ """Legend handler class to plot a square "off" pixel."""
223
239
 
224
240
  @staticmethod
225
- def legend_artist(legend, orig_handle, fontsize, handlebox):
241
+ def legend_artist(_, __, ___, handlebox): # noqa: D102
226
242
  x0, y0 = handlebox.xdescent, handlebox.ydescent
227
243
  width = height = handlebox.height
228
244
  patch = mpatches.Rectangle(
@@ -238,18 +254,13 @@ class SquareOffPixelHandler(object):
238
254
 
239
255
 
240
256
  class LSTHandler(TelescopeHandler):
241
- """
242
- Legend handler class to plot a representation of an LST in an array layout.
243
- """
257
+ """Legend handler class to plot a representation of an LST in an array layout."""
244
258
 
245
- def legend_artist(self, legend, orig_handle, fontsize, handlebox):
246
- center = (
247
- handlebox.xdescent + 0.3 * handlebox.width,
248
- handlebox.ydescent + 0.5 * handlebox.height,
249
- )
259
+ def legend_artist(self, _, __, ___, handlebox): # noqa: D102
260
+ x0, y0 = calculate_center(handlebox, 10 / 3, 2)
250
261
  radius = handlebox.height
251
262
  patch = mpatches.Circle(
252
- xy=center,
263
+ xy=(x0, y0),
253
264
  radius=radius * self.radius_dict[lst] / self.radius_dict[lst],
254
265
  facecolor="none",
255
266
  edgecolor=self.colors_dict[lst],
@@ -260,18 +271,13 @@ class LSTHandler(TelescopeHandler):
260
271
 
261
272
 
262
273
  class MSTHandler(TelescopeHandler):
263
- """
264
- Legend handler class to plot a representation of an MST in an array layout.
265
- """
274
+ """Legend handler class to plot a representation of an MST in an array layout."""
266
275
 
267
- def legend_artist(self, legend, orig_handle, fontsize, handlebox):
268
- center = (
269
- handlebox.xdescent + 0.25 * handlebox.width,
270
- handlebox.ydescent + 0.5 * handlebox.height,
271
- )
276
+ def legend_artist(self, _, __, ___, handlebox): # noqa: D102
277
+ x0, y0 = calculate_center(handlebox, 4, 2)
272
278
  radius = handlebox.height
273
279
  patch = mpatches.Circle(
274
- xy=center,
280
+ xy=(x0, y0),
275
281
  radius=radius * self.radius_dict[mst] / self.radius_dict[lst],
276
282
  facecolor=self.colors_dict[mst],
277
283
  edgecolor=self.colors_dict[mst],
@@ -282,18 +288,13 @@ class MSTHandler(TelescopeHandler):
282
288
 
283
289
 
284
290
  class SSTHandler(TelescopeHandler):
285
- """
286
- Legend handler class to plot a representation of an SST in an array layout.
287
- """
291
+ """Legend handler class to plot a representation of an SST in an array layout."""
288
292
 
289
- def legend_artist(self, legend, orig_handle, fontsize, handlebox):
290
- center = (
291
- handlebox.xdescent + 0.25 * handlebox.width,
292
- handlebox.ydescent + 0.5 * handlebox.height,
293
- )
293
+ def legend_artist(self, _, __, ___, handlebox): # noqa: D102
294
+ x0, y0 = calculate_center(handlebox, 4, 2)
294
295
  radius = handlebox.height
295
296
  patch = mpatches.Circle(
296
- xy=center,
297
+ xy=(x0, y0),
297
298
  radius=radius * self.radius_dict[sst] / self.radius_dict[lst],
298
299
  facecolor=self.colors_dict[sst],
299
300
  edgecolor=self.colors_dict[sst],
@@ -304,12 +305,10 @@ class SSTHandler(TelescopeHandler):
304
305
 
305
306
 
306
307
  class SCTHandler(TelescopeHandler):
307
- """
308
- Legend handler class to plot a representation of an SCT in an array layout.
309
- """
308
+ """Legend handler class to plot a representation of an SCT in an array layout."""
310
309
 
311
- def legend_artist(self, legend, orig_handle, fontsize, handlebox):
312
- x0, y0 = handlebox.xdescent + 0.1 * handlebox.width, handlebox.ydescent
310
+ def legend_artist(self, _, __, ___, handlebox): # noqa: D102
311
+ x0, y0 = calculate_center(handlebox, 10, 1)
313
312
  width = height = handlebox.height
314
313
  patch = mpatches.Rectangle(
315
314
  [x0, y0],
@@ -324,15 +323,10 @@ class SCTHandler(TelescopeHandler):
324
323
 
325
324
 
326
325
  class HESSHandler(TelescopeHandler):
327
- """
328
- Legend handler class to plot a representation of an HESS in an array layout.
329
- """
326
+ """Legend handler class to plot a representation of an HESS in an array layout."""
330
327
 
331
- def legend_artist(self, legend, orig_handle, fontsize, handlebox):
332
- x0, y0 = (
333
- handlebox.xdescent + handlebox.width / 3,
334
- handlebox.ydescent + handlebox.height / 3,
335
- )
328
+ def legend_artist(self, _, __, ___, handlebox):
329
+ x0, y0 = calculate_center(handlebox)
336
330
  radius = handlebox.height
337
331
  patch = mpatches.RegularPolygon(
338
332
  (x0, y0),
@@ -348,15 +342,10 @@ class HESSHandler(TelescopeHandler):
348
342
 
349
343
 
350
344
  class MAGICHandler(TelescopeHandler):
351
- """
352
- Legend handler class to plot a representation of an MAGIC in an array layout.
353
- """
345
+ """Legend handler class to plot a representation of an MAGIC in an array layout."""
354
346
 
355
- def legend_artist(self, legend, orig_handle, fontsize, handlebox):
356
- x0, y0 = (
357
- handlebox.xdescent + handlebox.width / 3,
358
- handlebox.ydescent + handlebox.height / 3,
359
- )
347
+ def legend_artist(self, _, __, ___, handlebox):
348
+ x0, y0 = calculate_center(handlebox)
360
349
  radius = handlebox.height
361
350
  patch = mpatches.RegularPolygon(
362
351
  (x0, y0),
@@ -372,15 +361,10 @@ class MAGICHandler(TelescopeHandler):
372
361
 
373
362
 
374
363
  class VERITASHandler(TelescopeHandler):
375
- """
376
- Legend handler class to plot a representation of an VERITAS in an array layout.
377
- """
364
+ """Legend handler class to plot a representation of an VERITAS in an array layout."""
378
365
 
379
- def legend_artist(self, legend, orig_handle, fontsize, handlebox):
380
- x0, y0 = (
381
- handlebox.xdescent + handlebox.width / 3,
382
- handlebox.ydescent + handlebox.height / 3,
383
- )
366
+ def legend_artist(self, _, __, ___, handlebox):
367
+ x0, y0 = calculate_center(handlebox)
384
368
  radius = handlebox.height
385
369
  patch = mpatches.RegularPolygon(
386
370
  (x0, y0),
@@ -395,20 +379,15 @@ class VERITASHandler(TelescopeHandler):
395
379
  return patch
396
380
 
397
381
 
398
- class MeanRadiusOuterEdgeHandler(object):
399
- """
400
- Legend handler class to plot a the mean radius outer edge of the dish.
401
- """
382
+ class MeanRadiusOuterEdgeHandler:
383
+ """Legend handler class to plot a the mean radius outer edge of the dish."""
402
384
 
403
385
  @staticmethod
404
- def legend_artist(legend, orig_handle, fontsize, handlebox):
405
- center = (
406
- handlebox.xdescent + 0.25 * handlebox.width,
407
- handlebox.ydescent + 0.25 * handlebox.height,
408
- )
386
+ def legend_artist(_, __, ___, handlebox): # noqa: D102
387
+ x0, y0 = calculate_center(handlebox, 4, 4)
409
388
  radius = handlebox.height
410
389
  patch = mpatches.Circle(
411
- xy=center,
390
+ xy=(x0, y0),
412
391
  radius=radius,
413
392
  facecolor="none",
414
393
  edgecolor="darkorange",
@@ -419,8 +398,10 @@ class MeanRadiusOuterEdgeHandler(object):
419
398
 
420
399
 
421
400
  all_telescope_objects = {
422
- lst: LSTObject,
423
- mst: MSTObject,
401
+ "LSTN": LSTObject,
402
+ "LSTS": LSTObject,
403
+ "MSTN": MSTObject,
404
+ "MSTS": MSTObject,
424
405
  sct: SCTObject,
425
406
  sst: SSTObject,
426
407
  hess: HESSObject,
@@ -428,8 +409,10 @@ all_telescope_objects = {
428
409
  veritas: VERITASObject,
429
410
  }
430
411
  all_telescope_handlers = {
431
- lst: LSTHandler,
432
- mst: MSTHandler,
412
+ "LSTN": LSTHandler,
413
+ "LSTS": LSTHandler,
414
+ "MSTN": MSTHandler,
415
+ "MSTS": MSTHandler,
433
416
  sct: SCTHandler,
434
417
  sst: SSTHandler,
435
418
  hess: HESSHandler,
@@ -438,7 +421,7 @@ all_telescope_handlers = {
438
421
  }
439
422
  legend_handler_map = {}
440
423
  try:
441
- for tel_type in names.all_telescope_class_names:
424
+ for tel_type in all_telescope_objects.keys():
442
425
  legend_handler_map[all_telescope_objects[tel_type]] = all_telescope_handlers[tel_type]
443
426
  except KeyError:
444
427
  pass