gammasimtools 0.25.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.
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.26.0.dist-info}/METADATA +2 -1
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.26.0.dist-info}/RECORD +122 -121
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.26.0.dist-info}/entry_points.txt +2 -1
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.26.0.dist-info}/licenses/LICENSE +1 -1
- simtools/_version.py +2 -2
- simtools/application_control.py +35 -7
- simtools/applications/calculate_incident_angles.py +0 -2
- simtools/applications/convert_geo_coordinates_of_array_elements.py +1 -2
- simtools/applications/db_add_file_to_db.py +1 -1
- simtools/applications/db_add_simulation_model_from_repository_to_db.py +1 -1
- simtools/applications/db_add_value_from_json_to_db.py +1 -1
- simtools/applications/db_generate_compound_indexes.py +1 -1
- simtools/applications/db_get_array_layouts_from_db.py +2 -6
- simtools/applications/db_get_file_from_db.py +1 -1
- simtools/applications/db_get_parameter_from_db.py +1 -1
- simtools/applications/db_inspect_databases.py +1 -1
- simtools/applications/db_upload_model_repository.py +1 -1
- simtools/applications/derive_ctao_array_layouts.py +1 -2
- simtools/applications/derive_mirror_rnda.py +1 -3
- simtools/applications/derive_psf_parameters.py +0 -1
- simtools/applications/derive_pulse_shape_parameters.py +0 -1
- simtools/applications/derive_trigger_rates.py +1 -1
- simtools/applications/docs_produce_array_element_report.py +2 -8
- simtools/applications/docs_produce_calibration_reports.py +1 -3
- simtools/applications/docs_produce_model_parameter_reports.py +0 -2
- simtools/applications/docs_produce_simulation_configuration_report.py +1 -3
- simtools/applications/generate_array_config.py +0 -1
- simtools/applications/generate_corsika_histograms.py +48 -235
- simtools/applications/generate_regular_arrays.py +5 -35
- simtools/applications/generate_simtel_event_data.py +2 -2
- simtools/applications/maintain_simulation_model_add_production.py +2 -2
- simtools/applications/maintain_simulation_model_write_array_element_positions.py +87 -0
- simtools/applications/plot_array_layout.py +5 -111
- simtools/applications/plot_simulated_event_distributions.py +57 -0
- simtools/applications/plot_tabular_data.py +0 -1
- simtools/applications/plot_tabular_data_for_model_parameter.py +1 -6
- simtools/applications/production_derive_corsika_limits.py +1 -1
- simtools/applications/production_generate_grid.py +0 -1
- simtools/applications/run_application.py +1 -1
- simtools/applications/simulate_flasher.py +0 -2
- simtools/applications/simulate_illuminator.py +0 -1
- simtools/applications/simulate_pedestals.py +1 -5
- simtools/applications/simulate_prod.py +1 -5
- simtools/applications/simulate_prod_htcondor_generator.py +1 -1
- simtools/applications/submit_array_layouts.py +2 -4
- simtools/applications/submit_model_parameter_from_external.py +1 -3
- simtools/applications/validate_camera_efficiency.py +0 -1
- simtools/applications/validate_camera_fov.py +0 -1
- simtools/applications/validate_cumulative_psf.py +0 -2
- simtools/applications/validate_optics.py +0 -13
- simtools/camera/camera_efficiency.py +1 -6
- simtools/camera/single_photon_electron_spectrum.py +2 -1
- simtools/configuration/commandline_parser.py +35 -2
- simtools/configuration/configurator.py +6 -11
- simtools/corsika/corsika_config.py +16 -21
- simtools/corsika/corsika_histograms.py +411 -1735
- simtools/corsika/primary_particle.py +1 -1
- simtools/data_model/metadata_collector.py +5 -2
- simtools/data_model/metadata_model.py +0 -4
- simtools/data_model/model_data_writer.py +13 -15
- simtools/data_model/validate_data.py +1 -3
- simtools/db/db_handler.py +19 -8
- simtools/dependencies.py +81 -38
- simtools/io/ascii_handler.py +4 -2
- simtools/io/table_handler.py +1 -1
- simtools/layout/array_layout.py +4 -12
- simtools/layout/array_layout_utils.py +226 -57
- simtools/model/array_model.py +1 -13
- simtools/model/calibration_model.py +0 -4
- simtools/model/legacy_model_parameter.py +134 -0
- simtools/model/model_parameter.py +24 -13
- simtools/model/model_utils.py +1 -6
- simtools/model/site_model.py +0 -4
- simtools/model/telescope_model.py +6 -11
- simtools/production_configuration/derive_corsika_limits.py +6 -11
- simtools/production_configuration/interpolation_handler.py +16 -16
- simtools/ray_tracing/incident_angles.py +5 -11
- simtools/ray_tracing/mirror_panel_psf.py +3 -7
- simtools/ray_tracing/psf_analysis.py +18 -19
- simtools/ray_tracing/psf_parameter_optimisation.py +0 -1
- simtools/ray_tracing/ray_tracing.py +6 -15
- simtools/reporting/docs_auto_report_generator.py +8 -13
- simtools/reporting/docs_read_parameters.py +2 -8
- simtools/runners/corsika_runner.py +5 -9
- simtools/runners/corsika_simtel_runner.py +3 -8
- simtools/runners/simtel_runner.py +0 -5
- simtools/runners/simtools_runner.py +2 -4
- simtools/settings.py +154 -0
- simtools/{io/eventio_handler.py → sim_events/file_info.py} +3 -3
- simtools/{simtel/simtel_io_event_histograms.py → sim_events/histograms.py} +25 -15
- simtools/{simtel/simtel_io_event_reader.py → sim_events/reader.py} +20 -17
- simtools/{simtel/simtel_io_event_writer.py → sim_events/writer.py} +84 -25
- simtools/simtel/pulse_shapes.py +7 -2
- simtools/simtel/simtel_config_writer.py +79 -36
- simtools/simtel/simtel_table_reader.py +6 -4
- simtools/simtel/simulator_array.py +4 -11
- simtools/simtel/simulator_camera_efficiency.py +4 -6
- simtools/simtel/simulator_light_emission.py +69 -24
- simtools/simtel/simulator_ray_tracing.py +4 -10
- simtools/simulator.py +7 -14
- simtools/telescope_trigger_rates.py +3 -4
- simtools/testing/assertions.py +84 -33
- simtools/testing/configuration.py +1 -2
- simtools/testing/helpers.py +2 -3
- simtools/testing/log_inspector.py +1 -0
- simtools/testing/sim_telarray_metadata.py +1 -1
- simtools/testing/validate_output.py +34 -23
- simtools/utils/general.py +37 -0
- simtools/utils/geometry.py +0 -77
- simtools/utils/names.py +5 -5
- simtools/visualization/legend_handlers.py +7 -6
- simtools/visualization/plot_array_layout.py +91 -16
- simtools/visualization/plot_corsika_histograms.py +143 -605
- simtools/visualization/plot_mirrors.py +1 -4
- simtools/visualization/plot_pixels.py +2 -4
- simtools/visualization/plot_psf.py +0 -1
- simtools/visualization/plot_simtel_event_histograms.py +4 -4
- simtools/visualization/plot_simtel_events.py +6 -11
- simtools/visualization/plot_tables.py +8 -19
- simtools/visualization/visualize.py +22 -2
- simtools/applications/db_development_tools/write_array_elements_positions_to_repository.py +0 -160
- simtools/applications/print_version.py +0 -53
- simtools/io/hdf5_handler.py +0 -139
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.26.0.dist-info}/WHEEL +0 -0
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.26.0.dist-info}/top_level.txt +0 -0
|
@@ -92,7 +92,7 @@ def main():
|
|
|
92
92
|
branch_name=app_context.args["repository_branch"],
|
|
93
93
|
)
|
|
94
94
|
|
|
95
|
-
db = db_handler.DatabaseHandler(
|
|
95
|
+
db = db_handler.DatabaseHandler()
|
|
96
96
|
db_array_layouts = db.get_model_parameter(
|
|
97
97
|
parameter="array_layouts",
|
|
98
98
|
site=app_context.args["site"],
|
|
@@ -107,7 +107,6 @@ def main():
|
|
|
107
107
|
write_array_layouts(
|
|
108
108
|
array_layouts=merge_array_layouts(db_array_layouts["array_layouts"], ctao_array_layouts),
|
|
109
109
|
args_dict=app_context.args,
|
|
110
|
-
db_config=app_context.db_config,
|
|
111
110
|
)
|
|
112
111
|
|
|
113
112
|
|
|
@@ -218,9 +218,7 @@ def main():
|
|
|
218
218
|
"""Derive mirror random reflection angle of a single mirror panel."""
|
|
219
219
|
app_context = startup_application(_parse)
|
|
220
220
|
|
|
221
|
-
panel_psf = MirrorPanelPSF(
|
|
222
|
-
app_context.args.get("label"), app_context.args, app_context.db_config
|
|
223
|
-
)
|
|
221
|
+
panel_psf = MirrorPanelPSF(app_context.args.get("label"), app_context.args)
|
|
224
222
|
panel_psf.derive_random_reflection_angle(save_figures=True)
|
|
225
223
|
panel_psf.print_results()
|
|
226
224
|
panel_psf.write_optimization_data()
|
|
@@ -204,7 +204,6 @@ def main():
|
|
|
204
204
|
|
|
205
205
|
tel_model, site_model, _ = initialize_simulation_models(
|
|
206
206
|
label=app_context.args.get("label"),
|
|
207
|
-
db_config=app_context.db_config,
|
|
208
207
|
site=app_context.args["site"],
|
|
209
208
|
telescope_name=app_context.args["telescope"],
|
|
210
209
|
model_version=app_context.args["model_version"],
|
|
@@ -135,7 +135,6 @@ def main():
|
|
|
135
135
|
label = app_context.args.get("label") or get_application_label(__file__)
|
|
136
136
|
telescope_model, _, _ = initialize_simulation_models(
|
|
137
137
|
label=label,
|
|
138
|
-
db_config=app_context.db_config,
|
|
139
138
|
model_version=app_context.args["model_version"],
|
|
140
139
|
site=site,
|
|
141
140
|
telescope_name=app_context.args["telescope"],
|
|
@@ -81,7 +81,7 @@ def main():
|
|
|
81
81
|
"""Derive trigger rates for a single telescope or an array of telescopes."""
|
|
82
82
|
app_context = startup_application(_parse)
|
|
83
83
|
|
|
84
|
-
telescope_trigger_rates(app_context.args
|
|
84
|
+
telescope_trigger_rates(app_context.args)
|
|
85
85
|
|
|
86
86
|
|
|
87
87
|
if __name__ == "__main__":
|
|
@@ -61,18 +61,12 @@ def main():
|
|
|
61
61
|
app_context.args.get("all_model_versions"),
|
|
62
62
|
]
|
|
63
63
|
):
|
|
64
|
-
ReportGenerator(
|
|
65
|
-
app_context.db_config,
|
|
66
|
-
app_context.args,
|
|
67
|
-
output_path,
|
|
68
|
-
).auto_generate_array_element_reports()
|
|
64
|
+
ReportGenerator(app_context.args, output_path).auto_generate_array_element_reports()
|
|
69
65
|
|
|
70
66
|
else:
|
|
71
67
|
model_version = app_context.args["model_version"]
|
|
72
68
|
ReadParameters(
|
|
73
|
-
app_context.
|
|
74
|
-
app_context.args,
|
|
75
|
-
Path(output_path / f"{model_version}"),
|
|
69
|
+
app_context.args, Path(output_path / f"{model_version}")
|
|
76
70
|
).produce_array_element_report()
|
|
77
71
|
|
|
78
72
|
app_context.logger.info(
|
|
@@ -32,9 +32,7 @@ def main():
|
|
|
32
32
|
|
|
33
33
|
output_path = app_context.io_handler.get_output_directory()
|
|
34
34
|
|
|
35
|
-
generator = ReportGenerator(
|
|
36
|
-
db_config=app_context.db_config, args=app_context.args, output_path=output_path
|
|
37
|
-
)
|
|
35
|
+
generator = ReportGenerator(args=app_context.args, output_path=output_path)
|
|
38
36
|
generator.auto_generate_calibration_reports()
|
|
39
37
|
|
|
40
38
|
if app_context.args.get("all_model_versions"):
|
|
@@ -41,14 +41,12 @@ def main():
|
|
|
41
41
|
|
|
42
42
|
if any([app_context.args.get("all_telescopes"), app_context.args.get("all_sites")]):
|
|
43
43
|
ReportGenerator(
|
|
44
|
-
app_context.db_config,
|
|
45
44
|
app_context.args,
|
|
46
45
|
output_path,
|
|
47
46
|
).auto_generate_parameter_reports()
|
|
48
47
|
|
|
49
48
|
else:
|
|
50
49
|
ReadParameters(
|
|
51
|
-
app_context.db_config,
|
|
52
50
|
app_context.args,
|
|
53
51
|
output_path,
|
|
54
52
|
).produce_model_parameter_reports()
|
|
@@ -33,9 +33,7 @@ def main():
|
|
|
33
33
|
|
|
34
34
|
output_path = app_context.io_handler.get_output_directory()
|
|
35
35
|
|
|
36
|
-
report_generator = ReportGenerator(
|
|
37
|
-
db_config=app_context.db_config, args=app_context.args, output_path=output_path
|
|
38
|
-
)
|
|
36
|
+
report_generator = ReportGenerator(args=app_context.args, output_path=output_path)
|
|
39
37
|
report_generator.auto_generate_simulation_configuration_reports()
|
|
40
38
|
|
|
41
39
|
app_context.logger.info(
|
|
@@ -46,7 +46,6 @@ def main():
|
|
|
46
46
|
array_model = ArrayModel(
|
|
47
47
|
label=app_context.args["label"],
|
|
48
48
|
model_version=app_context.args["model_version"],
|
|
49
|
-
db_config=app_context.db_config,
|
|
50
49
|
site=app_context.args.get("site"),
|
|
51
50
|
layout_name=app_context.args.get("array_layout_name"),
|
|
52
51
|
array_elements=app_context.args.get("array_elements"),
|
|
@@ -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
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
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
|
-
|
|
121
|
-
|
|
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
|
-
|
|
124
|
-
|
|
125
|
-
|
|
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
|
-
|
|
37
|
+
Fill and plot histograms for a test IACT file:
|
|
151
38
|
|
|
152
39
|
.. code-block:: console
|
|
153
40
|
|
|
154
|
-
simtools-generate-corsika-histograms --
|
|
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
|
|
157
|
-
--event_2d_histograms zenith azimuth --event_1d_histograms total_energy
|
|
43
|
+
--pdf_file_name test.pdf
|
|
158
44
|
|
|
159
|
-
|
|
45
|
+
Fill and plot histograms for several files:
|
|
160
46
|
|
|
161
|
-
|
|
47
|
+
.. code-block:: console
|
|
162
48
|
|
|
163
|
-
|
|
164
|
-
|
|
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
|
-
|
|
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
|
-
"--
|
|
183
|
-
help="Name of the CORSIKA IACT file
|
|
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
|
-
"--
|
|
190
|
-
help="
|
|
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
|
-
|
|
79
|
+
required=None,
|
|
195
80
|
)
|
|
196
|
-
|
|
197
81
|
config.parser.add_argument(
|
|
198
|
-
"--
|
|
199
|
-
help="
|
|
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=
|
|
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
|
|
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
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
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
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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.
|
|
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
|
-
|
|
71
|
-
|
|
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=
|
|
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.
|
|
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 =
|
|
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-
|
|
32
|
-
--model_path ../simulation-models-dev
|
|
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()
|