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
@@ -1,35 +1,27 @@
1
1
  #!/usr/bin/python3
2
2
 
3
- """
4
- Summary
5
- -------
6
- This application is used to run simulations for productions (typically on the grid).
7
- It allows to run a Paranal (CTAO-South) or La Palma (CTAO-North) array layout simulation
8
- with the provided "prod_tag" simulation configuration (e.g., Prod6)
9
- for a given primary particle, azimuth, and zenith angle.
3
+ r"""
4
+ Generate simulation configuration and run simulations (if required).
10
5
 
11
- The entire simulation chain is performed, i.e., shower simulations with CORSIKA
12
- which are piped directly to sim_telarray using the sim_telarray multipipe mechanism.
13
- This script produces all the necessary configuration files for CORSIKA and
14
- sim_telarray before running simulation.
15
- The multipipe scripts will be produced as part of this script.
6
+ Multipipe scripts will be produced as part of this application.
7
+ Allows to run array layout simulation including shower and detector simulations
16
8
 
17
- This script does not provide a mechanism to submit jobs to a batch system like others
18
- in simtools since it is meant to be executed on a grid node
19
- (distributed to it by the workload management system).
9
+ The entire simulation chain, parts of it, or nothing is executed:
10
+
11
+ - shower simulations with CORSIKA only
12
+ - shower simulations with CORSIKA which are piped directly to sim_telarray using
13
+ the sim_telarray multipipe mechanism.
20
14
 
21
15
  Command line arguments
22
16
  ----------------------
23
- production_config (str, Path, required)
24
- Simulation configuration file
25
- (contains the default setup which can be overwritten by the command line options).
26
17
  model_version (str, required)
27
- The telescope model version to use (e.g., Prod5).
18
+ The telescope model version to use (e.g., 5.0.0).
28
19
  site (str, required)
29
20
  North or South (case insensitive).
30
21
  primary (str, required)
31
- Name of the primary particle to simulate. The available options are
32
- gamma, gamma_diffuse, electron, proton, muon, helium, nitrogen, silicon, and iron.
22
+ Name or ID of the primary particle to simulate. Allowed are common names like gamma, proton,
23
+ or IDs for CORSIKA7 (e.g. 14 for proton) and PDG (e.g. 2212 for proton). Use the
24
+ 'primary_id_type' option to specify the type of ID.
33
25
  azimuth_angle (str or float, required)
34
26
  Telescope pointing direction in azimuth.
35
27
  It can be in degrees between 0 and 360 or one of north, south, east or west
@@ -50,10 +42,10 @@
50
42
  data_directory (str, optional)
51
43
  The location of the output directories corsika-data and simtel-data.
52
44
  the label is added to the data_directory, such that the output
53
- will be written to `data_directory/label/simtel-data`.
45
+ will be written to data_directory/label/simtel-data.
54
46
  pack_for_grid_register (bool, optional)
55
47
  Set whether to prepare a tarball for registering the output files on the grid.
56
- The files are written to the `output_path/directory_for_grid_upload` directory.
48
+ The files are written to the output_path/directory_for_grid_upload directory.
57
49
  log_level (str, optional)
58
50
  Log level to print.
59
51
 
@@ -63,35 +55,16 @@
63
55
 
64
56
  .. code-block:: console
65
57
 
66
- simtools-simulate-prod \
67
- --production_config tests/resources/prod_multi_config_test.yml --model_version Prod5 \
68
- --site north --primary gamma --azimuth_angle north --zenith_angle 20 \
69
- --start_run 0 --run 1
58
+ simtools-simulate-prod \\
59
+ --model_version 5.0.0 --site north --primary gamma --azimuth_angle north \\
60
+ --zenith_angle 20 --start_run 0 --run 1
70
61
 
71
62
  By default the configuration is saved in simtools-output/test-production
72
63
  together with the actual simulation output in corsika-data and simtel-data within.
73
64
  The location of the latter directories can be set
74
65
  to a different location via the option --data_directory,
75
66
  but the label is always added to the data_directory, such that the output
76
- will be written to `data_directory/label/simtel-data`.
77
-
78
- Expected final print-out message:
79
-
80
- .. code-block:: console
81
-
82
- INFO::array_layout(l569)::read_telescope_list_file::Reading array elements from ...
83
- WARNING::corsika_runner(l127)::_load_corsika_config_data::data_directory not given
84
- in corsika_config - default output directory will be set.
85
- INFO::array_layout(l569)::read_telescope_list_file::Reading array elements from ...
86
- INFO::corsika_config(l493)::_set_output_file_and_directory::Creating directory
87
- INFO::simulator(l405)::simulate::Submission command: local
88
- INFO::simulator(l410)::simulate::Starting submission for 1 run
89
- INFO::array_model(l315)::export_simtel_array_config_file::Writing array config file into
90
- INFO::job_manager(l95)::submit::Submitting script
91
- INFO::job_manager(l96)::submit::Job output stream
92
- INFO::job_manager(l97)::submit::Job error stream
93
- INFO::job_manager(l98)::submit::Job log stream
94
- INFO::job_manager(l119)::_submit_local::Running script locally
67
+ will be written to data_directory/label/simtel-data.
95
68
  """
96
69
 
97
70
  import logging
@@ -99,22 +72,19 @@ import shutil
99
72
  import tarfile
100
73
  from pathlib import Path
101
74
 
102
- from astropy.io.misc import yaml
103
-
104
75
  import simtools.utils.general as gen
105
76
  from simtools.configuration import configurator
106
- from simtools.configuration.commandline_parser import CommandLineParser
107
77
  from simtools.simulator import Simulator
108
78
 
109
79
 
110
80
  def _parse(description=None):
111
81
  """
112
- Parse the command line configuration.
82
+ Parse command line configuration.
113
83
 
114
84
  Parameters
115
85
  ----------
116
86
  description: str
117
- Description of the application.
87
+ Application description.
118
88
 
119
89
  Returns
120
90
  -------
@@ -122,165 +92,117 @@ def _parse(description=None):
122
92
  Command line parser object.
123
93
 
124
94
  """
125
-
126
95
  config = configurator.Configurator(description=description)
127
96
  config.parser.add_argument(
128
- "--production_config",
97
+ "--data_directory",
129
98
  help=(
130
- "Simulation configuration file "
131
- "(contains the default setup which can be overwritten by the command line options)"
99
+ "The directory where to save the corsika-data and simtel-data output directories."
100
+ "the label is added to the data_directory, such that the output"
101
+ "will be written to data_directory/label/simtel-data."
132
102
  ),
133
- type=str,
134
- required=True,
135
- )
136
- config.parser.add_argument(
137
- "--primary",
138
- help="Primary particle to simulate.",
139
103
  type=str.lower,
140
- required=True,
141
- choices=[
142
- "gamma",
143
- "gamma_diffuse",
144
- "electron",
145
- "proton",
146
- "muon",
147
- "helium",
148
- "nitrogen",
149
- "silicon",
150
- "iron",
151
- ],
152
- )
153
- config.parser.add_argument(
154
- "--azimuth_angle",
155
- help=(
156
- "Telescope pointing direction in azimuth. "
157
- "It can be in degrees between 0 and 360 or one of north, south, east or west "
158
- "(case insensitive). Note that North is 0 degrees and "
159
- "the azimuth grows clockwise, so East is 90 degrees."
160
- ),
161
- type=CommandLineParser.azimuth_angle,
162
- required=True,
163
- )
164
- config.parser.add_argument(
165
- "--zenith_angle",
166
- help="Zenith angle in degrees (between 0 and 180).",
167
- type=CommandLineParser.zenith_angle,
168
- required=True,
104
+ required=False,
105
+ default="./simtools-output/",
169
106
  )
170
107
  config.parser.add_argument(
171
- "--nshow",
172
- help="Number of showers to simulate.",
173
- type=int,
108
+ "--pack_for_grid_register",
109
+ help="Set whether to prepare a tarball for registering the output files on the grid.",
110
+ action="store_true",
174
111
  required=False,
112
+ default=False,
175
113
  )
176
114
  config.parser.add_argument(
177
- "--start_run",
178
- help=(
179
- "Start run number such that the actual run number will be 'start_run' + 'run'. "
180
- "This is useful in case a new transform is submitted for the same production. "
181
- "It allows the transformation system to keep using sequential run numbers without "
182
- "repetition."
183
- ),
184
- type=int,
185
- required=True,
115
+ "--save_file_lists",
116
+ help="Save lists of output and log files.",
117
+ action="store_true",
118
+ required=False,
119
+ default=False,
186
120
  )
187
121
  config.parser.add_argument(
188
- "--run",
189
- help="Run number (actual run number will be 'start_run' + 'run')",
190
- type=int,
191
- required=True,
122
+ "--corsika_test_seeds",
123
+ help="Use predefined random seeds for CORSIKA for testing purposes.",
124
+ action="store_true",
125
+ required=False,
126
+ default=False,
192
127
  )
193
128
  config.parser.add_argument(
194
- "--data_directory",
129
+ "--sim_telarray_seeds",
195
130
  help=(
196
- "The directory where to save the corsika-data and simtel-data output directories."
197
- "the label is added to the data_directory, such that the output"
198
- "will be written to `data_directory/label/simtel-data`."
131
+ "Use the provided random seed for sim_telarray instrument setup."
132
+ "Used only for testing purposes for now."
199
133
  ),
200
- type=str.lower,
134
+ type=str,
201
135
  required=False,
202
- default="./simtools-output/",
203
136
  )
204
- config.parser.add_argument(
205
- "--pack_for_grid_register",
206
- help="Set whether to prepare a tarball for registering the output files on the grid.",
207
- action="store_true",
208
- required=False,
209
- default=False,
137
+ return config.initialize(
138
+ db_config=True,
139
+ job_submission=True,
140
+ simulation_model=["site", "layout", "telescope"],
141
+ simulation_configuration={"software": None, "corsika_configuration": ["all"]},
210
142
  )
211
- return config.initialize(db_config=True, telescope_model=True)
212
143
 
213
144
 
214
- def main():
215
- args_dict, db_config = _parse(description="Run simulations for productions")
145
+ def pack_for_register(logger, simulator, args_dict):
146
+ """
147
+ Pack the output files for registering on the grid.
216
148
 
217
- logger = logging.getLogger()
218
- logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
149
+ Parameters
150
+ ----------
151
+ logger: logging.Logger
152
+ Logger object.
153
+ simulator: Simulator
154
+ Simulator object.
219
155
 
220
- try:
221
- with open(args_dict["production_config"], encoding="utf-8") as file:
222
- config_data = yaml.load(file)
223
- except FileNotFoundError:
224
- logger.error(
225
- f"Error loading simulation configuration file from {args_dict['production_config']}"
226
- )
227
- raise
156
+ """
157
+ logger.info("Packing the output files for registering on the grid")
158
+ output_files = simulator.get_file_list(file_type="output")
159
+ log_files = simulator.get_file_list(file_type="log")
160
+ histogram_files = simulator.get_file_list(file_type="hist")
161
+ tar_file_name = Path(log_files[0]).name.replace("log.gz", "log_hist.tar.gz")
162
+ directory_for_grid_upload = Path(args_dict.get("output_path")).joinpath(
163
+ "directory_for_grid_upload"
164
+ )
165
+ directory_for_grid_upload.mkdir(parents=True, exist_ok=True)
166
+ tar_file_name = directory_for_grid_upload.joinpath(tar_file_name)
167
+
168
+ with tarfile.open(tar_file_name, "w:gz") as tar:
169
+ files_to_tar = log_files[:1] + histogram_files[:1]
170
+ for file_to_tar in files_to_tar:
171
+ tar.add(file_to_tar, arcname=Path(file_to_tar).name)
228
172
 
229
- # Overwrite default and optional settings
230
- config_data["showers"]["run_list"] = args_dict["run"] + args_dict["start_run"]
231
- config_data["showers"]["primary"] = args_dict["primary"]
232
- config_data["common"]["site"] = args_dict["site"]
233
- config_data["common"]["zenith"] = args_dict["zenith_angle"]
234
- config_data["common"]["phi"] = args_dict["azimuth_angle"]
235
- label = config_data["common"].pop("label", "test-production")
236
- config_data["common"]["data_directory"] = Path(args_dict["data_directory"]) / label
173
+ for file_to_move in [*output_files]:
174
+ source_file = Path(file_to_move)
175
+ destination_file = directory_for_grid_upload / source_file.name
176
+ # Note that this will overwrite previous files which exist in the directory
177
+ # It should be fine for normal production since each run is on a separate node
178
+ # so no files are expected there.
179
+ shutil.move(source_file, destination_file)
180
+ logger.info(f"Output files for the grid placed in {directory_for_grid_upload!s}")
237
181
 
238
- if args_dict["nshow"] is not None:
239
- config_data["showers"]["nshow"] = args_dict["nshow"]
240
- if args_dict["label"] is not None:
241
- label = args_dict["label"]
182
+
183
+ def main(): # noqa: D103
184
+ args_dict, db_config = _parse(description="Run simulations for productions")
185
+
186
+ logger = logging.getLogger()
187
+ logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
242
188
 
243
189
  simulator = Simulator(
244
- label=label,
245
- simulator="corsika_simtel",
246
- simulator_source_path=args_dict["simtel_path"],
247
- config_data=config_data,
248
- submit_command="local",
249
- test=args_dict["test"],
250
- mongo_db_config=db_config,
190
+ label=args_dict.get("label"), args_dict=args_dict, mongo_db_config=db_config
251
191
  )
252
192
 
253
193
  simulator.simulate()
254
194
 
255
195
  logger.info(
256
- f"Production run is complete for primary {config_data['showers']['primary']} showers "
257
- f"coming from {config_data['common']['phi']} azimuth and zenith angle of "
258
- f"{config_data['common']['zenith']} at the {args_dict['site']} site, "
259
- f"using the {config_data['array']['model_version']} telescope model."
196
+ f"Production run is complete for primary {args_dict['primary']} showers "
197
+ f"coming from {args_dict['azimuth_angle']} azimuth and zenith angle of "
198
+ f"{args_dict['zenith_angle']} at the {args_dict['site']} site, "
199
+ f"using the {args_dict['model_version']} simulation model."
260
200
  )
261
201
 
262
202
  if args_dict["pack_for_grid_register"]:
263
- logger.info("Packing the output files for registering on the grid")
264
- output_files = simulator.get_list_of_output_files()
265
- log_files = simulator.get_list_of_log_files()
266
- histogram_files = simulator.get_list_of_histogram_files()
267
- tar_file_name = Path(log_files[0]).name.replace("log.gz", "log_hist.tar.gz")
268
- with tarfile.open(tar_file_name, "w:gz") as tar:
269
- files_to_tar = log_files[:1] + histogram_files[:1]
270
- for file_to_tar in files_to_tar:
271
- tar.add(file_to_tar, arcname=Path(file_to_tar).name)
272
- directory_for_grid_upload = Path(args_dict.get("output_path")).joinpath(
273
- "directory_for_grid_upload"
274
- )
275
- directory_for_grid_upload.mkdir(parents=True, exist_ok=True)
276
- for file_to_move in [*output_files, tar_file_name]:
277
- source_file = Path(file_to_move)
278
- destination_file = directory_for_grid_upload / source_file.name
279
- # Note that this will overwrite previous files which exist in the directory
280
- # It should be fine for normal production since each run is on a separate node
281
- # so no files are expected there.
282
- shutil.move(source_file, destination_file)
283
- logger.info(f"Output files for the grid placed in {str(directory_for_grid_upload)}")
203
+ pack_for_register(logger, simulator, args_dict)
204
+ if args_dict["save_file_lists"]:
205
+ simulator.save_file_lists()
284
206
 
285
207
 
286
208
  if __name__ == "__main__":
@@ -1,8 +1,6 @@
1
1
  #!/usr/bin/python3
2
- """
3
- Summary
4
- -------
5
- Submit model parameter (value, table) through the command line.
2
+ r"""
3
+ Submit data file through the command line.
6
4
 
7
5
  Input data and metadata is validated, and if necessary enriched
8
6
  and converted following a pre-described schema.
@@ -23,17 +21,17 @@
23
21
 
24
22
  .. code-block:: console
25
23
 
26
- simtools-submit-data-from-external \
27
- --input_meta ./tests/resources/MLTdata-preproduction.meta.yml \
28
- --input ./tests/resources/MLTdata-preproduction.ecsv \
29
- --schema ./tests/resources/schema_MST_mirror_2f_measurements.yml \
24
+ simtools-submit-data-from-external \\
25
+ --input_meta ./tests/resources/MLTdata-preproduction.meta.yml \\
26
+ --input ./tests/resources/MLTdata-preproduction.ecsv \\
27
+ --schema ./tests/resources/schema_MST_mirror_2f_measurements.yml \\
30
28
  --output_file TEST-submit_data_from_external.ecsv
31
29
 
32
30
  Expected final print-out message:
33
31
 
34
32
  .. code-block:: console
35
33
 
36
- INFO::model_data_writer(l70)::write_data::Writing data to \
34
+ INFO::model_data_writer(l70)::write_data::Writing data to \\
37
35
  /simtools/simtools-output/d-2023-07-31/TEST-submit_data_from_external.ecsv
38
36
 
39
37
  """
@@ -50,7 +48,7 @@ from simtools.data_model.metadata_collector import MetadataCollector
50
48
 
51
49
  def _parse(label, description):
52
50
  """
53
- Parse command line configuration
51
+ Parse command line configuration.
54
52
 
55
53
  Parameters
56
54
  ----------
@@ -65,7 +63,6 @@ def _parse(label, description):
65
63
  Command line parser object
66
64
 
67
65
  """
68
-
69
66
  config = configurator.Configurator(label=label, description=description)
70
67
 
71
68
  config.parser.add_argument(
@@ -89,7 +86,7 @@ def _parse(label, description):
89
86
  return config.initialize(output=True)
90
87
 
91
88
 
92
- def main():
89
+ def main(): # noqa: D103
93
90
  args_dict, _ = _parse(
94
91
  label=Path(__file__).stem,
95
92
  description="Submit and validate data (e.g., input data to tools, model parameters).",
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/python3
2
+ r"""
3
+ Submit a model parameter value and corresponding metadata through the command line.
4
+
5
+ Input and metadata is validated, and if necessary enriched and converted following
6
+ the model parameter schemas. Model parameter data is written in the simtools-style
7
+ json format, metadata as a yaml file.
8
+
9
+ Command line arguments
10
+ ----------------------
11
+ parameter (str)
12
+ model parameter name
13
+ value (str, value)
14
+ input value (number, string, string-type lists)
15
+ instrument (str)
16
+ instrument name.
17
+ site (str)
18
+ site location.
19
+ model_version (str)
20
+ Model version.
21
+ input_meta (str, optional)
22
+ input meta data file (yml format)
23
+
24
+ Example
25
+ -------
26
+
27
+ Submit the number of gains for the LSTN-design readout chain:
28
+
29
+ .. code-block:: console
30
+
31
+ simtools-submit-model-parameter-from-external \
32
+ --parameter num_gains \\
33
+ --value 2 \\
34
+ --instrument LSTN-design \\
35
+ --site North \\
36
+ --model_version 6.0.0 \\
37
+ --input_meta num_gains.metadata.yml
38
+
39
+ """
40
+
41
+ import logging
42
+ from pathlib import Path
43
+
44
+ import simtools.data_model.model_data_writer as writer
45
+ import simtools.utils.general as gen
46
+ from simtools.configuration import configurator
47
+
48
+
49
+ def _parse(label, description):
50
+ """
51
+ Parse command line configuration.
52
+
53
+ Parameters
54
+ ----------
55
+ label: str
56
+ Label describing application.
57
+ description: str
58
+ Description of application.
59
+
60
+ Returns
61
+ -------
62
+ CommandLineParser
63
+ Command line parser object
64
+
65
+ """
66
+ config = configurator.Configurator(label=label, description=description)
67
+
68
+ config.parser.add_argument(
69
+ "--parameter", type=str, required=True, help="Parameter for simulation model"
70
+ )
71
+ config.parser.add_argument("--instrument", type=str, required=True, help="Instrument name")
72
+ config.parser.add_argument("--site", type=str, required=True, help="Site location")
73
+ config.parser.add_argument("--model_version", type=str, required=True, help="Model version")
74
+
75
+ config.parser.add_argument(
76
+ "--value",
77
+ type=str,
78
+ required=True,
79
+ help=(
80
+ "Model parameter value. "
81
+ "Can be a single number, a number with a unit, or a list of values with units. "
82
+ 'Examples: "--value=5", "--value=\'5 km\'", "--value=\'5 cm, 0.5 deg\'"'
83
+ ),
84
+ )
85
+
86
+ config.parser.add_argument(
87
+ "--input_meta",
88
+ help="meta data file associated to input data",
89
+ type=str,
90
+ required=False,
91
+ )
92
+ return config.initialize(output=True)
93
+
94
+
95
+ def main(): # noqa: D103
96
+ args_dict, _ = _parse(
97
+ label=Path(__file__).stem,
98
+ description="Submit and validate a model parameters).",
99
+ )
100
+
101
+ logger = logging.getLogger()
102
+ logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
103
+
104
+ output_path = (
105
+ Path(args_dict["output_path"]) / args_dict["model_version"] / args_dict["instrument"]
106
+ if args_dict.get("output_path")
107
+ else None
108
+ )
109
+ writer.ModelDataWriter.dump_model_parameter(
110
+ parameter_name=args_dict["parameter"],
111
+ value=args_dict["value"],
112
+ instrument=args_dict["instrument"],
113
+ model_version=args_dict["model_version"],
114
+ output_file=Path(args_dict["parameter"]).with_suffix(".json"),
115
+ output_path=output_path,
116
+ use_plain_output_path=args_dict.get("use_plain_output_path"),
117
+ metadata_input_dict=args_dict,
118
+ )
119
+
120
+
121
+ if __name__ == "__main__":
122
+ main()