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
@@ -1,174 +1,61 @@
1
1
  #!/usr/bin/python3
2
2
 
3
3
  r"""
4
- Generates a set of histograms Cherenkov photon distributions from CORSIKA output.
4
+ Generates a set of histograms with Cherenkov photon distributions from CORSIKA output.
5
5
 
6
6
  The Cherenkov photons (from observation level) are read from a CORSIKA IACT
7
- output file provided as input.
8
-
9
- The histograms can be saved both into pdfs and in a hdf5 file.
7
+ output file(s) provided as input.
10
8
 
11
9
  The following 2D histograms are generated:
12
- - Number of Cherenkov photons on the ground;
13
- - Density of Cherenkov photons on the ground;
14
- - Incoming direction (directive cosines) of the Cherenkov photons;
15
- - Time of arrival (ns) vs altitude of production (km);
16
- - Number of Cherenkov photons per event per telescope.
10
+
11
+ - Density of Cherenkov photons on the ground
12
+ - Incoming direction (directive cosines) of the Cherenkov photons
13
+ - Time of arrival (ns) vs altitude of production (km)
17
14
 
18
15
  The following 1D histograms are generated:
19
- - Wavelength;
20
- - Counts;
21
- - Density;
22
- - Time of arrival;
23
- - Altitude of production;
24
- - Number of photons per telescope;
25
- - Number of photons per event.
26
16
 
27
- Histograms for the distribution of CORSIKA event header elements can also be generated by using
28
- the --event_1d_histograms and --event_2d_histograms arguments. The accepted arguments (keys)
29
- are to be found in the CORSIKA manual, e.g., "total_energy", "zenith", "azimuth".
17
+ - Wavelength distribution of Cherenkov photons
18
+ - Time of arrival (ns) distribution of Cherenkov photons
19
+ - Altitude of production (km) distribution of Cherenkov photons
20
+ - Lateral distribution of Cherenkov photons (distance from shower core in m)
30
21
 
31
22
  Command line arguments
32
23
  ----------------------
33
- iact_file (str, required)
34
- The name of the CORSIKA IACT file resulted from the CORSIKA simulation.
35
-
36
- telescope_indices (list, optional)
37
- The list with the telescope indices to be considered in the generation of the histograms.
38
- Telescopes that are not in the list will not contribute with photons to the histograms.
39
- If the argument is not given, all telescopes are considered.
40
-
41
- individual_telescopes (bool, optional)
42
- Indicates whether single histograms are generated for the individual telescopes, or if
43
- a master histogram is generated for all the telescopes together.
44
- If the argument is not given, the Cherenkov photons from the given telescopes are considered
45
- together in the same histograms.
46
-
47
- hist_config (hdf5 or dict, optional)
48
- The configuration used for generating the histograms.
49
- It includes information about the bin sizes, the ranges, scale of the plot and units.
50
- By construction, three major histograms are created to start with:
51
- - hist_direction (2D): Directive cosines (x and y) for the incoming photons;
52
- - hist_position (3D): position x, position y, and wavelength;
53
- - hist_time_altitude (2D): time of arrival and altitude of emission;
54
-
55
- If the argument is not given, the default configuration is generated:
56
-
57
- .. code-block:: console
58
-
59
- hist_direction:
60
- x axis: {bins: 100, scale: linear, start: -1, stop: 1}
61
- y axis: {bins: 100, scale: linear, start: -1, stop: 1}
62
-
63
- hist_position:
64
- x axis:
65
- bins: 100
66
- scale: linear
67
- start: !astropy.units.Quantity
68
- unit: &id001 m
69
- value: -1000.0
70
- stop: &id002 !astropy.units.Quantity
71
- unit: *id001
72
- value: 1000.0
73
- y axis:
74
- bins: 100
75
- scale: linear
76
- start: !astropy.units.Quantity
77
- unit: *id001
78
- value: -1000.0
79
- stop: *id002
80
- z axis:
81
- bins: 80
82
- scale: linear
83
- start: !astropy.units.Quantity
84
- unit: nm
85
- value: 200.0
86
- stop: !astropy.units.Quantity
87
- unit: *id003
88
- value: 1000.0
89
- hist_time_altitude:
90
- x axis:
91
- bins: 100
92
- scale: linear
93
- start: !astropy.units.Quantity
94
- unit: ns
95
- value: -2000.0
96
- stop: !astropy.units.Quantity
97
- unit: *id004
98
- value: 2000.0
99
- y axis:
100
- bins: 100
101
- scale: linear
102
- start: !astropy.units.Quantity
103
- unit: km
104
- value: 120.0
105
- stop: !astropy.units.Quantity
106
- unit: *id005
107
- value: 0.0
108
-
109
-
110
- pdf (bool, optional)
111
- If set, histograms are saved into pdf files.
112
- One pdf file contains all the histograms for the Cherenkov photons.
113
- The name of the file is controlled via hdf5_file_name.
114
- If event_1d_histograms and event_2d_histograms are used, two separate pdf files might be
115
- created to accommodate the histograms for the CORSIKA event header elements. The core names
116
- of these output pdf files are also given by hdf5_file_name argument with the addition of
117
- 'event_1d_histograms' and 'event_2d_histograms'.
118
-
24
+ input_files (str, required)
25
+ The name(s) of the CORSIKA IACT file(s) resulted from the CORSIKA simulation.
119
26
 
120
- hdf5 (bool, optional)
121
- If set, histograms are saved into hdf5 files.
27
+ pdf_file_name (str, optional)
28
+ The name of the output pdf file to save the histograms. If not provided,
29
+ the histograms are only shown on screen.
122
30
 
123
- hdf5_file_name (str, optional)
124
- The name of the output hdf5 data (without the path).
125
- It requires the --hdf5 flag.
126
- If not given, hdf5_file_name takes the name from the input IACT file (input_file).
127
- If the output hdf5_file_name file already exists, the tables associated to the chosen
128
- flags (e.g. hdf5, event_1d_histograms, event_2d_histograms) will be overwritten. The
129
- remaining tables, if any, will stay untouched.
130
-
131
-
132
- event_1d_histograms (str, optional)
133
- Generate 1D histograms for elements given in --event_1d_histograms from the CORSIKA event
134
- header and save into hdf5/pdf files.
135
- It allows more than one argument, separated by simple spaces.
136
- Usage: --event_1d_histograms first_interaction_height total_energy.
137
-
138
- event_2d_histograms (str, optional)
139
- Generate 2D histograms for elements given in --event_2d_histograms from the CORSIKA event
140
- header and save into hdf5/pdf files.
141
- It allows more than one argument, separated by simple spaces.
142
- The elements are grouped into pairs and the 2D histograms are generated always for two
143
- subsequent elements.
144
- For example, --event_2d_histograms first_interaction_height total_energy zenith azimuth
145
- will generate one 2D histogram for first_interaction_height total_energy and another 2D
146
- histogram for zenith and azimuth.
31
+ file_labels (str, optional)
32
+ Labels for the input files (in the same order as input_files). If not provided,
33
+ the file names are used as labels.
147
34
 
148
35
  Example
149
36
  -------
150
- Generate the histograms for a test IACT file:
37
+ Fill and plot histograms for a test IACT file:
151
38
 
152
39
  .. code-block:: console
153
40
 
154
- simtools-generate-corsika-histograms --iact_file /workdir/external/simtools/\\
41
+ simtools-generate-corsika-histograms --input_files /workdir/external/simtools/\\
155
42
  tests/resources/tel_output_10GeV-2-gamma-20deg-CTAO-South.corsikaio \\
156
- --pdf --hdf5 \\
157
- --event_2d_histograms zenith azimuth --event_1d_histograms total_energy
43
+ --pdf_file_name test.pdf
158
44
 
159
- Expected final print-out message:
45
+ Fill and plot histograms for several files:
160
46
 
161
- .. code-block:: console
47
+ .. code-block:: console
162
48
 
163
- INFO::generate_corsika_histograms(l358)::main::Finalizing the application.
164
- Total time needed: 8s.
165
- """
49
+ simtools-generate-corsika-histograms --input_files file1 file 2 \\
50
+ --file_lablels label1 label2 \\
51
+ --pdf_file_name test.pdf
166
52
 
167
- import time
53
+ """
168
54
 
169
55
  from simtools.application_control import get_application_label, startup_application
170
56
  from simtools.configuration import configurator
171
57
  from simtools.corsika.corsika_histograms import CorsikaHistograms
58
+ from simtools.visualization import plot_corsika_histograms
172
59
 
173
60
 
174
61
  def _parse():
@@ -177,117 +64,43 @@ def _parse():
177
64
  label=get_application_label(__file__),
178
65
  description="Generate histograms for the Cherenkov photons saved in the CORSIKA IACT file.",
179
66
  )
180
-
181
67
  config.parser.add_argument(
182
- "--iact_file",
183
- help="Name of the CORSIKA IACT file from which to generate the histograms.",
68
+ "--input_files",
69
+ help="Name(s) of the CORSIKA IACT file(s) to process",
184
70
  type=str,
71
+ nargs="+",
185
72
  required=True,
186
73
  )
187
-
188
74
  config.parser.add_argument(
189
- "--telescope_indices",
190
- help="List of telescope indices to be considered in the generation of the histograms",
75
+ "--file_labels",
76
+ help="Labels for the input files (in the same order as input_files)",
191
77
  type=str,
192
- required=False,
193
78
  nargs="+",
194
- default=None,
79
+ required=None,
195
80
  )
196
-
197
81
  config.parser.add_argument(
198
- "--individual_telescopes",
199
- help="if False, the histograms are filled for all given telescopes together, otherwise"
200
- "one histogram is set for each telescope separately.",
201
- action="store_true",
202
- required=False,
203
- default=False,
204
- )
205
-
206
- config.parser.add_argument(
207
- "--hist_config",
208
- help="hdf5 file with the configuration parameters to create the histograms.",
82
+ "--pdf_file_name",
83
+ help="Save histograms into a pdf file.",
209
84
  type=str,
210
- required=False,
211
- default=None,
212
- )
213
-
214
- config.parser.add_argument(
215
- "--pdf", help="Save histograms into a pdf file.", action="store_true", required=False
216
- )
217
-
218
- config.parser.add_argument(
219
- "--hdf5", help="Save histograms into hdf5 files.", action="store_true", required=False
85
+ required=None,
220
86
  )
221
-
222
- config.parser.add_argument(
223
- "--hdf5_file_name",
224
- help="Name of the hdf5 file where to save the histograms.",
225
- type=str,
226
- required=False,
227
- default=None,
228
- )
229
-
230
- config.parser.add_argument(
231
- "--event_1d_histograms",
232
- help="The keys from the CORSIKA event header to be used for the generation of 1D "
233
- "histograms. The available choices can been found in the all_event_keys attribute of"
234
- "the CorsikaHistograms.",
235
- required=False,
236
- default=None,
237
- nargs="*",
238
- )
239
-
240
- config.parser.add_argument(
241
- "--event_2d_histograms",
242
- help="The keys from the CORSIKA event header to be used for the generation of 2D "
243
- "histograms. The available choices can been found in the all_event_keys attribute of"
244
- "the CorsikaHistograms.",
245
- required=False,
246
- default=None,
247
- nargs="*",
248
- )
249
-
250
- config_parser, _ = config.initialize(db_config=False, paths=True)
251
-
252
- if (
253
- not config_parser["pdf"]
254
- and not config_parser["hdf5"]
255
- and not config_parser["event_1d_histograms"]
256
- and not config_parser["event_2d_histograms"]
257
- ):
258
- config.parser.error(
259
- "At least one argument is required: --pdf, --hdf5, --event_1d_histograms, or "
260
- "--event_2d_histograms."
261
- )
262
-
263
- return config_parser, _
87
+ return config.initialize(db_config=False, paths=True)
264
88
 
265
89
 
266
90
  def main():
267
- """Generate a set of histograms for the Cherenkov photons saved in the CORSIKA IACT file."""
91
+ """Generate a set of histograms for the Cherenkov photons from CORSIKA IACT file(s)."""
268
92
  app_context = startup_application(_parse)
269
93
 
270
- initial_time = time.time()
271
-
272
- corsika_histograms_instance = CorsikaHistograms(
273
- app_context.args["iact_file"],
274
- output_path=app_context.io_handler.get_output_directory(),
275
- hdf5_file_name=app_context.args["hdf5_file_name"],
276
- )
277
- corsika_histograms_instance.run_export_pipeline(
278
- individual_telescopes=app_context.args["individual_telescopes"],
279
- hist_config=app_context.args["hist_config"],
280
- indices_arg=app_context.args["telescope_indices"],
281
- write_pdf=app_context.args["pdf"],
282
- write_hdf5=app_context.args["hdf5"],
283
- event1d=app_context.args["event_1d_histograms"],
284
- event2d=app_context.args["event_2d_histograms"],
285
- test=app_context.args["test"],
286
- )
94
+ all_histograms = []
95
+ for input_file in app_context.args["input_files"]:
96
+ corsika_histograms = CorsikaHistograms(input_file)
97
+ corsika_histograms.fill()
98
+ all_histograms.append(corsika_histograms)
287
99
 
288
- final_time = time.time()
289
- app_context.logger.info(
290
- f"Finalizing the application. Total time needed: {round(final_time - initial_time)}s."
100
+ plot_corsika_histograms.export_all_photon_figures_pdf(
101
+ all_histograms,
102
+ app_context.io_handler.get_output_file(app_context.args.get("pdf_file_name")),
103
+ app_context.args.get("file_labels"),
291
104
  )
292
105
 
293
106
 
@@ -27,12 +27,11 @@ Runtime < 10 s.
27
27
  from pathlib import Path
28
28
 
29
29
  import astropy.units as u
30
- from astropy.table import QTable
31
30
 
32
31
  import simtools.data_model.model_data_writer as writer
33
32
  from simtools.application_control import get_application_label, startup_application
34
33
  from simtools.configuration import configurator
35
- from simtools.utils import names
34
+ from simtools.layout.array_layout_utils import create_regular_array
36
35
 
37
36
  # Telescope distances for 4 tel square arrays
38
37
  # !HARDCODED
@@ -67,38 +66,9 @@ def main():
67
66
  for array_name in array_list:
68
67
  app_context.logger.info(f"Processing array {array_name}")
69
68
 
70
- tel_name, pos_x, pos_y, pos_z = [], [], [], []
71
- tel_size = array_name[1:4]
72
-
73
- # Single telescope at the center
74
- if array_name[0] == "1":
75
- tel_name.append(
76
- names.generate_array_element_name_from_type_site_id(
77
- tel_size, app_context.args["site"], "01"
78
- )
79
- )
80
- pos_x.append(0 * u.m)
81
- pos_y.append(0 * u.m)
82
- pos_z.append(0 * u.m)
83
- # 4 telescopes in a regular square grid
84
- else:
85
- for i in range(1, 5):
86
- tel_name.append(
87
- names.generate_array_element_name_from_type_site_id(
88
- tel_size, app_context.args["site"], f"0{i}"
89
- )
90
- )
91
- pos_x.append(telescope_distance[tel_size] * (-1) ** (i // 2))
92
- pos_y.append(telescope_distance[tel_size] * (-1) ** (i % 2))
93
- pos_z.append(0 * u.m)
94
-
95
- table = QTable(meta={"array_name": array_name, "site": app_context.args["site"]})
96
- table["telescope_name"] = tel_name
97
- table["position_x"] = pos_x
98
- table["position_y"] = pos_y
99
- table["position_z"] = pos_z
100
- table.sort("telescope_name")
101
- table.pprint()
69
+ array_table = create_regular_array(
70
+ array_name, app_context.args["site"], telescope_distance=telescope_distance
71
+ )
102
72
 
103
73
  output_file = app_context.args.get("output_file")
104
74
  if output_file:
@@ -110,7 +80,7 @@ def main():
110
80
  args_dict=app_context.args,
111
81
  output_file=output_file,
112
82
  metadata=None,
113
- product_data=table,
83
+ product_data=array_table,
114
84
  )
115
85
 
116
86
 
@@ -130,7 +130,7 @@ from simtools.application_control import get_application_label, startup_applicat
130
130
  from simtools.configuration import configurator
131
131
  from simtools.data_model.metadata_collector import MetadataCollector
132
132
  from simtools.io import io_handler, table_handler
133
- from simtools.simtel.simtel_io_event_writer import SimtelIOEventDataWriter
133
+ from simtools.sim_events.writer import EventDataWriter
134
134
 
135
135
 
136
136
  def _parse():
@@ -173,7 +173,7 @@ def main():
173
173
  return
174
174
 
175
175
  output_filepath = io_handler.IOHandler().get_output_file(app_context.args["output_file"])
176
- generator = SimtelIOEventDataWriter(files, app_context.args["max_files"])
176
+ generator = EventDataWriter(files, app_context.args["max_files"])
177
177
  tables = generator.process_files()
178
178
  table_handler.write_tables(tables, output_filepath, overwrite_existing=True)
179
179
  MetadataCollector.dump(
@@ -28,8 +28,8 @@ The following example applies a patch update with changes defined in a YAML file
28
28
 
29
29
  .. code-block:: console
30
30
 
31
- simtools-maintain-simulation-model-add-new-production \\
32
- --model_path ../simulation-models-dev/simulation-models/ \\
31
+ simtools-maintain-simulation-model-add-production \\
32
+ --model_path ../simulation-models-dev \\
33
33
  --model_version 6.0.2
34
34
 
35
35
  """
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/python3
2
+ """
3
+ Read array element positions from file and write model parameter files for each element.
4
+
5
+ This is an application for experts and should not be used by the general user.
6
+ Reading of input is fine-tuned to the array element files as provided by CTAO.
7
+
8
+ Writes one model parameter file per array element into a directory structure compatible
9
+ with the simtools model parameter repository.
10
+
11
+ Command line arguments
12
+
13
+ input : str
14
+ File containing a table of array element positions.
15
+ repository_path : str
16
+ Path of local copy of model parameter repository.
17
+ parameter_version : str
18
+ Parameter version.
19
+ coordinate_system : str
20
+ Coordinate system of array element positions (ground or utm).
21
+
22
+ Examples
23
+ --------
24
+ Add array element positions to repository (ground coordinates):
25
+
26
+ .. code-block:: console
27
+
28
+ simtools-maintain-simulation-model-write-array-element-positions \
29
+ --input tests/resources/telescope_positions-North-ground.ecsv \
30
+ --output_path /path/to/repository \
31
+ --parameter_version 0.1.0 \
32
+ --coordinate_system ground
33
+
34
+ Add array element positions to repository (utm coordinates):
35
+
36
+ .. code-block:: console
37
+
38
+ simtools-maintain-simulation-model-write-array-element-positions \
39
+ --input tests/resources/telescope_positions-North-utm.ecsv \
40
+ --output_path /path/to/repository \
41
+ --parameter_version 0.1.0 \
42
+ --coordinate_system utm
43
+
44
+ """
45
+
46
+ from simtools.application_control import get_application_label, startup_application
47
+ from simtools.configuration import configurator
48
+ from simtools.layout.array_layout_utils import write_array_elements_from_file_to_repository
49
+
50
+
51
+ def _parse():
52
+ """Parse command line configuration."""
53
+ config = configurator.Configurator(
54
+ label=get_application_label(__file__),
55
+ description="Add array element positions to model parameter repository",
56
+ )
57
+ config.parser.add_argument(
58
+ "--input",
59
+ help="File containing a table of array element positions.",
60
+ required=False,
61
+ )
62
+ config.parser.add_argument(
63
+ "--coordinate_system",
64
+ help="Coordinate system of array element positions (utm or ground).",
65
+ default="ground",
66
+ required=False,
67
+ type=str,
68
+ choices=["ground", "utm"],
69
+ )
70
+
71
+ return config.initialize(db_config=True, output=True, simulation_model=["parameter_version"])
72
+
73
+
74
+ def main():
75
+ """Application main."""
76
+ app_context = startup_application(_parse)
77
+
78
+ write_array_elements_from_file_to_repository(
79
+ coordinate_system=app_context.args["coordinate_system"],
80
+ input_file=app_context.args["input"],
81
+ repository_path=app_context.args["output_path"],
82
+ parameter_version=app_context.args["parameter_version"],
83
+ )
84
+
85
+
86
+ if __name__ == "__main__":
87
+ main()