gammasimtools 0.13.0__py3-none-any.whl → 0.15.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 (226) hide show
  1. {gammasimtools-0.13.0.dist-info → gammasimtools-0.15.0.dist-info}/METADATA +3 -3
  2. {gammasimtools-0.13.0.dist-info → gammasimtools-0.15.0.dist-info}/RECORD +224 -217
  3. {gammasimtools-0.13.0.dist-info → gammasimtools-0.15.0.dist-info}/WHEEL +1 -1
  4. {gammasimtools-0.13.0.dist-info → gammasimtools-0.15.0.dist-info}/entry_points.txt +3 -1
  5. simtools/_version.py +2 -2
  6. simtools/applications/db_add_file_to_db.py +15 -0
  7. simtools/applications/db_add_value_from_json_to_db.py +18 -1
  8. simtools/applications/derive_ctao_array_layouts.py +120 -0
  9. simtools/applications/derive_photon_electron_spectrum.py +29 -1
  10. simtools/applications/docs_produce_array_element_report.py +41 -16
  11. simtools/applications/docs_produce_model_parameter_reports.py +28 -8
  12. simtools/applications/{production_extract_mc_event_data.py → generate_simtel_event_data.py} +12 -20
  13. simtools/applications/print_version.py +81 -0
  14. simtools/applications/production_derive_corsika_limits.py +172 -39
  15. simtools/applications/production_scale_events.py +59 -36
  16. simtools/applications/run_application.py +41 -11
  17. simtools/applications/simulate_light_emission.py +115 -247
  18. simtools/applications/simulate_prod_htcondor_generator.py +2 -2
  19. simtools/camera/single_photon_electron_spectrum.py +163 -15
  20. simtools/data_model/model_data_writer.py +7 -6
  21. simtools/db/db_handler.py +14 -8
  22. simtools/dependencies.py +38 -3
  23. simtools/layout/array_layout.py +1 -0
  24. simtools/layout/ctao_array_layouts.py +172 -0
  25. simtools/model/array_model.py +3 -4
  26. simtools/model/model_parameter.py +30 -87
  27. simtools/production_configuration/derive_corsika_limits.py +222 -154
  28. simtools/production_configuration/event_scaler.py +2 -2
  29. simtools/reporting/docs_auto_report_generator.py +217 -0
  30. simtools/reporting/docs_read_parameters.py +192 -110
  31. simtools/schemas/application_workflow.metaschema.yml +3 -0
  32. simtools/schemas/model_parameter.metaschema.yml +13 -0
  33. simtools/schemas/model_parameter_and_data_schema.metaschema.yml +6 -0
  34. simtools/schemas/model_parameters/adjust_gain.schema.yml +1 -1
  35. simtools/schemas/model_parameters/altitude.schema.yml +1 -1
  36. simtools/schemas/model_parameters/array_coordinates_UTM.schema.yml +3 -3
  37. simtools/schemas/model_parameters/array_element_position_ground.schema.yml +3 -3
  38. simtools/schemas/model_parameters/array_element_position_utm.schema.yml +3 -3
  39. simtools/schemas/model_parameters/array_window.schema.yml +1 -1
  40. simtools/schemas/model_parameters/asum_clipping.schema.yml +1 -1
  41. simtools/schemas/model_parameters/asum_offset.schema.yml +1 -1
  42. simtools/schemas/model_parameters/asum_threshold.schema.yml +1 -1
  43. simtools/schemas/model_parameters/axes_offsets.schema.yml +2 -2
  44. simtools/schemas/model_parameters/camera_body_diameter.schema.yml +1 -1
  45. simtools/schemas/model_parameters/camera_body_shape.schema.yml +1 -1
  46. simtools/schemas/model_parameters/camera_config_rotate.schema.yml +1 -1
  47. simtools/schemas/model_parameters/camera_degraded_efficiency.schema.yml +1 -1
  48. simtools/schemas/model_parameters/camera_depth.schema.yml +1 -1
  49. simtools/schemas/model_parameters/camera_pixels.schema.yml +1 -1
  50. simtools/schemas/model_parameters/camera_transmission.schema.yml +1 -1
  51. simtools/schemas/model_parameters/channels_per_chip.schema.yml +1 -1
  52. simtools/schemas/model_parameters/corsika_iact_io_buffer.schema.yml +1 -1
  53. simtools/schemas/model_parameters/corsika_iact_max_bunches.schema.yml +1 -1
  54. simtools/schemas/model_parameters/corsika_iact_split_auto.schema.yml +1 -1
  55. simtools/schemas/model_parameters/corsika_observation_level.schema.yml +1 -1
  56. simtools/schemas/model_parameters/dark_events.schema.yml +1 -1
  57. simtools/schemas/model_parameters/disc_bins.schema.yml +1 -1
  58. simtools/schemas/model_parameters/disc_start.schema.yml +1 -1
  59. simtools/schemas/model_parameters/discriminator_amplitude.schema.yml +1 -1
  60. simtools/schemas/model_parameters/discriminator_fall_time.schema.yml +1 -1
  61. simtools/schemas/model_parameters/discriminator_gate_length.schema.yml +1 -1
  62. simtools/schemas/model_parameters/discriminator_hysteresis.schema.yml +1 -1
  63. simtools/schemas/model_parameters/discriminator_output_amplitude.schema.yml +1 -1
  64. simtools/schemas/model_parameters/discriminator_output_var_percent.schema.yml +1 -1
  65. simtools/schemas/model_parameters/discriminator_rise_time.schema.yml +1 -1
  66. simtools/schemas/model_parameters/discriminator_scale_threshold.schema.yml +1 -1
  67. simtools/schemas/model_parameters/discriminator_sigsum_over_threshold.schema.yml +1 -1
  68. simtools/schemas/model_parameters/discriminator_threshold.schema.yml +1 -1
  69. simtools/schemas/model_parameters/discriminator_time_over_threshold.schema.yml +1 -1
  70. simtools/schemas/model_parameters/discriminator_var_gate_length.schema.yml +1 -1
  71. simtools/schemas/model_parameters/discriminator_var_sigsum_over_threshold.schema.yml +1 -1
  72. simtools/schemas/model_parameters/discriminator_var_threshold.schema.yml +1 -1
  73. simtools/schemas/model_parameters/discriminator_var_time_over_threshold.schema.yml +1 -1
  74. simtools/schemas/model_parameters/dish_shape_length.schema.yml +1 -1
  75. simtools/schemas/model_parameters/dsum_clipping.schema.yml +1 -1
  76. simtools/schemas/model_parameters/dsum_ignore_below.schema.yml +1 -1
  77. simtools/schemas/model_parameters/dsum_offset.schema.yml +1 -1
  78. simtools/schemas/model_parameters/dsum_pre_clipping.schema.yml +1 -1
  79. simtools/schemas/model_parameters/dsum_prescale.schema.yml +2 -2
  80. simtools/schemas/model_parameters/dsum_presum_max.schema.yml +1 -1
  81. simtools/schemas/model_parameters/dsum_presum_shift.schema.yml +1 -1
  82. simtools/schemas/model_parameters/dsum_threshold.schema.yml +1 -1
  83. simtools/schemas/model_parameters/dsum_zero_clip.schema.yml +1 -1
  84. simtools/schemas/model_parameters/effective_focal_length.schema.yml +5 -5
  85. simtools/schemas/model_parameters/epsg_code.schema.yml +1 -1
  86. simtools/schemas/model_parameters/fadc_amplitude.schema.yml +1 -1
  87. simtools/schemas/model_parameters/fadc_bins.schema.yml +1 -1
  88. simtools/schemas/model_parameters/fadc_compensate_pedestal.schema.yml +1 -1
  89. simtools/schemas/model_parameters/fadc_dev_pedestal.schema.yml +1 -1
  90. simtools/schemas/model_parameters/fadc_err_compensate_pedestal.schema.yml +1 -1
  91. simtools/schemas/model_parameters/fadc_err_pedestal.schema.yml +1 -1
  92. simtools/schemas/model_parameters/fadc_lg_amplitude.schema.yml +1 -1
  93. simtools/schemas/model_parameters/fadc_lg_compensate_pedestal.schema.yml +1 -1
  94. simtools/schemas/model_parameters/fadc_lg_dev_pedestal.schema.yml +1 -1
  95. simtools/schemas/model_parameters/fadc_lg_err_compensate_pedestal.schema.yml +1 -1
  96. simtools/schemas/model_parameters/fadc_lg_err_pedestal.schema.yml +1 -1
  97. simtools/schemas/model_parameters/fadc_lg_max_signal.schema.yml +1 -1
  98. simtools/schemas/model_parameters/fadc_lg_max_sum.schema.yml +1 -1
  99. simtools/schemas/model_parameters/fadc_lg_noise.schema.yml +1 -1
  100. simtools/schemas/model_parameters/fadc_lg_pedestal.schema.yml +1 -1
  101. simtools/schemas/model_parameters/fadc_lg_sensitivity.schema.yml +1 -1
  102. simtools/schemas/model_parameters/fadc_lg_sysvar_pedestal.schema.yml +1 -1
  103. simtools/schemas/model_parameters/fadc_lg_var_pedestal.schema.yml +1 -1
  104. simtools/schemas/model_parameters/fadc_lg_var_sensitivity.schema.yml +1 -1
  105. simtools/schemas/model_parameters/fadc_max_signal.schema.yml +1 -1
  106. simtools/schemas/model_parameters/fadc_max_sum.schema.yml +1 -1
  107. simtools/schemas/model_parameters/fadc_mhz.schema.yml +1 -1
  108. simtools/schemas/model_parameters/fadc_noise.schema.yml +1 -1
  109. simtools/schemas/model_parameters/fadc_pedestal.schema.yml +1 -1
  110. simtools/schemas/model_parameters/fadc_sensitivity.schema.yml +1 -1
  111. simtools/schemas/model_parameters/fadc_sum_bins.schema.yml +1 -1
  112. simtools/schemas/model_parameters/fadc_sum_offset.schema.yml +1 -1
  113. simtools/schemas/model_parameters/fadc_sysvar_pedestal.schema.yml +1 -1
  114. simtools/schemas/model_parameters/fadc_var_pedestal.schema.yml +1 -1
  115. simtools/schemas/model_parameters/fadc_var_sensitivity.schema.yml +1 -1
  116. simtools/schemas/model_parameters/focal_length.schema.yml +1 -1
  117. simtools/schemas/model_parameters/focal_surface_parameters.schema.yml +20 -20
  118. simtools/schemas/model_parameters/focal_surface_ref_radius.schema.yml +1 -1
  119. simtools/schemas/model_parameters/focus_offset.schema.yml +4 -4
  120. simtools/schemas/model_parameters/gain_variation.schema.yml +1 -1
  121. simtools/schemas/model_parameters/geomag_horizontal.schema.yml +1 -1
  122. simtools/schemas/model_parameters/geomag_rotation.schema.yml +1 -1
  123. simtools/schemas/model_parameters/geomag_vertical.schema.yml +1 -1
  124. simtools/schemas/model_parameters/hg_lg_variation.schema.yml +1 -1
  125. simtools/schemas/model_parameters/iobuf_maximum.schema.yml +1 -1
  126. simtools/schemas/model_parameters/iobuf_output_maximum.schema.yml +1 -1
  127. simtools/schemas/model_parameters/laser_events.schema.yml +1 -1
  128. simtools/schemas/model_parameters/laser_external_trigger.schema.yml +1 -1
  129. simtools/schemas/model_parameters/laser_photons.schema.yml +1 -1
  130. simtools/schemas/model_parameters/laser_pulse_exptime.schema.yml +1 -1
  131. simtools/schemas/model_parameters/laser_pulse_offset.schema.yml +1 -1
  132. simtools/schemas/model_parameters/laser_pulse_sigtime.schema.yml +1 -1
  133. simtools/schemas/model_parameters/laser_pulse_twidth.schema.yml +1 -1
  134. simtools/schemas/model_parameters/laser_var_photons.schema.yml +1 -1
  135. simtools/schemas/model_parameters/laser_wavelength.schema.yml +1 -1
  136. simtools/schemas/model_parameters/led_events.schema.yml +1 -1
  137. simtools/schemas/model_parameters/led_photons.schema.yml +1 -1
  138. simtools/schemas/model_parameters/led_pulse_offset.schema.yml +1 -1
  139. simtools/schemas/model_parameters/led_pulse_sigtime.schema.yml +1 -1
  140. simtools/schemas/model_parameters/led_var_photons.schema.yml +1 -1
  141. simtools/schemas/model_parameters/min_photoelectrons.schema.yml +1 -1
  142. simtools/schemas/model_parameters/min_photons.schema.yml +1 -1
  143. simtools/schemas/model_parameters/mirror_align_random_distance.schema.yml +1 -1
  144. simtools/schemas/model_parameters/mirror_align_random_horizontal.schema.yml +4 -4
  145. simtools/schemas/model_parameters/mirror_align_random_vertical.schema.yml +4 -4
  146. simtools/schemas/model_parameters/mirror_class.schema.yml +1 -1
  147. simtools/schemas/model_parameters/mirror_degraded_reflection.schema.yml +1 -1
  148. simtools/schemas/model_parameters/mirror_focal_length.schema.yml +1 -1
  149. simtools/schemas/model_parameters/mirror_offset.schema.yml +1 -1
  150. simtools/schemas/model_parameters/mirror_panel_2f_measurements.schema.yml +3 -3
  151. simtools/schemas/model_parameters/mirror_reflection_random_angle.schema.yml +3 -3
  152. simtools/schemas/model_parameters/multiplicity_offset.schema.yml +1 -1
  153. simtools/schemas/model_parameters/muon_mono_threshold.schema.yml +45 -0
  154. simtools/schemas/model_parameters/nsb_autoscale_airmass.schema.yml +2 -2
  155. simtools/schemas/model_parameters/nsb_gain_drop_scale.schema.yml +1 -1
  156. simtools/schemas/model_parameters/nsb_offaxis.schema.yml +5 -5
  157. simtools/schemas/model_parameters/nsb_pixel_rate.schema.yml +1 -1
  158. simtools/schemas/model_parameters/nsb_reference_value.schema.yml +1 -1
  159. simtools/schemas/model_parameters/nsb_scaling_factor.schema.yml +1 -1
  160. simtools/schemas/model_parameters/nsb_spectrum.schema.yml +2 -2
  161. simtools/schemas/model_parameters/num_gains.schema.yml +1 -1
  162. simtools/schemas/model_parameters/pedestal_events.schema.yml +1 -1
  163. simtools/schemas/model_parameters/photon_delay.schema.yml +1 -1
  164. simtools/schemas/model_parameters/photons_per_run.schema.yml +1 -1
  165. simtools/schemas/model_parameters/pixel_cells.schema.yml +1 -1
  166. simtools/schemas/model_parameters/pixels_parallel.schema.yml +1 -1
  167. simtools/schemas/model_parameters/pixeltrg_time_step.schema.yml +1 -1
  168. simtools/schemas/model_parameters/pm_average_gain.schema.yml +1 -1
  169. simtools/schemas/model_parameters/pm_collection_efficiency.schema.yml +1 -1
  170. simtools/schemas/model_parameters/pm_gain_index.schema.yml +1 -1
  171. simtools/schemas/model_parameters/pm_transit_time.schema.yml +4 -4
  172. simtools/schemas/model_parameters/pm_voltage_variation.schema.yml +1 -1
  173. simtools/schemas/model_parameters/primary_mirror_degraded_map.schema.yml +7 -3
  174. simtools/schemas/model_parameters/primary_mirror_diameter.schema.yml +1 -1
  175. simtools/schemas/model_parameters/primary_mirror_hole_diameter.schema.yml +1 -1
  176. simtools/schemas/model_parameters/primary_mirror_parameters.schema.yml +20 -20
  177. simtools/schemas/model_parameters/primary_mirror_ref_radius.schema.yml +1 -1
  178. simtools/schemas/model_parameters/qe_variation.schema.yml +1 -1
  179. simtools/schemas/model_parameters/random_focal_length.schema.yml +2 -2
  180. simtools/schemas/model_parameters/random_mono_probability.schema.yml +38 -0
  181. simtools/schemas/model_parameters/reference_point_altitude.schema.yml +1 -1
  182. simtools/schemas/model_parameters/reference_point_latitude.schema.yml +4 -1
  183. simtools/schemas/model_parameters/reference_point_longitude.schema.yml +4 -1
  184. simtools/schemas/model_parameters/reference_point_utm_east.schema.yml +1 -1
  185. simtools/schemas/model_parameters/reference_point_utm_north.schema.yml +1 -1
  186. simtools/schemas/model_parameters/secondary_mirror_baffle.schema.yml +5 -5
  187. simtools/schemas/model_parameters/secondary_mirror_degraded_reflection.schema.yml +1 -1
  188. simtools/schemas/model_parameters/secondary_mirror_diameter.schema.yml +1 -1
  189. simtools/schemas/model_parameters/secondary_mirror_hole_diameter.schema.yml +1 -1
  190. simtools/schemas/model_parameters/secondary_mirror_parameters.schema.yml +20 -20
  191. simtools/schemas/model_parameters/secondary_mirror_ref_radius.schema.yml +1 -1
  192. simtools/schemas/model_parameters/secondary_mirror_shadow_diameter.schema.yml +1 -1
  193. simtools/schemas/model_parameters/secondary_mirror_shadow_offset.schema.yml +1 -1
  194. simtools/schemas/model_parameters/stars.schema.yml +36 -0
  195. simtools/schemas/model_parameters/store_photoelectrons.schema.yml +1 -1
  196. simtools/schemas/model_parameters/tailcut_scale.schema.yml +1 -1
  197. simtools/schemas/model_parameters/telescope_axis_height.schema.yml +1 -1
  198. simtools/schemas/model_parameters/telescope_random_angle.schema.yml +1 -1
  199. simtools/schemas/model_parameters/telescope_random_error.schema.yml +1 -1
  200. simtools/schemas/model_parameters/telescope_sphere_radius.schema.yml +1 -1
  201. simtools/schemas/model_parameters/telescope_transmission.schema.yml +6 -6
  202. simtools/schemas/model_parameters/teltrig_min_sigsum.schema.yml +1 -1
  203. simtools/schemas/model_parameters/teltrig_min_time.schema.yml +1 -1
  204. simtools/schemas/model_parameters/transit_time_calib_error.schema.yml +1 -1
  205. simtools/schemas/model_parameters/transit_time_compensate_error.schema.yml +1 -1
  206. simtools/schemas/model_parameters/transit_time_compensate_step.schema.yml +1 -1
  207. simtools/schemas/model_parameters/transit_time_error.schema.yml +1 -1
  208. simtools/schemas/model_parameters/transit_time_jitter.schema.yml +1 -1
  209. simtools/schemas/model_parameters/trigger_current_limit.schema.yml +1 -1
  210. simtools/schemas/model_parameters/trigger_delay_compensation.schema.yml +4 -4
  211. simtools/schemas/model_parameters/trigger_pixels.schema.yml +1 -1
  212. simtools/simtel/simtel_config_writer.py +70 -38
  213. simtools/simtel/simtel_io_event_reader.py +278 -0
  214. simtools/simtel/simtel_io_event_writer.py +317 -0
  215. simtools/simtel/simulator_light_emission.py +181 -67
  216. simtools/simulator.py +2 -2
  217. simtools/testing/configuration.py +18 -0
  218. simtools/utils/general.py +33 -7
  219. simtools/utils/geometry.py +19 -0
  220. simtools/utils/names.py +7 -1
  221. simtools/visualization/visualize.py +2 -2
  222. simtools/production_configuration/extract_mc_event_data.py +0 -253
  223. simtools/simtel/simtel_io_events.py +0 -265
  224. {gammasimtools-0.13.0.dist-info → gammasimtools-0.15.0.dist-info/licenses}/LICENSE +0 -0
  225. {gammasimtools-0.13.0.dist-info → gammasimtools-0.15.0.dist-info}/top_level.txt +0 -0
  226. /simtools/schemas/model_parameters/{nsb_skymap.schema.yml → nsb_sky_map.schema.yml} +0 -0
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (76.1.0)
2
+ Generator: setuptools (78.1.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -10,6 +10,7 @@ simtools-db-get-array-layouts-from-db = simtools.applications.db_get_array_layou
10
10
  simtools-db-get-file-from-db = simtools.applications.db_get_file_from_db:main
11
11
  simtools-db-get-parameter-from-db = simtools.applications.db_get_parameter_from_db:main
12
12
  simtools-db-inspect-databases = simtools.applications.db_inspect_databases:main
13
+ simtools-derive-ctao-array-layouts = simtools.applications.derive_ctao_array_layouts:main
13
14
  simtools-derive-mirror-rnda = simtools.applications.derive_mirror_rnda:main
14
15
  simtools-derive-photon-electron-spectrum = simtools.applications.derive_photon_electron_spectrum:main
15
16
  simtools-derive-psf-parameters = simtools.applications.derive_psf_parameters:main
@@ -20,10 +21,11 @@ simtools-generate-corsika-histograms = simtools.applications.generate_corsika_hi
20
21
  simtools-generate-default-metadata = simtools.applications.generate_default_metadata:main
21
22
  simtools-generate-regular-arrays = simtools.applications.generate_regular_arrays:main
22
23
  simtools-generate-simtel-array-histograms = simtools.applications.generate_simtel_array_histograms:main
24
+ simtools-generate-simtel-event-data = simtools.applications.generate_simtel_event_data:main
23
25
  simtools-plot-array-layout = simtools.applications.plot_array_layout:main
24
26
  simtools-plot-tabular-data = simtools.applications.plot_tabular_data:main
27
+ simtools-print-version = simtools.applications.print_version:main
25
28
  simtools-production-derive-corsika-limits = simtools.applications.production_derive_corsika_limits:main
26
- simtools-production-extract-mc-event-data = simtools.applications.production_extract_mc_event_data:main
27
29
  simtools-production-generate-simulation-config = simtools.applications.production_generate_simulation_config:main
28
30
  simtools-production-scale-events = simtools.applications.production_scale_events:main
29
31
  simtools-run-application = simtools.applications.run_application:main
simtools/_version.py CHANGED
@@ -17,5 +17,5 @@ __version__: str
17
17
  __version_tuple__: VERSION_TUPLE
18
18
  version_tuple: VERSION_TUPLE
19
19
 
20
- __version__ = version = '0.13.0'
21
- __version_tuple__ = version_tuple = (0, 13, 0)
20
+ __version__ = version = '0.15.0'
21
+ __version_tuple__ = version_tuple = (0, 15, 0)
@@ -38,6 +38,7 @@
38
38
  """
39
39
 
40
40
  import logging
41
+ import uuid
41
42
  from pathlib import Path
42
43
 
43
44
  import simtools.utils.general as gen
@@ -69,6 +70,11 @@ def _parse():
69
70
  type=str,
70
71
  help=("The database to insert the files to."),
71
72
  )
73
+ config.parser.add_argument(
74
+ "--test_db",
75
+ help="Use sandbox database. Drop all data after the operation.",
76
+ action="store_true",
77
+ )
72
78
 
73
79
  return config.initialize(paths=False, db_config=True)
74
80
 
@@ -134,6 +140,10 @@ def confirm_and_insert_files(files_to_insert, args_dict, db, logger):
134
140
  """
135
141
  plural = "" if len(files_to_insert) == 1 else "s"
136
142
 
143
+ if args_dict.get("test_db", False):
144
+ args_dict["db"] = args_dict["db"] + str(uuid.uuid4())
145
+ logger.info(f"Using test database: {args_dict['db']}")
146
+
137
147
  print(f"Should the following file{plural} be inserted to the {args_dict['db']} DB?:\n")
138
148
  print(*files_to_insert, sep="\n")
139
149
  print()
@@ -145,6 +155,11 @@ def confirm_and_insert_files(files_to_insert, args_dict, db, logger):
145
155
  else:
146
156
  logger.info(f"Aborted, did not insert file{plural} to the {args_dict['db']} DB")
147
157
 
158
+ # drop test database; be safe and required DB name is sandbox
159
+ if args_dict.get("test_db", False) and "sandbox" in args_dict["db"]:
160
+ logger.info(f"Test database used. Dropping all data from {args_dict['db']}")
161
+ db.db_client.drop_database(args_dict["db"])
162
+
148
163
 
149
164
  def main(): # noqa: D103
150
165
  args_dict, db_config = _parse()
@@ -26,6 +26,7 @@ r"""
26
26
  """
27
27
 
28
28
  import logging
29
+ import uuid
29
30
  from pathlib import Path
30
31
 
31
32
  import simtools.utils.general as gen
@@ -45,7 +46,11 @@ def _parse():
45
46
  config.parser.add_argument(
46
47
  "--db_collection", help="DB collection to which to add new values.", required=True
47
48
  )
48
- config.parser.add_argument("--db", help="Database name", type=str, required=True)
49
+ config.parser.add_argument(
50
+ "--test_db",
51
+ help="Use sandbox database. Drop all data after the operation.",
52
+ action="store_true",
53
+ )
49
54
  return config.initialize(db_config=True)
50
55
 
51
56
 
@@ -55,6 +60,9 @@ def main(): # noqa: D103
55
60
  logger = logging.getLogger()
56
61
  logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
57
62
 
63
+ if args_dict.get("test_db", False):
64
+ db_config["db_simulation_model"] = db_config["db_simulation_model"] + str(uuid.uuid4())
65
+ logger.info(f"Using test database: {db_config['db_simulation_model']}")
58
66
  db = db_handler.DatabaseHandler(mongo_db_config=db_config)
59
67
 
60
68
  files_to_insert = []
@@ -74,6 +82,8 @@ def main(): # noqa: D103
74
82
  print(*files_to_insert, sep="\n")
75
83
  print()
76
84
 
85
+ logger.info(f"DB {args_dict['db_simulation_model']} selected.")
86
+
77
87
  if gen.user_confirm():
78
88
  for file_to_insert_now in files_to_insert:
79
89
  par_dict = gen.collect_data_from_file(file_name=file_to_insert_now)
@@ -91,6 +101,13 @@ def main(): # noqa: D103
91
101
  else:
92
102
  logger.info("Aborted, no change applied to the database")
93
103
 
104
+ # drop test database; be safe and required DB name is sandbox
105
+ if args_dict.get("test_db", False) and "sandbox" in args_dict["db_simulation_model"]:
106
+ logger.info(
107
+ f"Test database used. Dropping all data from {db_config['db_simulation_model']}"
108
+ )
109
+ db.db_client.drop_database(db_config["db_simulation_model"])
110
+
94
111
 
95
112
  if __name__ == "__main__":
96
113
  main()
@@ -0,0 +1,120 @@
1
+ #!/usr/bin/python3
2
+
3
+ r"""
4
+ Derive CTAO array layouts definitions using CTAO common identifiers repository.
5
+
6
+ Retrieves the CTAO array layouts definitions from the CTAO common identifiers repository
7
+ and synchronizes them with the model parameter definition in 'array_layouts' for all
8
+ CTAO sites.
9
+
10
+ Requires access to the CTAO common identifiers repository. Future versions of the
11
+ common identifiers might be stored in a CTAO technical database.
12
+
13
+ Command line arguments
14
+ ----------------------
15
+ site (str)
16
+ CTAO site (North or South).
17
+ parameter_version (str)
18
+ Model parameter version.
19
+ repository_url (str)
20
+ URL or path of the CTAO common identifiers repository.
21
+ repository_branch (str )
22
+ Repository branch to use for CTAO common identifiers.
23
+ updated_parameter_version (str)
24
+ Updated parameter version.
25
+
26
+ Example
27
+ -------
28
+
29
+ Derive the CTAO array layouts definitions for the North site using the CTAO common identifiers
30
+ repository. Merge the retrieved array layouts with the model parameter definition in
31
+ 'array_layouts' (in this example for site North and parameter version 2.0.0). Write the
32
+ updated array layouts and metadata using the parameter version indicated by the
33
+ 'updated_parameter_version' argument.
34
+
35
+ .. code-block:: console
36
+
37
+ simtools-derive-ctao-array-layouts --site North \
38
+ --repository_url "https://gitlab.cta-observatory.org/" \
39
+ "cta-computing/common/identifiers/-/raw/" \
40
+ --repository_branch main \
41
+ --site North --parameter_version 2.0.0 \
42
+ --updated_parameter_version 3.0.0
43
+ """
44
+
45
+ import logging
46
+ from pathlib import Path
47
+
48
+ import simtools.utils.general as gen
49
+ from simtools.configuration import configurator
50
+ from simtools.db import db_handler
51
+ from simtools.layout.ctao_array_layouts import (
52
+ merge_array_layouts,
53
+ retrieve_array_layouts,
54
+ write_array_layouts,
55
+ )
56
+
57
+
58
+ def _parse(label):
59
+ """Parse command line configuration."""
60
+ config = configurator.Configurator(
61
+ label=label,
62
+ description="Derive CTAO array layouts from CTAO common identifiers repository.",
63
+ )
64
+ config.parser.add_argument(
65
+ "--repository_url",
66
+ help="URL or path of the CTAO common identifiers repository.",
67
+ type=str,
68
+ default="https://gitlab.cta-observatory.org/cta-computing/common/identifiers/-/raw/",
69
+ )
70
+ config.parser.add_argument(
71
+ "--repository_branch",
72
+ help="Repository branch to use for CTAO common identifiers.",
73
+ type=str,
74
+ default="main",
75
+ required=False,
76
+ )
77
+ config.parser.add_argument(
78
+ "--updated_parameter_version",
79
+ help="Updated parameter version.",
80
+ type=str,
81
+ required=False,
82
+ )
83
+ return config.initialize(
84
+ db_config=True, output=True, simulation_model=["site", "parameter_version", "model_version"]
85
+ )
86
+
87
+
88
+ def main(): # noqa: D103
89
+ args_dict, db_config = _parse(Path(__file__).stem)
90
+
91
+ logger = logging.getLogger()
92
+ logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
93
+
94
+ ctao_array_layouts = retrieve_array_layouts(
95
+ site=args_dict["site"],
96
+ repository_url=args_dict["repository_url"],
97
+ branch_name=args_dict["repository_branch"],
98
+ )
99
+
100
+ db = db_handler.DatabaseHandler(mongo_db_config=db_config)
101
+ db_array_layouts = db.get_model_parameter(
102
+ parameter="array_layouts",
103
+ site=args_dict["site"],
104
+ array_element_name=None,
105
+ parameter_version=args_dict.get("parameter_version"),
106
+ model_version=args_dict.get("model_version"),
107
+ )
108
+ db_array_layouts["array_layouts"].pop("_id", None)
109
+ db_array_layouts["array_layouts"].pop("entry_date", None)
110
+ logger.info(f"Layouts from DB: {db_array_layouts}")
111
+
112
+ write_array_layouts(
113
+ array_layouts=merge_array_layouts(db_array_layouts["array_layouts"], ctao_array_layouts),
114
+ args_dict=args_dict,
115
+ db_config=db_config,
116
+ )
117
+
118
+
119
+ if __name__ == "__main__":
120
+ main()
@@ -69,11 +69,39 @@ def _parse(label):
69
69
  )
70
70
  config.parser.add_argument(
71
71
  "--max_amplitude",
72
- help="Maximum amplitude in amplitude spectrum",
72
+ help="Maximum amplitude for single p.e. for amplitude spectrum",
73
73
  type=float,
74
74
  default=42.0,
75
75
  required=False,
76
76
  )
77
+ config.parser.add_argument(
78
+ "--scale_afterpulse_spectrum",
79
+ help="Scale afterpulse spectrum by the given factor",
80
+ type=float,
81
+ default=1.0,
82
+ required=False,
83
+ )
84
+ config.parser.add_argument(
85
+ "--afterpulse_amplitude_range",
86
+ help="Amplitude range in pe for afterpulse calculation",
87
+ type=float,
88
+ nargs=2,
89
+ default=[0.0, 42.0],
90
+ required=False,
91
+ )
92
+ config.parser.add_argument(
93
+ "--fit_afterpulse",
94
+ help="Fit afterpulse spectrum with an exponential decay function.",
95
+ action="store_true",
96
+ required=False,
97
+ )
98
+ config.parser.add_argument(
99
+ "--afterpulse_decay_factor_fixed_value",
100
+ help="Fix decay factor in afterpulse fit (free fit parameter if not set set).",
101
+ type=float,
102
+ default=15.0,
103
+ required=False,
104
+ )
77
105
  config.parser.add_argument(
78
106
  "--use_norm_spe",
79
107
  help="Use sim_telarray tool 'norm_spe' to normalize the spectrum.",
@@ -9,9 +9,11 @@ Currently only implemented for telescopes.
9
9
  """
10
10
 
11
11
  import logging
12
+ from pathlib import Path
12
13
 
13
14
  from simtools.configuration import configurator
14
15
  from simtools.io_operations import io_handler
16
+ from simtools.reporting.docs_auto_report_generator import ReportGenerator
15
17
  from simtools.reporting.docs_read_parameters import ReadParameters
16
18
  from simtools.utils import general as gen
17
19
 
@@ -24,38 +26,61 @@ def _parse(label):
24
26
  )
25
27
 
26
28
  config.parser.add_argument(
27
- "--parameter",
29
+ "--all_telescopes",
28
30
  action="store_true",
29
- help="Compare all parameters across model versions for one telescope.",
31
+ help="Produce reports for all telescopes.",
32
+ )
33
+
34
+ config.parser.add_argument(
35
+ "--all_model_versions",
36
+ action="store_true",
37
+ help="Produce reports for all model versions.",
38
+ )
39
+
40
+ config.parser.add_argument(
41
+ "--all_sites", action="store_true", help="Produce reports for all sites."
42
+ )
43
+
44
+ config.parser.add_argument(
45
+ "--observatory",
46
+ action="store_true",
47
+ help="Produce reports for an observatory at a given site.",
30
48
  )
31
49
 
32
50
  return config.initialize(
33
- db_config=True, simulation_model=["site", "telescope", "model_version", "parameter_version"]
51
+ db_config=True, simulation_model=["site", "telescope", "model_version"]
34
52
  )
35
53
 
36
54
 
37
55
  def main(): # noqa: D103
38
56
  label_name = "reports"
39
57
  args, db_config = _parse(label_name)
58
+
40
59
  io_handler_instance = io_handler.IOHandler()
41
- output_path = io_handler_instance.get_output_directory(
42
- label=label_name, sub_dir=f"productions/{args['model_version']}"
43
- )
60
+ output_path = io_handler_instance.get_output_directory(label=label_name, sub_dir="productions")
44
61
 
45
62
  logger = logging.getLogger()
46
63
  logger.setLevel(gen.get_log_level_from_user(args["log_level"]))
47
64
 
48
- ReadParameters(
49
- db_config,
50
- args,
51
- output_path,
52
- ).produce_array_element_report()
65
+ if any([args.get("all_telescopes"), args.get("all_sites"), args.get("all_model_versions")]):
66
+ ReportGenerator(
67
+ db_config,
68
+ args,
69
+ output_path,
70
+ ).auto_generate_array_element_reports()
53
71
 
54
- logger.info(
55
- f"Markdown report generated for {args['site']}"
56
- f" Telescope {args['telescope']} (v{args['model_version']}):"
57
- f" {output_path}"
58
- )
72
+ else:
73
+ ReadParameters(
74
+ db_config,
75
+ args,
76
+ Path(output_path / f"{args['model_version']}"),
77
+ ).produce_array_element_report()
78
+
79
+ logger.info(
80
+ f"Markdown report generated for {args['site']}"
81
+ f" Telescope {args['telescope']} (v{args['model_version']}):"
82
+ f" {output_path}"
83
+ )
59
84
 
60
85
 
61
86
  if __name__ == "__main__":
@@ -12,6 +12,7 @@ import logging
12
12
 
13
13
  from simtools.configuration import configurator
14
14
  from simtools.io_operations import io_handler
15
+ from simtools.reporting.docs_auto_report_generator import ReportGenerator
15
16
  from simtools.reporting.docs_read_parameters import ReadParameters
16
17
  from simtools.utils import general as gen
17
18
 
@@ -23,6 +24,16 @@ def _parse(label):
23
24
  description=("Produce a markdown report for model parameters."),
24
25
  )
25
26
 
27
+ config.parser.add_argument(
28
+ "--all_telescopes",
29
+ action="store_true",
30
+ help="Produce reports for all telescopes.",
31
+ )
32
+
33
+ config.parser.add_argument(
34
+ "--all_sites", action="store_true", help="Produce reports for all sites."
35
+ )
36
+
26
37
  return config.initialize(db_config=True, simulation_model=["site", "telescope"])
27
38
 
28
39
 
@@ -35,15 +46,24 @@ def main(): # noqa: D103
35
46
  logger = logging.getLogger()
36
47
  logger.setLevel(gen.get_log_level_from_user(args["log_level"]))
37
48
 
38
- ReadParameters(
39
- db_config,
40
- args,
41
- output_path,
42
- ).produce_model_parameter_reports()
49
+ if any([args.get("all_telescopes"), args.get("all_sites")]):
50
+ ReportGenerator(
51
+ db_config,
52
+ args,
53
+ output_path,
54
+ ).auto_generate_parameter_reports()
43
55
 
44
- logger.info(
45
- f"Markdown report generated for {args['site']} Telescope {args['telescope']}: {output_path}"
46
- )
56
+ else:
57
+ ReadParameters(
58
+ db_config,
59
+ args,
60
+ output_path,
61
+ ).produce_model_parameter_reports()
62
+
63
+ logger.info(
64
+ f"Markdown report generated for {args['site']}"
65
+ f"Telescope {args['telescope']}: {output_path}"
66
+ )
47
67
 
48
68
 
49
69
  if __name__ == "__main__":
@@ -21,6 +21,7 @@ Generate a reduced dataset from input files and save the result.
21
21
  .. code-block:: console
22
22
 
23
23
  simtools-production-extract-mc-event-data \
24
+ simtools-generate-simtel-event-data \
24
25
  --prefix path/to/input_files/ \
25
26
  --wildcard 'gamma_*dark*.simtel.zst' \
26
27
  --output_file output_file.hdf5 \
@@ -34,7 +35,8 @@ from pathlib import Path
34
35
  import simtools.utils.general as gen
35
36
  from simtools.configuration import configurator
36
37
  from simtools.io_operations import io_handler
37
- from simtools.production_configuration.extract_mc_event_data import MCEventExtractor
38
+ from simtools.simtel.simtel_io_event_reader import SimtelIOEventDataReader
39
+ from simtools.simtel.simtel_io_event_writer import SimtelIOEventDataWriter
38
40
 
39
41
 
40
42
  def _parse(label, description):
@@ -64,8 +66,9 @@ def _parse(label, description):
64
66
 
65
67
  config.parser.add_argument(
66
68
  "--print_dataset_information",
67
- action="store_true",
68
- help="Print information about the datasets in the generated reduced event dataset.",
69
+ type=int,
70
+ help="Print given number of rows of the dataset.",
71
+ default=0,
69
72
  )
70
73
 
71
74
  return config.initialize(db_config=False)
@@ -75,20 +78,7 @@ def main():
75
78
  """
76
79
  Process event data files and store data in reduced dataset.
77
80
 
78
- The reduced dataset contains the following information:
79
- - simulated: List of simulated events.
80
- - shower_id_triggered: List of triggered shower IDs
81
- (as in the telescope definition file used for simulations).
82
- - triggered_energies: List of energies for triggered events.
83
- - num_triggered_telescopes: Number of triggered telescopes for each event.
84
- - core_x: X-coordinate of the shower core (ground coordinates).
85
- - core_y: Y-coordinate of the shower core (ground coordinates).
86
- - trigger_telescope_list_list: List of lists containing triggered telescope IDs.
87
- - file_names: List of input file names.
88
- - shower_sim_azimuth: Simulated azimuth angle of the shower.
89
- - shower_sim_altitude: Simulated altitude angle of the shower.
90
- - array_altitudes: List of altitudes for the array.
91
- - array_azimuths: List of azimuths for the array.
81
+ The reduced dataset contains shower information, array information and triggered telescopes.
92
82
  """
93
83
  label = Path(__file__).stem
94
84
 
@@ -114,11 +104,13 @@ def main():
114
104
  output_filepath = Path(output_path).joinpath(f"{args_dict['output_file']}")
115
105
 
116
106
  output_filepath.parent.mkdir(parents=True, exist_ok=True)
117
- generator = MCEventExtractor(files, output_filepath, args_dict["max_files"])
107
+ generator = SimtelIOEventDataWriter(files, output_filepath, args_dict["max_files"])
118
108
  generator.process_files()
119
109
  _logger.info(f"reduced dataset saved to: {output_filepath}")
120
- if args_dict["print_dataset_information"]:
121
- generator.print_dataset_information()
110
+
111
+ if args_dict["print_dataset_information"] > 0:
112
+ reader = SimtelIOEventDataReader(output_filepath)
113
+ reader.print_dataset_information(args_dict.get("print_dataset_information"))
122
114
 
123
115
 
124
116
  if __name__ == "__main__":
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/python3
2
+ """
3
+ Print the versions of the simtools software.
4
+
5
+ The versions of simtools, the DB, sim_telarray, and CORSIKA are printed.
6
+
7
+ """
8
+
9
+ import json
10
+ import logging
11
+ from pathlib import Path
12
+
13
+ from simtools import dependencies, version
14
+ from simtools.configuration import configurator
15
+ from simtools.io_operations import io_handler
16
+ from simtools.utils import general as gen
17
+
18
+
19
+ def _parse(label, description, usage):
20
+ """
21
+ Parse command line configuration.
22
+
23
+ No command line arguments are required for this application,
24
+ but the configurator is called to set up the DB connection and
25
+ the structure with _parse is kept from other applications for consistency.
26
+
27
+ Parameters
28
+ ----------
29
+ label : str
30
+ Label describing the application.
31
+ description : str
32
+ Description of the application.
33
+ usage : str
34
+ Example on how to use the application.
35
+
36
+ Returns
37
+ -------
38
+ CommandLineParser
39
+ Command line parser object.
40
+ """
41
+ config = configurator.Configurator(label=label, description=description, usage=usage)
42
+
43
+ return config.initialize(db_config=True, output=True)
44
+
45
+
46
+ def main():
47
+ """Print the versions of the simtools software."""
48
+ label = Path(__file__).stem
49
+ args_dict, db_config = _parse(
50
+ label=label,
51
+ description="Print the versions of simtools, the DB, sim_telarray and CORSIKA.",
52
+ usage="simtools-print-version",
53
+ )
54
+ logger = logging.getLogger()
55
+ logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
56
+ io_handler_instance = io_handler.IOHandler()
57
+
58
+ version_string = dependencies.get_version_string(db_config)
59
+ version_dict = {"simtools version": version.__version__}
60
+
61
+ print()
62
+ # The loop below is not necessary, there is only one entry, but it is cleaner
63
+ for key, value in version_dict.items(): #
64
+ print(f"{key}: {value}")
65
+ print(version_string)
66
+
67
+ version_list = version_string.strip().split("\n")
68
+ for version_entry in version_list:
69
+ key, value = version_entry.split(": ")
70
+ version_dict[key] = value
71
+
72
+ with open(
73
+ io_handler_instance.get_output_file(args_dict["output_file"], label=label),
74
+ "w",
75
+ encoding="utf-8",
76
+ ) as f:
77
+ json.dump(version_dict, f, indent=4)
78
+
79
+
80
+ if __name__ == "__main__":
81
+ main()