gammasimtools 0.18.0__py3-none-any.whl → 0.20.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/METADATA +24 -69
  2. gammasimtools-0.20.0.dist-info/RECORD +395 -0
  3. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/entry_points.txt +11 -4
  4. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/licenses/LICENSE +1 -1
  5. simtools/_version.py +16 -3
  6. simtools/applications/calculate_incident_angles.py +182 -0
  7. simtools/applications/convert_all_model_parameters_from_simtel.py +4 -3
  8. simtools/applications/convert_geo_coordinates_of_array_elements.py +3 -3
  9. simtools/applications/db_add_simulation_model_from_repository_to_db.py +17 -14
  10. simtools/applications/db_add_value_from_json_to_db.py +8 -10
  11. simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +8 -13
  12. simtools/applications/db_generate_compound_indexes.py +65 -0
  13. simtools/applications/db_get_file_from_db.py +12 -24
  14. simtools/applications/db_get_parameter_from_db.py +4 -4
  15. simtools/applications/db_inspect_databases.py +20 -10
  16. simtools/applications/derive_mirror_rnda.py +17 -11
  17. simtools/applications/derive_psf_parameters.py +59 -309
  18. simtools/applications/derive_trigger_rates.py +91 -0
  19. simtools/applications/docs_produce_array_element_report.py +1 -1
  20. simtools/applications/docs_produce_calibration_reports.py +1 -1
  21. simtools/applications/docs_produce_model_parameter_reports.py +1 -1
  22. simtools/applications/docs_produce_simulation_configuration_report.py +1 -1
  23. simtools/applications/generate_corsika_histograms.py +1 -1
  24. simtools/applications/generate_default_metadata.py +8 -24
  25. simtools/applications/generate_simtel_event_data.py +11 -11
  26. simtools/applications/maintain_simulation_model_add_production_table.py +71 -0
  27. simtools/applications/maintain_simulation_model_compare_productions.py +98 -0
  28. simtools/applications/{verify_simulation_model_production_tables.py → maintain_simulation_model_verify_production_tables.py} +9 -1
  29. simtools/applications/merge_tables.py +2 -2
  30. simtools/applications/plot_array_layout.py +3 -3
  31. simtools/applications/plot_simtel_events.py +421 -0
  32. simtools/applications/plot_tabular_data.py +9 -2
  33. simtools/applications/plot_tabular_data_for_model_parameter.py +2 -1
  34. simtools/applications/print_version.py +8 -9
  35. simtools/applications/production_derive_corsika_limits.py +6 -7
  36. simtools/applications/production_derive_statistics.py +1 -1
  37. simtools/applications/production_generate_grid.py +2 -2
  38. simtools/applications/production_merge_corsika_limits.py +214 -0
  39. simtools/applications/run_application.py +47 -113
  40. simtools/applications/simulate_calibration_events.py +166 -0
  41. simtools/applications/simulate_flasher.py +141 -0
  42. simtools/applications/{simulate_light_emission.py → simulate_illuminator.py} +35 -99
  43. simtools/applications/simulate_prod.py +6 -24
  44. simtools/applications/simulate_prod_htcondor_generator.py +7 -0
  45. simtools/applications/submit_array_layouts.py +2 -1
  46. simtools/applications/submit_model_parameter_from_external.py +1 -1
  47. simtools/applications/validate_camera_efficiency.py +30 -12
  48. simtools/applications/validate_camera_fov.py +1 -1
  49. simtools/applications/validate_cumulative_psf.py +1 -1
  50. simtools/applications/validate_file_using_schema.py +9 -5
  51. simtools/applications/validate_optics.py +1 -1
  52. simtools/camera/camera_efficiency.py +61 -45
  53. simtools/camera/single_photon_electron_spectrum.py +1 -1
  54. simtools/configuration/commandline_parser.py +46 -11
  55. simtools/configuration/configurator.py +4 -4
  56. simtools/corsika/corsika_config.py +45 -25
  57. simtools/corsika/corsika_histograms.py +6 -5
  58. simtools/data_model/data_reader.py +2 -3
  59. simtools/data_model/metadata_collector.py +32 -36
  60. simtools/data_model/metadata_model.py +15 -12
  61. simtools/data_model/model_data_writer.py +13 -32
  62. simtools/data_model/schema.py +74 -24
  63. simtools/data_model/validate_data.py +42 -12
  64. simtools/db/db_handler.py +125 -62
  65. simtools/db/db_model_upload.py +14 -19
  66. simtools/dependencies.py +98 -30
  67. simtools/io/ascii_handler.py +279 -0
  68. simtools/{io_operations → io}/io_handler.py +25 -3
  69. simtools/job_execution/htcondor_script_generator.py +15 -4
  70. simtools/layout/array_layout.py +1 -1
  71. simtools/layout/array_layout_utils.py +51 -12
  72. simtools/model/array_model.py +41 -5
  73. simtools/model/flasher_model.py +106 -0
  74. simtools/model/model_parameter.py +4 -4
  75. simtools/model/model_repository.py +197 -2
  76. simtools/model/site_model.py +25 -0
  77. simtools/model/telescope_model.py +3 -1
  78. simtools/production_configuration/derive_corsika_limits.py +336 -427
  79. simtools/production_configuration/derive_production_statistics_handler.py +7 -6
  80. simtools/production_configuration/generate_production_grid.py +9 -11
  81. simtools/production_configuration/merge_corsika_limits.py +528 -0
  82. simtools/ray_tracing/incident_angles.py +706 -0
  83. simtools/ray_tracing/mirror_panel_psf.py +1 -0
  84. simtools/ray_tracing/psf_parameter_optimisation.py +792 -0
  85. simtools/ray_tracing/ray_tracing.py +6 -2
  86. simtools/reporting/docs_read_parameters.py +150 -62
  87. simtools/runners/corsika_runner.py +1 -1
  88. simtools/runners/corsika_simtel_runner.py +14 -5
  89. simtools/runners/runner_services.py +10 -5
  90. simtools/runners/simtools_runner.py +267 -0
  91. simtools/schemas/application_workflow.metaschema.yml +101 -68
  92. simtools/schemas/input/MST_mirror_2f_measurements.schema.yml +1 -1
  93. simtools/schemas/input/single_pe_spectrum.schema.yml +1 -1
  94. simtools/schemas/metadata.metaschema.yml +577 -3
  95. simtools/schemas/model_parameter.metaschema.yml +6 -6
  96. simtools/schemas/model_parameter_and_data_schema.metaschema.yml +4 -4
  97. simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
  98. simtools/schemas/model_parameters/altitude.schema.yml +1 -1
  99. simtools/schemas/model_parameters/array_coordinates.schema.yml +1 -1
  100. simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +1 -1
  101. simtools/schemas/model_parameters/array_element_position_ground.schema.yml +1 -1
  102. simtools/schemas/model_parameters/array_element_position_utm.schema.yml +1 -1
  103. simtools/schemas/model_parameters/array_layouts.schema.yml +1 -1
  104. simtools/schemas/model_parameters/array_triggers.schema.yml +1 -1
  105. simtools/schemas/model_parameters/array_window.schema.yml +1 -1
  106. simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
  107. simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
  108. simtools/schemas/model_parameters/asum_shaping.schema.yml +1 -1
  109. simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
  110. simtools/schemas/model_parameters/atmospheric_profile.schema.yml +1 -1
  111. simtools/schemas/model_parameters/atmospheric_transmission.schema.yml +1 -1
  112. simtools/schemas/model_parameters/axes_offsets.schema.yml +1 -1
  113. simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
  114. simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
  115. simtools/schemas/model_parameters/camera_config_file.schema.yml +1 -1
  116. simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
  117. simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
  118. simtools/schemas/model_parameters/camera_degraded_map.schema.yml +1 -1
  119. simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
  120. simtools/schemas/model_parameters/camera_filter.schema.yml +1 -1
  121. simtools/schemas/model_parameters/camera_filter_incidence_angle.schema.yml +1 -1
  122. simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
  123. simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
  124. simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
  125. simtools/schemas/model_parameters/correct_nsb_spectrum_to_telescope_altitude.schema.yml +1 -1
  126. simtools/schemas/model_parameters/corsika_cherenkov_photon_bunch_size.schema.yml +1 -1
  127. simtools/schemas/model_parameters/corsika_cherenkov_photon_wavelength_range.schema.yml +1 -1
  128. simtools/schemas/model_parameters/corsika_first_interaction_height.schema.yml +1 -1
  129. simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
  130. simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
  131. simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
  132. simtools/schemas/model_parameters/corsika_longitudinal_shower_development.schema.yml +1 -1
  133. simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
  134. simtools/schemas/model_parameters/corsika_particle_kinetic_energy_cutoff.schema.yml +1 -1
  135. simtools/schemas/model_parameters/corsika_starting_grammage.schema.yml +3 -3
  136. simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
  137. simtools/schemas/model_parameters/default_trigger.schema.yml +1 -1
  138. simtools/schemas/model_parameters/design_model.schema.yml +1 -1
  139. simtools/schemas/model_parameters/disc_ac_coupled.schema.yml +1 -1
  140. simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
  141. simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
  142. simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
  143. simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
  144. simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
  145. simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
  146. simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
  147. simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
  148. simtools/schemas/model_parameters/discriminator_pulse_shape.schema.yml +1 -1
  149. simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
  150. simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
  151. simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
  152. simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
  153. simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
  154. simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
  155. simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
  156. simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
  157. simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
  158. simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
  159. simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
  160. simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
  161. simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
  162. simtools/schemas/model_parameters/dsum_pedsub.schema.yml +1 -1
  163. simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
  164. simtools/schemas/model_parameters/dsum_prescale.schema.yml +1 -1
  165. simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
  166. simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
  167. simtools/schemas/model_parameters/dsum_shaping.schema.yml +1 -1
  168. simtools/schemas/model_parameters/dsum_shaping_renormalize.schema.yml +1 -1
  169. simtools/schemas/model_parameters/dsum_threshold.schema.yml +2 -2
  170. simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
  171. simtools/schemas/model_parameters/effective_focal_length.schema.yml +1 -1
  172. simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
  173. simtools/schemas/model_parameters/fadc_ac_coupled.schema.yml +1 -1
  174. simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
  175. simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
  176. simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
  177. simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
  178. simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
  179. simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
  180. simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
  181. simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
  182. simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
  183. simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
  184. simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
  185. simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
  186. simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
  187. simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
  188. simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
  189. simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
  190. simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
  191. simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
  192. simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
  193. simtools/schemas/model_parameters/fadc_long_event_threshold.schema.yml +35 -0
  194. simtools/schemas/model_parameters/fadc_long_sum_bins.schema.yml +41 -0
  195. simtools/schemas/model_parameters/fadc_long_sum_offset.schema.yml +38 -0
  196. simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
  197. simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
  198. simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
  199. simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
  200. simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
  201. simtools/schemas/model_parameters/fadc_pulse_shape.schema.yml +1 -1
  202. simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
  203. simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
  204. simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
  205. simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
  206. simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
  207. simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
  208. simtools/schemas/model_parameters/fake_mirror_list.schema.yml +1 -1
  209. simtools/schemas/model_parameters/flatfielding.schema.yml +1 -1
  210. simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
  211. simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +1 -1
  212. simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
  213. simtools/schemas/model_parameters/focus_offset.schema.yml +1 -1
  214. simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
  215. simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
  216. simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
  217. simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
  218. simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
  219. simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
  220. simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
  221. simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
  222. simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
  223. simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
  224. simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
  225. simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
  226. simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
  227. simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
  228. simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
  229. simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
  230. simtools/schemas/model_parameters/led_events.schema.yml +1 -1
  231. simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
  232. simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
  233. simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
  234. simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
  235. simtools/schemas/model_parameters/lightguide_efficiency_vs_incidence_angle.schema.yml +1 -1
  236. simtools/schemas/model_parameters/lightguide_efficiency_vs_wavelength.schema.yml +50 -1
  237. simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
  238. simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
  239. simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
  240. simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +1 -1
  241. simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +1 -1
  242. simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
  243. simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
  244. simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
  245. simtools/schemas/model_parameters/mirror_list.schema.yml +1 -1
  246. simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
  247. simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +1 -1
  248. simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +1 -1
  249. simtools/schemas/model_parameters/mirror_reflectivity.schema.yml +1 -1
  250. simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
  251. simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +1 -1
  252. simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +1 -1
  253. simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
  254. simtools/schemas/model_parameters/nsb_offaxis.schema.yml +1 -1
  255. simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
  256. simtools/schemas/model_parameters/nsb_reference_spectrum.schema.yml +2 -2
  257. simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
  258. simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
  259. simtools/schemas/model_parameters/nsb_sky_map.schema.yml +1 -1
  260. simtools/schemas/model_parameters/nsb_spectrum.schema.yml +23 -30
  261. simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
  262. simtools/schemas/model_parameters/only_triggered_telescopes.schema.yml +1 -1
  263. simtools/schemas/model_parameters/optics_properties.schema.yml +1 -1
  264. simtools/schemas/model_parameters/parabolic_dish.schema.yml +1 -1
  265. simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
  266. simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
  267. simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
  268. simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
  269. simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
  270. simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
  271. simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
  272. simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
  273. simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
  274. simtools/schemas/model_parameters/pm_photoelectron_spectrum.schema.yml +1 -1
  275. simtools/schemas/model_parameters/pm_transit_time.schema.yml +1 -1
  276. simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
  277. simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +1 -1
  278. simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
  279. simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
  280. simtools/schemas/model_parameters/primary_mirror_incidence_angle.schema.yml +11 -1
  281. simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +1 -1
  282. simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
  283. simtools/schemas/model_parameters/primary_mirror_segmentation.schema.yml +1 -1
  284. simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
  285. simtools/schemas/model_parameters/quantum_efficiency.schema.yml +1 -1
  286. simtools/schemas/model_parameters/random_focal_length.schema.yml +1 -1
  287. simtools/schemas/model_parameters/random_generator.schema.yml +1 -1
  288. simtools/schemas/model_parameters/random_mono_probability.schema.yml +1 -1
  289. simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
  290. simtools/schemas/model_parameters/reference_point_latitude.schema.yml +1 -1
  291. simtools/schemas/model_parameters/reference_point_longitude.schema.yml +1 -1
  292. simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
  293. simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
  294. simtools/schemas/model_parameters/sampled_output.schema.yml +1 -1
  295. simtools/schemas/model_parameters/save_pe_with_amplitude.schema.yml +1 -1
  296. simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +1 -1
  297. simtools/schemas/model_parameters/secondary_mirror_degraded_map.schema.yml +1 -1
  298. simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
  299. simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
  300. simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
  301. simtools/schemas/model_parameters/secondary_mirror_incidence_angle.schema.yml +11 -1
  302. simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +1 -1
  303. simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
  304. simtools/schemas/model_parameters/secondary_mirror_reflectivity.schema.yml +11 -1
  305. simtools/schemas/model_parameters/secondary_mirror_segmentation.schema.yml +1 -1
  306. simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
  307. simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
  308. simtools/schemas/model_parameters/stars.schema.yml +2 -2
  309. simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
  310. simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
  311. simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
  312. simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
  313. simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
  314. simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
  315. simtools/schemas/model_parameters/telescope_transmission.schema.yml +1 -1
  316. simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
  317. simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
  318. simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
  319. simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
  320. simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
  321. simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
  322. simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
  323. simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
  324. simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +1 -1
  325. simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
  326. simtools/schemas/plot_configuration.metaschema.yml +5 -2
  327. simtools/schemas/production_configuration_metrics.schema.yml +12 -2
  328. simtools/schemas/production_tables.schema.yml +7 -2
  329. simtools/simtel/simtel_config_reader.py +2 -2
  330. simtools/simtel/simtel_config_writer.py +33 -23
  331. simtools/simtel/simtel_io_event_histograms.py +483 -0
  332. simtools/simtel/simtel_io_event_reader.py +65 -43
  333. simtools/simtel/simtel_io_event_writer.py +40 -20
  334. simtools/simtel/simtel_io_metadata.py +1 -1
  335. simtools/simtel/simtel_table_reader.py +95 -13
  336. simtools/simtel/simulator_array.py +138 -10
  337. simtools/simtel/simulator_camera_efficiency.py +32 -23
  338. simtools/simtel/simulator_light_emission.py +437 -271
  339. simtools/simtel/simulator_ray_tracing.py +1 -1
  340. simtools/simulator.py +105 -147
  341. simtools/telescope_trigger_rates.py +119 -0
  342. simtools/testing/configuration.py +24 -26
  343. simtools/testing/helpers.py +2 -2
  344. simtools/testing/log_inspector.py +52 -0
  345. simtools/testing/validate_output.py +87 -37
  346. simtools/utils/general.py +125 -255
  347. simtools/utils/geometry.py +56 -0
  348. simtools/utils/names.py +1 -1
  349. simtools/visualization/legend_handlers.py +180 -264
  350. simtools/visualization/plot_array_layout.py +20 -8
  351. simtools/visualization/plot_incident_angles.py +431 -0
  352. simtools/visualization/plot_pixels.py +1 -1
  353. simtools/visualization/plot_simtel_event_histograms.py +376 -0
  354. simtools/visualization/plot_simtel_events.py +816 -0
  355. simtools/visualization/plot_tables.py +133 -37
  356. simtools/visualization/visualize.py +1 -100
  357. gammasimtools-0.18.0.dist-info/RECORD +0 -376
  358. simtools/applications/calculate_trigger_rate.py +0 -187
  359. simtools/applications/generate_sim_telarray_histograms.py +0 -196
  360. simtools/production_configuration/derive_corsika_limits_grid.py +0 -232
  361. simtools/simtel/simtel_io_histogram.py +0 -621
  362. simtools/simtel/simtel_io_histograms.py +0 -552
  363. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/WHEEL +0 -0
  364. {gammasimtools-0.18.0.dist-info → gammasimtools-0.20.0.dist-info}/top_level.txt +0 -0
  365. /simtools/{io_operations → io}/hdf5_handler.py +0 -0
  366. /simtools/{io_operations → io}/legacy_data_handler.py +0 -0
  367. /simtools/{io_operations/io_table_handler.py → io/table_handler.py} +0 -0
simtools/db/db_handler.py CHANGED
@@ -1,5 +1,6 @@
1
1
  """Module to handle interaction with DB."""
2
2
 
3
+ import io
3
4
  import logging
4
5
  import re
5
6
  from collections import defaultdict
@@ -8,14 +9,15 @@ from threading import Lock
8
9
 
9
10
  import gridfs
10
11
  import jsonschema
12
+ from astropy.table import Table
11
13
  from bson.objectid import ObjectId
12
14
  from packaging.version import Version
13
15
  from pymongo import MongoClient
14
16
 
15
17
  from simtools.data_model import validate_data
16
- from simtools.io_operations import io_handler
18
+ from simtools.io import ascii_handler, io_handler
17
19
  from simtools.simtel import simtel_table_reader
18
- from simtools.utils import general, names, value_conversion
20
+ from simtools.utils import names, value_conversion
19
21
 
20
22
  __all__ = ["DatabaseHandler"]
21
23
 
@@ -50,8 +52,19 @@ jsonschema_db_dict = {
50
52
  "type": "string",
51
53
  "description": "Name of simulation model database",
52
54
  },
55
+ "db_simulation_model_version": {
56
+ "type": "string",
57
+ "description": "Version of simulation model database",
58
+ },
53
59
  },
54
- "required": ["db_server", "db_api_port", "db_api_user", "db_api_pw", "db_simulation_model"],
60
+ "required": [
61
+ "db_server",
62
+ "db_api_port",
63
+ "db_api_user",
64
+ "db_api_pw",
65
+ "db_simulation_model",
66
+ "db_simulation_model_version",
67
+ ],
55
68
  }
56
69
 
57
70
 
@@ -81,6 +94,14 @@ class DatabaseHandler:
81
94
 
82
95
  self._set_up_connection()
83
96
  self._find_latest_simulation_model_db()
97
+ self.db_name = (
98
+ self.get_db_name(
99
+ model_version=self.mongo_db_config.get("db_simulation_model_version"),
100
+ model_name=self.mongo_db_config.get("db_simulation_model"),
101
+ )
102
+ if self.mongo_db_config
103
+ else None
104
+ )
84
105
 
85
106
  def _set_up_connection(self):
86
107
  """Open the connection to MongoDB."""
@@ -89,6 +110,16 @@ class DatabaseHandler:
89
110
  with lock:
90
111
  DatabaseHandler.db_client = self._open_mongo_db()
91
112
 
113
+ def get_db_name(self, db_name=None, model_version=None, model_name=None):
114
+ """Build DB name from configuration."""
115
+ if db_name:
116
+ return db_name
117
+ if model_version and model_name:
118
+ return f"{model_name}-{model_version.replace('.', '-')}"
119
+ if model_version or model_name:
120
+ return None
121
+ return None if (model_version or model_name) else self.db_name
122
+
92
123
  def _validate_mongo_db_config(self, mongo_db_config):
93
124
  """Validate the MongoDB configuration."""
94
125
  if mongo_db_config is None or all(value is None for value in mongo_db_config.values()):
@@ -137,8 +168,7 @@ class DatabaseHandler:
137
168
  """
138
169
  Find the latest released version of the simulation model and update the DB config.
139
170
 
140
- This is indicated by adding "LATEST" to the name of the simulation model database
141
- (field "db_simulation_model" in the database configuration dictionary).
171
+ This is indicated by "LATEST" to the simulation model data base version.
142
172
  Only released versions are considered, pre-releases are ignored.
143
173
 
144
174
  Raises
@@ -148,27 +178,27 @@ class DatabaseHandler:
148
178
 
149
179
  """
150
180
  try:
181
+ db_simulation_model_version = self.mongo_db_config["db_simulation_model_version"]
151
182
  db_simulation_model = self.mongo_db_config["db_simulation_model"]
152
- if not db_simulation_model.endswith("LATEST"):
183
+ if db_simulation_model_version != "LATEST":
153
184
  return
154
- except TypeError: # db_simulation_model is None
185
+ except TypeError: # db_simulation_model_version is None
155
186
  return
156
187
 
157
- prefix = db_simulation_model.replace("LATEST", "")
158
188
  list_of_db_names = self.db_client.list_database_names()
159
- filtered_list_of_db_names = [s for s in list_of_db_names if s.startswith(prefix)]
160
- versioned_strings = []
161
- version_pattern = re.compile(
162
- rf"{re.escape(prefix)}v?(\d+)-(\d+)-(\d+)(?:-([a-zA-Z0-9_.]+))?"
163
- )
189
+ filtered_list_of_db_names = [
190
+ s for s in list_of_db_names if s.startswith(db_simulation_model)
191
+ ]
192
+ pattern = re.compile(rf"{re.escape(db_simulation_model)}-v(\d+)-(\d+)-(\d+)(?:-(.+))?$")
164
193
 
194
+ versioned_strings = []
165
195
  for s in filtered_list_of_db_names:
166
- match = version_pattern.search(s)
167
- # A version is considered a pre-release if it contains a '-' character (re group 4)
168
- if match and match.group(4) is None:
169
- version_str = match.group(1) + "." + match.group(2) + "." + match.group(3)
170
- version = Version(version_str)
171
- versioned_strings.append((s, version))
196
+ m = pattern.match(s)
197
+ if m:
198
+ # skip pre-releases (have suffix)
199
+ if m.group(4) is None:
200
+ version_str = f"{m.group(1)}.{m.group(2)}.{m.group(3)}"
201
+ versioned_strings.append((s, Version(version_str)))
172
202
 
173
203
  if versioned_strings:
174
204
  latest_string, _ = max(versioned_strings, key=lambda x: x[1])
@@ -177,7 +207,29 @@ class DatabaseHandler:
177
207
  f"Updated the DB simulation model to the latest version {latest_string}"
178
208
  )
179
209
  else:
180
- raise ValueError("Found LATEST in the DB name but no matching versions found in DB.")
210
+ raise ValueError("LATEST requested but no released versions found in DB.")
211
+
212
+ def generate_compound_indexes(self, db_name=None):
213
+ """
214
+ Generate compound indexes for the MongoDB collections.
215
+
216
+ Indexes based on the typical query patterns.
217
+ """
218
+ db_name = db_name or self.db_name
219
+ collection_names = [
220
+ "telescopes",
221
+ "sites",
222
+ "configuration_sim_telarray",
223
+ "configuration_corsika",
224
+ "calibration_devices",
225
+ ]
226
+ for collection_name in collection_names:
227
+ db_collection = self.get_collection(collection_name, db_name=db_name)
228
+ db_collection.create_index(
229
+ [("instrument", 1), ("site", 1), ("parameter", 1), ("parameter_version", 1)]
230
+ )
231
+ db_collection = self.get_collection("production_tables", db_name=db_name)
232
+ db_collection.create_index([("collection", 1), ("model_version", 1)])
181
233
 
182
234
  def get_model_parameter(
183
235
  self,
@@ -333,24 +385,23 @@ class DatabaseHandler:
333
385
  )
334
386
  return DatabaseHandler.model_parameters_cached[cache_key]
335
387
 
336
- def get_collection(self, db_name, collection_name):
388
+ def get_collection(self, collection_name, db_name=None):
337
389
  """
338
390
  Get a collection from the DB.
339
391
 
340
392
  Parameters
341
393
  ----------
342
- db_name: str
343
- Name of the DB.
344
394
  collection_name: str
345
395
  Name of the collection.
396
+ db_name: str
397
+ Name of the DB.
346
398
 
347
399
  Returns
348
400
  -------
349
401
  pymongo.collection.Collection
350
402
  The collection from the DB.
351
-
352
403
  """
353
- db_name = self._get_db_name(db_name)
404
+ db_name = db_name or self.db_name
354
405
  return DatabaseHandler.db_client[db_name][collection_name]
355
406
 
356
407
  def get_collections(self, db_name=None, model_collections_only=False):
@@ -370,7 +421,7 @@ class DatabaseHandler:
370
421
  List of collection names
371
422
 
372
423
  """
373
- db_name = db_name or self._get_db_name()
424
+ db_name = db_name or self.db_name
374
425
  if db_name not in self.list_of_collections:
375
426
  self.list_of_collections[db_name] = DatabaseHandler.db_client[
376
427
  db_name
@@ -451,7 +502,7 @@ class DatabaseHandler:
451
502
  file_id: dict of GridOut._id
452
503
  Dict of database IDs of files.
453
504
  """
454
- db_name = self._get_db_name(db_name)
505
+ db_name = db_name or self.db_name
455
506
 
456
507
  if file_names:
457
508
  file_names = [file_names] if not isinstance(file_names, list) else file_names
@@ -467,8 +518,8 @@ class DatabaseHandler:
467
518
  if Path(dest).joinpath(file_name).exists():
468
519
  instance_ids[file_name] = "file exists"
469
520
  else:
470
- file_path_instance = self._get_file_mongo_db(self._get_db_name(), file_name)
471
- self._write_file_from_mongo_to_disk(self._get_db_name(), dest, file_path_instance)
521
+ file_path_instance = self._get_file_mongo_db(db_name, file_name)
522
+ self._write_file_from_mongo_to_disk(db_name, dest, file_path_instance)
472
523
  instance_ids[file_name] = file_path_instance._id # pylint: disable=protected-access
473
524
  return instance_ids
474
525
 
@@ -509,8 +560,7 @@ class DatabaseHandler:
509
560
  ValueError
510
561
  if query returned no results.
511
562
  """
512
- db_name = self._get_db_name()
513
- collection = self.get_collection(db_name, collection_name)
563
+ collection = self.get_collection(collection_name, db_name=self.db_name)
514
564
  posts = list(collection.find(query))
515
565
  if not posts:
516
566
  raise ValueError(
@@ -547,7 +597,7 @@ class DatabaseHandler:
547
597
  pass
548
598
 
549
599
  query = {"model_version": model_version, "collection": collection_name}
550
- collection = self.get_collection(self._get_db_name(), "production_tables")
600
+ collection = self.get_collection("production_tables", db_name=self.db_name)
551
601
  post = collection.find_one(query)
552
602
  if not post:
553
603
  raise ValueError(f"The following query returned zero results: {query}")
@@ -574,7 +624,7 @@ class DatabaseHandler:
574
624
  list
575
625
  List of model versions
576
626
  """
577
- collection = self.get_collection(self._get_db_name(), "production_tables")
627
+ collection = self.get_collection("production_tables", db_name=self.db_name)
578
628
  return sorted(
579
629
  {post["model_version"] for post in collection.find({"collection": collection_name})}
580
630
  )
@@ -751,27 +801,56 @@ class DatabaseHandler:
751
801
  with open(Path(path).joinpath(file.filename), "wb") as output_file:
752
802
  fs_output.download_to_stream_by_name(file.filename, output_file)
753
803
 
754
- def add_production_table(self, db_name, production_table):
804
+ def get_ecsv_file_as_astropy_table(self, file_name, db_name=None):
755
805
  """
756
- Add a production table to the DB.
806
+ Read contents of an ECSV file from the database and return it as an Astropy Table.
807
+
808
+ Files are not written to disk.
757
809
 
758
810
  Parameters
759
811
  ----------
812
+ file_name: str
813
+ The name of the ECSV file.
760
814
  db_name: str
761
- the name of the DB.
815
+ The name of the database.
816
+
817
+ Returns
818
+ -------
819
+ astropy.table.Table
820
+ The contents of the ECSV file as an Astropy Table.
821
+ """
822
+ db = DatabaseHandler.db_client[db_name or self.db_name]
823
+ fs = gridfs.GridFSBucket(db)
824
+
825
+ buf = io.BytesIO()
826
+ try:
827
+ fs.download_to_stream_by_name(file_name, buf)
828
+ except gridfs.errors.NoFile as exc:
829
+ raise FileNotFoundError(f"ECSV file '{file_name}' not found in DB.") from exc
830
+ buf.seek(0)
831
+ return Table.read(buf.getvalue().decode("utf-8"), format="ascii.ecsv")
832
+
833
+ def add_production_table(self, production_table, db_name=None):
834
+ """
835
+ Add a production table to the DB.
836
+
837
+ Parameters
838
+ ----------
762
839
  production_table: dict
763
840
  The production table to add to the DB.
841
+ db_name: str
842
+ the name of the DB.
764
843
  """
765
- db_name = self._get_db_name(db_name)
766
- collection = self.get_collection(db_name, "production_tables")
844
+ db_name = db_name or self.db_name
845
+ collection = self.get_collection("production_tables", db_name=db_name or self.db_name)
767
846
  self._logger.debug(f"Adding production for {production_table.get('collection')} to to DB")
768
847
  collection.insert_one(production_table)
769
848
  DatabaseHandler.production_table_cached.clear()
770
849
 
771
850
  def add_new_parameter(
772
851
  self,
773
- db_name,
774
852
  par_dict,
853
+ db_name=None,
775
854
  collection_name="telescopes",
776
855
  file_prefix=None,
777
856
  ):
@@ -783,10 +862,10 @@ class DatabaseHandler:
783
862
 
784
863
  Parameters
785
864
  ----------
786
- db_name: str
787
- the name of the DB
788
865
  par_dict: dict
789
866
  dictionary with parameter data
867
+ db_name: str
868
+ the name of the DB
790
869
  collection_name: str
791
870
  The name of the collection to add a parameter to.
792
871
  file_prefix: str or Path
@@ -794,8 +873,8 @@ class DatabaseHandler:
794
873
  """
795
874
  par_dict = validate_data.DataValidator.validate_model_parameter(par_dict)
796
875
 
797
- db_name = self._get_db_name(db_name)
798
- collection = self.get_collection(db_name, collection_name)
876
+ db_name = db_name or self.db_name
877
+ collection = self.get_collection(collection_name, db_name=db_name)
799
878
 
800
879
  par_dict["value"], _base_unit, _ = value_conversion.get_value_unit_type(
801
880
  value=par_dict["value"], unit_str=par_dict.get("unit", None)
@@ -810,7 +889,7 @@ class DatabaseHandler:
810
889
  f"corresponding to the {par_dict['parameter']} parameter, must be provided."
811
890
  )
812
891
  file_path = Path(file_prefix).joinpath(par_dict["value"])
813
- if not general.is_utf8_file(file_path):
892
+ if not ascii_handler.is_utf8_file(file_path):
814
893
  raise ValueError(f"File is not UTF-8 encoded: {file_path}")
815
894
  files_to_add_to_db.add(f"{file_path}")
816
895
 
@@ -825,22 +904,6 @@ class DatabaseHandler:
825
904
 
826
905
  self._reset_parameter_cache()
827
906
 
828
- def _get_db_name(self, db_name=None):
829
- """
830
- Return database name. If not provided, return the default database name.
831
-
832
- Parameters
833
- ----------
834
- db_name: str
835
- Database name
836
-
837
- Returns
838
- -------
839
- str
840
- Database name
841
- """
842
- return self.mongo_db_config["db_simulation_model"] if db_name is None else db_name
843
-
844
907
  def insert_file_to_db(self, file_name, db_name=None, **kwargs):
845
908
  """
846
909
  Insert a file to the DB.
@@ -853,7 +916,7 @@ class DatabaseHandler:
853
916
  the name of the DB
854
917
  **kwargs (optional): keyword arguments for file creation.
855
918
  The full list of arguments can be found in, \
856
- https://docs.mongodb.com/manual/core/gridfs/#the-files-collection
919
+ https://www.mongodb.com/docs/manual/core/gridfs/
857
920
  mostly these are unnecessary though.
858
921
 
859
922
  Returns
@@ -863,7 +926,7 @@ class DatabaseHandler:
863
926
  "newly created DB GridOut._id.
864
927
 
865
928
  """
866
- db_name = self._get_db_name(db_name)
929
+ db_name = db_name or self.db_name
867
930
  db = DatabaseHandler.db_client[db_name]
868
931
  file_system = gridfs.GridFS(db)
869
932
 
@@ -3,56 +3,53 @@
3
3
  import logging
4
4
  from pathlib import Path
5
5
 
6
- import simtools.utils.general as gen
6
+ from simtools.io import ascii_handler
7
7
  from simtools.utils import names
8
8
 
9
9
  logger = logging.getLogger(__name__)
10
10
 
11
11
 
12
- def add_values_from_json_to_db(file, collection, db, db_name, file_prefix):
12
+ def add_values_from_json_to_db(file, collection, db, file_prefix):
13
13
  """
14
14
  Upload new model parameter from json files to db.
15
15
 
16
16
  Parameters
17
17
  ----------
18
18
  file : list
19
- Json file to be uploaded to the DB.
19
+ JSON file to be uploaded to the DB.
20
20
  collection : str
21
21
  The DB collection to which to add the file.
22
22
  db : DatabaseHandler
23
23
  Database handler object.
24
- db_name : str
25
- Name of the database to be created.
26
24
  file_prefix : str
27
25
  Path to location of all additional files to be uploaded.
28
26
  """
29
- par_dict = gen.collect_data_from_file(file_name=file)
27
+ par_dict = ascii_handler.collect_data_from_file(file_name=file)
30
28
  logger.debug(
31
29
  f"Adding the following parameter to the DB: {par_dict['parameter']} "
32
30
  f"version {par_dict['parameter_version']} "
33
- f"(collection {collection} in database {db_name})"
31
+ f"(collection {collection} in database {db.get_db_name()})"
34
32
  )
35
33
 
36
34
  db.add_new_parameter(
37
- db_name=db_name,
38
35
  par_dict=par_dict,
39
36
  collection_name=collection,
40
37
  file_prefix=file_prefix,
41
38
  )
42
39
 
43
40
 
44
- def add_model_parameters_to_db(args_dict, db):
41
+ def add_model_parameters_to_db(input_path, db):
45
42
  """
46
43
  Read model parameters from a directory and upload them to the database.
47
44
 
48
45
  Parameters
49
46
  ----------
50
- args_dict : dict
51
- Command line arguments.
47
+ input_path : Path, str
48
+ Path to the directory containing the model parameters.
52
49
  db : DatabaseHandler
53
50
  Database handler object.
54
51
  """
55
- input_path = Path(args_dict["input_path"])
52
+ input_path = Path(input_path)
56
53
  logger.info(f"Reading model parameters from repository path {input_path}")
57
54
  array_elements = [d for d in input_path.iterdir() if d.is_dir()]
58
55
  for element in array_elements:
@@ -67,12 +64,11 @@ def add_model_parameters_to_db(args_dict, db):
67
64
  file=file,
68
65
  collection=collection,
69
66
  db=db,
70
- db_name=args_dict["db_name"],
71
67
  file_prefix=input_path / "Files",
72
68
  )
73
69
 
74
70
 
75
- def add_production_tables_to_db(args_dict, db):
71
+ def add_production_tables_to_db(input_path, db):
76
72
  """
77
73
  Read production tables from a directory and upload them to the database.
78
74
 
@@ -81,12 +77,12 @@ def add_production_tables_to_db(args_dict, db):
81
77
 
82
78
  Parameters
83
79
  ----------
84
- args_dict : dict
85
- Command line arguments.
80
+ input_path : Path, str
81
+ Path to the directory containing the production tables.
86
82
  db : DatabaseHandler
87
83
  Database handler object.
88
84
  """
89
- input_path = Path(args_dict["input_path"])
85
+ input_path = Path(input_path)
90
86
  logger.info(f"Reading production tables from repository path {input_path}")
91
87
 
92
88
  for model in filter(Path.is_dir, input_path.iterdir()):
@@ -101,7 +97,6 @@ def add_production_tables_to_db(args_dict, db):
101
97
  continue
102
98
  logger.info(f"Adding production table for {collection} to the database")
103
99
  db.add_production_table(
104
- db_name=args_dict["db_name"],
105
100
  production_table=data,
106
101
  )
107
102
 
@@ -119,7 +114,7 @@ def _read_production_table(model_dict, file, model_name):
119
114
  "design_model": {},
120
115
  },
121
116
  )
122
- parameter_dict = gen.collect_data_from_file(file_name=file)
117
+ parameter_dict = ascii_handler.collect_data_from_file(file_name=file)
123
118
  logger.debug(f"Reading production table for {array_element} (collection {collection})")
124
119
  try:
125
120
  if array_element in ("configuration_corsika", "configuration_sim_telarray"):