gammasimtools 0.24.0__py3-none-any.whl → 0.26.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 (138) hide show
  1. {gammasimtools-0.24.0.dist-info → gammasimtools-0.26.0.dist-info}/METADATA +2 -1
  2. {gammasimtools-0.24.0.dist-info → gammasimtools-0.26.0.dist-info}/RECORD +134 -130
  3. {gammasimtools-0.24.0.dist-info → gammasimtools-0.26.0.dist-info}/entry_points.txt +3 -1
  4. {gammasimtools-0.24.0.dist-info → gammasimtools-0.26.0.dist-info}/licenses/LICENSE +1 -1
  5. simtools/_version.py +2 -2
  6. simtools/application_control.py +78 -0
  7. simtools/applications/calculate_incident_angles.py +0 -2
  8. simtools/applications/convert_geo_coordinates_of_array_elements.py +1 -2
  9. simtools/applications/db_add_file_to_db.py +1 -1
  10. simtools/applications/db_add_simulation_model_from_repository_to_db.py +1 -1
  11. simtools/applications/db_add_value_from_json_to_db.py +1 -1
  12. simtools/applications/db_generate_compound_indexes.py +1 -1
  13. simtools/applications/db_get_array_layouts_from_db.py +2 -6
  14. simtools/applications/db_get_file_from_db.py +1 -1
  15. simtools/applications/db_get_parameter_from_db.py +1 -1
  16. simtools/applications/db_inspect_databases.py +1 -1
  17. simtools/applications/db_upload_model_repository.py +1 -1
  18. simtools/applications/derive_ctao_array_layouts.py +1 -2
  19. simtools/applications/derive_mirror_rnda.py +1 -3
  20. simtools/applications/derive_psf_parameters.py +5 -1
  21. simtools/applications/derive_pulse_shape_parameters.py +194 -0
  22. simtools/applications/derive_trigger_rates.py +1 -1
  23. simtools/applications/docs_produce_array_element_report.py +2 -8
  24. simtools/applications/docs_produce_calibration_reports.py +1 -3
  25. simtools/applications/docs_produce_model_parameter_reports.py +0 -2
  26. simtools/applications/docs_produce_simulation_configuration_report.py +1 -3
  27. simtools/applications/generate_array_config.py +0 -1
  28. simtools/applications/generate_corsika_histograms.py +48 -235
  29. simtools/applications/generate_regular_arrays.py +5 -35
  30. simtools/applications/generate_simtel_event_data.py +2 -2
  31. simtools/applications/maintain_simulation_model_add_production.py +2 -2
  32. simtools/applications/maintain_simulation_model_write_array_element_positions.py +87 -0
  33. simtools/applications/plot_array_layout.py +64 -108
  34. simtools/applications/plot_simulated_event_distributions.py +57 -0
  35. simtools/applications/plot_tabular_data.py +0 -1
  36. simtools/applications/plot_tabular_data_for_model_parameter.py +1 -6
  37. simtools/applications/production_derive_corsika_limits.py +1 -1
  38. simtools/applications/production_generate_grid.py +0 -1
  39. simtools/applications/run_application.py +1 -1
  40. simtools/applications/simulate_flasher.py +3 -4
  41. simtools/applications/simulate_illuminator.py +0 -1
  42. simtools/applications/simulate_pedestals.py +2 -6
  43. simtools/applications/simulate_prod.py +9 -28
  44. simtools/applications/simulate_prod_htcondor_generator.py +8 -1
  45. simtools/applications/submit_array_layouts.py +7 -7
  46. simtools/applications/submit_model_parameter_from_external.py +1 -3
  47. simtools/applications/validate_camera_efficiency.py +0 -1
  48. simtools/applications/validate_camera_fov.py +0 -1
  49. simtools/applications/validate_cumulative_psf.py +0 -2
  50. simtools/applications/validate_file_using_schema.py +49 -123
  51. simtools/applications/validate_optics.py +0 -13
  52. simtools/camera/camera_efficiency.py +1 -6
  53. simtools/camera/single_photon_electron_spectrum.py +2 -1
  54. simtools/configuration/commandline_parser.py +43 -8
  55. simtools/configuration/configurator.py +6 -11
  56. simtools/corsika/corsika_config.py +204 -99
  57. simtools/corsika/corsika_histograms.py +411 -1735
  58. simtools/corsika/primary_particle.py +1 -1
  59. simtools/data_model/metadata_collector.py +5 -2
  60. simtools/data_model/metadata_model.py +0 -4
  61. simtools/data_model/model_data_writer.py +27 -17
  62. simtools/data_model/schema.py +112 -5
  63. simtools/data_model/validate_data.py +80 -48
  64. simtools/db/db_handler.py +19 -8
  65. simtools/db/db_model_upload.py +2 -1
  66. simtools/db/mongo_db.py +133 -42
  67. simtools/dependencies.py +83 -44
  68. simtools/io/ascii_handler.py +4 -2
  69. simtools/io/table_handler.py +1 -1
  70. simtools/job_execution/htcondor_script_generator.py +0 -2
  71. simtools/layout/array_layout.py +4 -12
  72. simtools/layout/array_layout_utils.py +227 -58
  73. simtools/model/array_model.py +37 -18
  74. simtools/model/calibration_model.py +0 -4
  75. simtools/model/legacy_model_parameter.py +134 -0
  76. simtools/model/model_parameter.py +24 -14
  77. simtools/model/model_repository.py +18 -5
  78. simtools/model/model_utils.py +1 -6
  79. simtools/model/site_model.py +0 -4
  80. simtools/model/telescope_model.py +6 -11
  81. simtools/production_configuration/derive_corsika_limits.py +6 -11
  82. simtools/production_configuration/interpolation_handler.py +16 -16
  83. simtools/ray_tracing/incident_angles.py +5 -11
  84. simtools/ray_tracing/mirror_panel_psf.py +3 -7
  85. simtools/ray_tracing/psf_analysis.py +29 -27
  86. simtools/ray_tracing/psf_parameter_optimisation.py +822 -680
  87. simtools/ray_tracing/ray_tracing.py +6 -15
  88. simtools/reporting/docs_auto_report_generator.py +8 -13
  89. simtools/reporting/docs_read_parameters.py +70 -16
  90. simtools/runners/corsika_runner.py +15 -10
  91. simtools/runners/corsika_simtel_runner.py +9 -8
  92. simtools/runners/runner_services.py +17 -7
  93. simtools/runners/simtel_runner.py +11 -58
  94. simtools/runners/simtools_runner.py +2 -4
  95. simtools/schemas/model_parameters/flasher_pulse_exp_decay.schema.yml +2 -0
  96. simtools/schemas/model_parameters/flasher_pulse_shape.schema.yml +50 -0
  97. simtools/schemas/model_parameters/flasher_pulse_width.schema.yml +2 -0
  98. simtools/schemas/simulation_models_info.schema.yml +2 -0
  99. simtools/settings.py +154 -0
  100. simtools/sim_events/file_info.py +128 -0
  101. simtools/{simtel/simtel_io_event_histograms.py → sim_events/histograms.py} +25 -15
  102. simtools/{simtel/simtel_io_event_reader.py → sim_events/reader.py} +20 -17
  103. simtools/{simtel/simtel_io_event_writer.py → sim_events/writer.py} +84 -25
  104. simtools/simtel/pulse_shapes.py +273 -0
  105. simtools/simtel/simtel_config_writer.py +146 -22
  106. simtools/simtel/simtel_table_reader.py +6 -4
  107. simtools/simtel/simulator_array.py +62 -23
  108. simtools/simtel/simulator_camera_efficiency.py +4 -6
  109. simtools/simtel/simulator_light_emission.py +101 -19
  110. simtools/simtel/simulator_ray_tracing.py +4 -10
  111. simtools/simulator.py +360 -353
  112. simtools/telescope_trigger_rates.py +3 -4
  113. simtools/testing/assertions.py +115 -8
  114. simtools/testing/configuration.py +2 -3
  115. simtools/testing/helpers.py +2 -3
  116. simtools/testing/log_inspector.py +5 -1
  117. simtools/testing/sim_telarray_metadata.py +1 -1
  118. simtools/testing/validate_output.py +69 -23
  119. simtools/utils/general.py +37 -0
  120. simtools/utils/geometry.py +0 -77
  121. simtools/utils/names.py +7 -9
  122. simtools/version.py +37 -0
  123. simtools/visualization/legend_handlers.py +21 -10
  124. simtools/visualization/plot_array_layout.py +312 -41
  125. simtools/visualization/plot_corsika_histograms.py +143 -605
  126. simtools/visualization/plot_mirrors.py +834 -0
  127. simtools/visualization/plot_pixels.py +2 -4
  128. simtools/visualization/plot_psf.py +0 -1
  129. simtools/visualization/plot_simtel_event_histograms.py +4 -4
  130. simtools/visualization/plot_simtel_events.py +6 -11
  131. simtools/visualization/plot_tables.py +8 -19
  132. simtools/visualization/visualize.py +22 -2
  133. simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +0 -160
  134. simtools/applications/print_version.py +0 -53
  135. simtools/io/hdf5_handler.py +0 -139
  136. simtools/simtel/simtel_io_file_info.py +0 -62
  137. {gammasimtools-0.24.0.dist-info → gammasimtools-0.26.0.dist-info}/WHEEL +0 -0
  138. {gammasimtools-0.24.0.dist-info → gammasimtools-0.26.0.dist-info}/top_level.txt +0 -0
@@ -62,6 +62,17 @@ highlighted_array_elements : list, optional
62
62
  List of array elements to plot with red circles around them.
63
63
  legend_location : str, optional
64
64
  Location of the legend (default "best").
65
+ bounds : str, optional
66
+ Axis bounds mode. Use "symmetric" for +-R with padding (default) or "exact" for
67
+ per-axis min/max bounds.
68
+ padding : float, optional
69
+ Fractional padding applied around computed extents in both modes (default 0.1).
70
+ x_lim : tuple(float, float), optional
71
+ Explicit x-axis limits [xmin, xmax] in meters. When provided, overrides derived limits
72
+ and filters plotted elements by x.
73
+ y_lim : tuple(float, float), optional
74
+ Explicit y-axis limits [ymin, ymax] in meters. When provided, overrides derived limits
75
+ and filters plotted elements by y.
65
76
 
66
77
  Examples
67
78
  --------
@@ -89,6 +100,20 @@ Plot layout from a file with a list of telescopes:
89
100
  simtools-plot-array-layout
90
101
  --array_layout_file tests/resources/telescope_positions-North-ground.ecsv
91
102
 
103
+ Use exact bounds with default padding:
104
+
105
+ .. code-block:: console
106
+
107
+ simtools-plot-array-layout --array_layout_name alpha \
108
+ --site North --model_version 6.0.0 --bounds exact
109
+
110
+ Use symmetric bounds with custom padding:
111
+
112
+ .. code-block:: console
113
+
114
+ simtools-plot-array-layout --array_layout_name alpha \
115
+ --site North --model_version 6.0.0 --bounds symmetric --padding 0.15
116
+
92
117
  Plot layout from a parameter file with a list of telescopes:
93
118
 
94
119
  .. code-block:: console
@@ -116,14 +141,10 @@ Plot layout with some telescopes grayed out and others highlighted:
116
141
  --legend_location "upper right"
117
142
  """
118
143
 
119
- import matplotlib as mpl
120
- import matplotlib.pyplot as plt
121
-
122
144
  import simtools.layout.array_layout_utils as layout_utils
123
145
  from simtools.application_control import get_application_label, startup_application
124
146
  from simtools.configuration import configurator
125
- from simtools.visualization import visualize
126
- from simtools.visualization.plot_array_layout import plot_array_layout
147
+ from simtools.visualization.plot_array_layout import plot_array_layouts
127
148
 
128
149
 
129
150
  def _parse():
@@ -173,6 +194,24 @@ def _parse():
173
194
  required=False,
174
195
  default=None,
175
196
  )
197
+ config.parser.add_argument(
198
+ "--x_lim",
199
+ help="Explicit x-axis limits [xmin xmax] in meters.",
200
+ type=float,
201
+ nargs=2,
202
+ required=False,
203
+ default=None,
204
+ metavar=("XMIN", "XMAX"),
205
+ )
206
+ config.parser.add_argument(
207
+ "--y_lim",
208
+ help="Explicit y-axis limits [ymin ymax] in meters.",
209
+ type=float,
210
+ nargs=2,
211
+ required=False,
212
+ default=None,
213
+ metavar=("YMIN", "YMAX"),
214
+ )
176
215
  config.parser.add_argument(
177
216
  "--array_layout_name_background",
178
217
  help="Name of the background layout array (e.g., test_layout, alpha, 4mst, etc.).",
@@ -201,12 +240,27 @@ def _parse():
201
240
  help=(
202
241
  "Location of the legend (e.g., 'best', 'upper right', 'upper left', "
203
242
  "'lower left', 'lower right', 'right', 'center left', 'center right', "
204
- "'lower center', 'upper center', 'center')."
243
+ "'lower center', 'upper center', 'center', 'no_legend')."
205
244
  ),
206
245
  type=str,
207
246
  required=False,
208
247
  default="best",
209
248
  )
249
+ config.parser.add_argument(
250
+ "--bounds",
251
+ help=("Axis bounds mode: 'symmetric' uses +-R with padding, 'exact' uses per-axis min/max"),
252
+ type=str,
253
+ choices=["symmetric", "exact"],
254
+ required=False,
255
+ default="symmetric",
256
+ )
257
+ config.parser.add_argument(
258
+ "--padding",
259
+ help=("Fractional padding applied around computed extents (used for both modes)."),
260
+ type=float,
261
+ required=False,
262
+ default=0.1,
263
+ )
210
264
  return config.initialize(
211
265
  db_config=True,
212
266
  simulation_model=[
@@ -220,112 +274,14 @@ def _parse():
220
274
  )
221
275
 
222
276
 
223
- def read_layouts(args_dict, db_config, logger):
224
- """
225
- Read array layouts from the database or parameter file.
226
-
227
- Parameters
228
- ----------
229
- args_dict : dict
230
- Dictionary with command line arguments.
231
- db_config : dict
232
- Database configuration.
233
- logger : logging.app_context.logger
234
- app_context.logger instance.
235
-
236
- Returns
237
- -------
238
- list
239
- List of array layouts.
240
- """
241
- if args_dict["array_layout_name"] is not None or args_dict["plot_all_layouts"]:
242
- logger.info("Plotting array from DB using layout array name(s).")
243
- layouts = layout_utils.get_array_layouts_from_db(
244
- args_dict["array_layout_name"],
245
- args_dict["site"],
246
- args_dict["model_version"],
247
- db_config,
248
- args_dict["coordinate_system"],
249
- )
250
- if isinstance(layouts, list):
251
- return layouts
252
- return [layouts]
253
-
254
- if args_dict["array_layout_parameter_file"] is not None:
255
- logger.info("Plotting array from parameter file(s).")
256
- return layout_utils.get_array_layouts_from_parameter_file(
257
- args_dict["array_layout_parameter_file"],
258
- args_dict["model_version"],
259
- db_config,
260
- args_dict["coordinate_system"],
261
- )
262
-
263
- if args_dict["array_layout_file"] is not None:
264
- logger.info("Plotting array from telescope table file(s).")
265
- return layout_utils.get_array_layouts_from_file(args_dict["array_layout_file"])
266
-
267
- if args_dict["array_element_list"] is not None:
268
- logger.info("Plotting array from list of array elements.")
269
- return layout_utils.get_array_layouts_using_telescope_lists_from_db(
270
- [args_dict["array_element_list"]],
271
- args_dict["site"],
272
- args_dict["model_version"],
273
- db_config,
274
- args_dict["coordinate_system"],
275
- )
276
-
277
- return []
278
-
279
-
280
277
  def main():
281
278
  """Plot array layout application."""
282
279
  app_context = startup_application(_parse)
283
280
 
284
- layouts = read_layouts(app_context.args, app_context.db_config, app_context.logger)
285
-
286
- if app_context.args.get("array_layout_name_background"):
287
- background_layout = layout_utils.get_array_layouts_from_db(
288
- app_context.args["array_layout_name_background"],
289
- app_context.args["site"],
290
- app_context.args["model_version"],
291
- app_context.db_config,
292
- app_context.args["coordinate_system"],
293
- )["array_elements"]
294
- else:
295
- background_layout = None
296
-
297
- mpl.use("Agg")
298
- for layout in layouts:
299
- fig_out = plot_array_layout(
300
- telescopes=layout["array_elements"],
301
- show_tel_label=app_context.args["show_labels"],
302
- axes_range=app_context.args["axes_range"],
303
- marker_scaling=app_context.args["marker_scaling"],
304
- background_telescopes=background_layout,
305
- grayed_out_elements=app_context.args["grayed_out_array_elements"],
306
- highlighted_elements=app_context.args["highlighted_array_elements"],
307
- legend_location=app_context.args["legend_location"],
308
- )
309
- site_string = ""
310
- if layout.get("site") is not None:
311
- site_string = f"_{layout['site']}"
312
- elif app_context.args["site"] is not None:
313
- site_string = f"_{app_context.args['site']}"
314
- coordinate_system_string = (
315
- f"_{app_context.args['coordinate_system']}"
316
- if app_context.args["coordinate_system"] not in layout["name"]
317
- else ""
318
- )
319
- plot_file_name = app_context.args["figure_name"] or (
320
- f"array_layout_{layout['name']}{site_string}{coordinate_system_string}"
321
- )
322
-
323
- visualize.save_figure(
324
- fig_out,
325
- app_context.io_handler.get_output_directory() / plot_file_name,
326
- dpi=400,
327
- )
328
- plt.close()
281
+ layouts, background_layout = layout_utils.read_layouts(app_context.args)
282
+ plot_array_layouts(
283
+ app_context.args, app_context.io_handler.get_output_directory(), layouts, background_layout
284
+ )
329
285
 
330
286
 
331
287
  if __name__ == "__main__":
@@ -0,0 +1,57 @@
1
+ #!/usr/bin/python3
2
+
3
+ r"""
4
+ Plot simulated event distributions for shower and/or triggered event data.
5
+
6
+ Reads reduced event data files and generate histogram plots e.g. for energy or
7
+ core distance distributions.
8
+
9
+ Command line arguments
10
+ ----------------------
11
+ input_file (str, required)
12
+ Input file path.
13
+ output_path (str, required)
14
+ Output directory for the generated plots.
15
+
16
+ Examples
17
+ --------
18
+ Generate plots from a given input file:
19
+
20
+ .. code-block:: console
21
+
22
+ simtools-plot-simulated-event-distributions --input_file path/to/simtel_file.hdf5 \
23
+ --output_path simtools_output/
24
+
25
+
26
+ """
27
+
28
+ from simtools.application_control import get_application_label, startup_application
29
+ from simtools.configuration import configurator
30
+ from simtools.sim_events.histograms import EventDataHistograms
31
+ from simtools.visualization import plot_simtel_event_histograms
32
+
33
+
34
+ def _parse():
35
+ """Parse command line configuration."""
36
+ config = configurator.Configurator(
37
+ label=get_application_label(__file__),
38
+ description="Plot simulated event distributions for shower and/or triggered event data.",
39
+ )
40
+ config.parser.add_argument("--input_file", type=str, required=True, help="Input file path")
41
+ return config.initialize(db_config=False, output=True)
42
+
43
+
44
+ def main():
45
+ """Plot simulated event distributions."""
46
+ app_context = startup_application(_parse)
47
+ app_context.logger.info(f"Loading input file from: {app_context.args['input_file']}")
48
+
49
+ histograms = EventDataHistograms(app_context.args["input_file"])
50
+ histograms.fill()
51
+ plot_simtel_event_histograms.plot(
52
+ histograms.histograms, output_path=app_context.io_handler.get_output_directory()
53
+ )
54
+
55
+
56
+ if __name__ == "__main__":
57
+ main()
@@ -78,7 +78,6 @@ def main():
78
78
  plot_tables.plot(
79
79
  config=plot_config["plot"],
80
80
  output_file=app_context.io_handler.get_output_file(app_context.args["output_file"]),
81
- db_config=app_context.db_config,
82
81
  data_path=app_context.args.get("table_data_path"),
83
82
  )
84
83
 
@@ -81,15 +81,10 @@ def main():
81
81
  telescope=app_context.args.get("telescope"),
82
82
  output_path=app_context.io_handler.get_output_directory(),
83
83
  plot_type=app_context.args["plot_type"],
84
- db_config=app_context.db_config,
85
84
  )
86
85
 
87
86
  for plot_config, output_file in zip(plot_configs, output_files):
88
- plot_tables.plot(
89
- config=plot_config,
90
- output_file=output_file,
91
- db_config=app_context.db_config,
92
- )
87
+ plot_tables.plot(config=plot_config, output_file=output_file)
93
88
  MetadataCollector.dump(app_context.args, output_file=output_file, add_activity_name=True)
94
89
 
95
90
 
@@ -134,7 +134,7 @@ def main():
134
134
  """Derive limits for energy, radial distance, and viewcone."""
135
135
  app_context = startup_application(_parse)
136
136
 
137
- generate_corsika_limits_grid(app_context.args, app_context.db_config)
137
+ generate_corsika_limits_grid(app_context.args)
138
138
 
139
139
 
140
140
  if __name__ == "__main__":
@@ -132,7 +132,6 @@ def main():
132
132
 
133
133
  axes = load_axes(app_context.args["axes"])
134
134
  site_model = SiteModel(
135
- db_config=app_context.db_config,
136
135
  model_version=app_context.args["model_version"],
137
136
  site=app_context.args["site"],
138
137
  )
@@ -101,7 +101,7 @@ def main():
101
101
  """Run several simtools applications using a configuration file."""
102
102
  app_context = startup_application(_parse, setup_io_handler=False)
103
103
 
104
- simtools_runner.run_applications(app_context.args, app_context.db_config, app_context.logger)
104
+ simtools_runner.run_applications(app_context.args, app_context.logger)
105
105
 
106
106
 
107
107
  if __name__ == "__main__":
@@ -29,8 +29,9 @@ Example Usage
29
29
  .. code-block:: console
30
30
 
31
31
  simtools-simulate-flasher --run_mode full_simulation \
32
- --light_source MSFx-FlashCam --model_version 6.0.0 \
33
- --telescope MSTS-04 --site South
32
+ --light_source MSFx-NectarCam --model_version 6.0 \
33
+ --telescope MSTS-04 --site South --run_number 1 \
34
+ --array_layout_name 1mst
34
35
 
35
36
  Command Line Arguments
36
37
  ----------------------
@@ -119,13 +120,11 @@ def main():
119
120
  if app_context.args["run_mode"] == "full_simulation":
120
121
  light_source = SimulatorLightEmission(
121
122
  light_emission_config=app_context.args,
122
- db_config=app_context.db_config,
123
123
  label=app_context.args.get("label"),
124
124
  )
125
125
  elif app_context.args["run_mode"] == "direct_injection":
126
126
  light_source = Simulator(
127
127
  args_dict=app_context.args,
128
- db_config=app_context.db_config,
129
128
  label=app_context.args.get("label"),
130
129
  )
131
130
  else:
@@ -120,7 +120,6 @@ def main():
120
120
 
121
121
  light_source = SimulatorLightEmission(
122
122
  light_emission_config=app_context.args,
123
- db_config=app_context.db_config,
124
123
  label=app_context.args.get("label"),
125
124
  )
126
125
  light_source.simulate()
@@ -69,7 +69,7 @@ def _parse():
69
69
  help="Calibration run mode",
70
70
  type=str,
71
71
  required=True,
72
- choices=["pedestals", "dark_pedestals", "nsb_only_pedestals"],
72
+ choices=["pedestals", "pedestals_dark", "pedestals_nsb_only"],
73
73
  )
74
74
  config.parser.add_argument(
75
75
  "--number_of_events",
@@ -108,11 +108,7 @@ def main():
108
108
  """Simulate pedestal events."""
109
109
  app_context = startup_application(_parse)
110
110
 
111
- simulator = Simulator(
112
- label=app_context.args.get("label"),
113
- args_dict=app_context.args,
114
- db_config=app_context.db_config,
115
- )
111
+ simulator = Simulator(label=app_context.args.get("label"), args_dict=app_context.args)
116
112
  simulator.simulate()
117
113
 
118
114
 
@@ -39,10 +39,6 @@ r"""
39
39
  It allows the transformation system to keep using sequential run numbers without repetition.
40
40
  run (int, required)
41
41
  Run number (actual run number will be 'start_run' + 'run').
42
- data_directory (str, optional)
43
- The location of the output directories corsika-data and simtel-data.
44
- the label is added to the data_directory, such that the output
45
- will be written to data_directory/label/simtel-data.
46
42
  pack_for_grid_register (str, optional)
47
43
  Set whether to prepare a tarball for registering the output files on the grid.
48
44
  The files are written to the specified directory.
@@ -58,13 +54,6 @@ r"""
58
54
  simtools-simulate-prod \\
59
55
  --model_version 5.0.0 --site north --primary gamma --azimuth_angle north \\
60
56
  --zenith_angle 20 --start_run 0 --run 1
61
-
62
- By default the configuration is saved in simtools-output/test-production
63
- together with the actual simulation output in corsika-data and simtel-data within.
64
- The location of the latter directories can be set
65
- to a different location via the option --data_directory,
66
- but the label is always added to the data_directory, such that the output
67
- will be written to data_directory/label/simtel-data.
68
57
  """
69
58
 
70
59
  from simtools.application_control import startup_application
@@ -76,15 +65,12 @@ def _parse():
76
65
  """Parse command line configuration."""
77
66
  config = configurator.Configurator(description="Run simulations for productions")
78
67
  config.parser.add_argument(
79
- "--data_directory",
68
+ "--corsika_file",
80
69
  help=(
81
- "The directory where to save the corsika-data and simtel-data output directories."
82
- "the label is added to the data_directory, such that the output"
83
- "will be written to data_directory/label/simtel-data."
70
+ "Path to the CORSIKA input file (only relevant for simulation software 'sim_telarray')."
84
71
  ),
85
- type=str.lower,
72
+ type=str,
86
73
  required=False,
87
- default="./simtools-output/",
88
74
  )
89
75
  config.parser.add_argument(
90
76
  "--pack_for_grid_register",
@@ -141,28 +127,23 @@ def main():
141
127
  """Run simulations for productions."""
142
128
  app_context = startup_application(_parse, setup_io_handler=False)
143
129
 
144
- simulator = Simulator(
145
- label=app_context.args.get("label"),
146
- args_dict=app_context.args,
147
- db_config=app_context.db_config,
148
- )
130
+ simulator = Simulator(label=app_context.args.get("label"), args_dict=app_context.args)
149
131
 
150
132
  simulator.simulate()
151
133
  simulator.validate_metadata()
152
134
 
153
- app_context.logger.info(
154
- f"Production run complete for primary {app_context.args['primary']} showers "
155
- f"from {app_context.args['azimuth_angle']} azimuth and "
156
- f"{app_context.args['zenith_angle']} zenith "
157
- f"at {app_context.args['site']} site, using {app_context.args['model_version']} model."
158
- )
159
135
  if app_context.args["save_reduced_event_lists"]:
160
136
  simulator.save_reduced_event_lists()
137
+
138
+ simulator.verify_simulations()
139
+
161
140
  if app_context.args.get("pack_for_grid_register"):
162
141
  simulator.pack_for_register(app_context.args["pack_for_grid_register"])
163
142
  if app_context.args["save_file_lists"]:
164
143
  simulator.save_file_lists()
165
144
 
145
+ simulator.report()
146
+
166
147
 
167
148
  if __name__ == "__main__":
168
149
  main()
@@ -22,7 +22,7 @@ Requirements for the 'simtools-simulate-prod-htcondor-generator' application:
22
22
  - Environment parameters required to run CORSIKA and sim_telarray, as well as DB access
23
23
  credentials. These should be listed similarly to a '.env' file and copied to
24
24
  'output_path/env.txt'. Ensure that the path to the simulation software is correctly set to
25
- 'SIMTOOLS_SIMTEL_PATH=/workdir/sim_telarray'.
25
+ 'SIMTOOLS_SIM_TELARRAY_PATH=/workdir/sim_telarray'.
26
26
 
27
27
  To submit jobs, change to the output directory and run:
28
28
 
@@ -56,6 +56,13 @@ def _parse():
56
56
  label=get_application_label(__file__),
57
57
  description="Prepare simulations production for HT Condor job submission",
58
58
  )
59
+ config.parser.add_argument(
60
+ "--number_of_runs",
61
+ help="Number of runs to be simulated.",
62
+ type=int,
63
+ required=True,
64
+ default=1,
65
+ )
59
66
  config.parser.add_argument(
60
67
  "--apptainer_image",
61
68
  help="Apptainer image to use for the simulation (full path).",
@@ -1,9 +1,11 @@
1
1
  #!/usr/bin/python3
2
2
 
3
3
  r"""
4
- Submit array-layouts definition and corresponding metadata and validate list of telescopes.
4
+ Read array layouts from file, validate with telescopes in DB, and prepare for submission.
5
5
 
6
- Includes validation that all defined telescope exists.
6
+ Validates that all telescope defined in the array layouts exist in the database for the
7
+ specified model version. Prepares both JSON-style model parameters and corresponding
8
+ metadata for submission.
7
9
 
8
10
  Command line arguments
9
11
  ----------------------
@@ -19,7 +21,7 @@ r"""
19
21
  Example
20
22
  -------
21
23
 
22
- Submit a new array layout dictionary:
24
+ Submit and validate a new array layout dictionary:
23
25
 
24
26
  .. code-block:: console
25
27
 
@@ -73,7 +75,7 @@ def main():
73
75
  """Submit and validate array layouts."""
74
76
  app_context = startup_application(_parse)
75
77
 
76
- db = db_handler.DatabaseHandler(db_config=app_context.db_config)
78
+ db = db_handler.DatabaseHandler()
77
79
 
78
80
  array_layouts = validate_array_layouts_with_db(
79
81
  production_table=db.read_production_table_from_db(
@@ -82,9 +84,7 @@ def main():
82
84
  array_layouts=ascii_handler.collect_data_from_file(app_context.args["array_layouts"]),
83
85
  )
84
86
 
85
- write_array_layouts(
86
- array_layouts=array_layouts, args_dict=app_context.args, db_config=app_context.db_config
87
- )
87
+ write_array_layouts(array_layouts=array_layouts, args_dict=app_context.args)
88
88
 
89
89
 
90
90
  if __name__ == "__main__":
@@ -106,9 +106,7 @@ def main():
106
106
  ),
107
107
  output_path=output_path,
108
108
  metadata_input_dict=app_context.args,
109
- db_config=app_context.db_config
110
- if app_context.args.get("check_parameter_version")
111
- else None,
109
+ check_db_for_existing_parameter=app_context.args.get("check_parameter_version", False),
112
110
  )
113
111
 
114
112
 
@@ -107,7 +107,6 @@ def main():
107
107
  app_context = startup_application(_parse)
108
108
 
109
109
  ce = CameraEfficiency(
110
- db_config=app_context.db_config,
111
110
  label=app_context.args.get("label"),
112
111
  config_data=app_context.args,
113
112
  )
@@ -92,7 +92,6 @@ def main():
92
92
  tel_model = TelescopeModel(
93
93
  site=app_context.args["site"],
94
94
  telescope_name=app_context.args["telescope"],
95
- db_config=app_context.db_config,
96
95
  model_version=app_context.args["model_version"],
97
96
  label=label,
98
97
  )
@@ -130,7 +130,6 @@ def main():
130
130
 
131
131
  tel_model, site_model, _ = initialize_simulation_models(
132
132
  label=app_context.args.get("label"),
133
- db_config=app_context.db_config,
134
133
  site=app_context.args["site"],
135
134
  telescope_name=app_context.args["telescope"],
136
135
  model_version=app_context.args["model_version"],
@@ -142,7 +141,6 @@ def main():
142
141
  ray = RayTracing(
143
142
  telescope_model=tel_model,
144
143
  site_model=site_model,
145
- simtel_path=app_context.args["simtel_path"],
146
144
  zenith_angle=app_context.args["zenith"] * u.deg,
147
145
  source_distance=app_context.args["src_distance"] * u.km,
148
146
  off_axis_angle=[0.0] * u.deg,