gammasimtools 0.5.1__py3-none-any.whl → 0.6.1__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.5.1.dist-info → gammasimtools-0.6.1.dist-info}/METADATA +80 -28
- gammasimtools-0.6.1.dist-info/RECORD +91 -0
- {gammasimtools-0.5.1.dist-info → gammasimtools-0.6.1.dist-info}/WHEEL +1 -1
- {gammasimtools-0.5.1.dist-info → gammasimtools-0.6.1.dist-info}/entry_points.txt +4 -2
- simtools/_version.py +14 -2
- simtools/applications/add_file_to_db.py +2 -1
- simtools/applications/compare_cumulative_psf.py +10 -15
- simtools/applications/db_development_tools/add_new_parameter_to_db.py +12 -6
- simtools/applications/derive_mirror_rnda.py +95 -71
- simtools/applications/generate_corsika_histograms.py +216 -131
- simtools/applications/generate_default_metadata.py +110 -0
- simtools/applications/generate_simtel_array_histograms.py +192 -0
- simtools/applications/get_file_from_db.py +1 -1
- simtools/applications/get_parameter.py +3 -3
- simtools/applications/make_regular_arrays.py +89 -93
- simtools/applications/{plot_layout_array.py → plot_array_layout.py} +15 -14
- simtools/applications/print_array_elements.py +81 -34
- simtools/applications/produce_array_config.py +2 -2
- simtools/applications/production.py +39 -5
- simtools/applications/sim_showers_for_trigger_rates.py +26 -30
- simtools/applications/simulate_prod.py +49 -107
- simtools/applications/submit_data_from_external.py +8 -10
- simtools/applications/tune_psf.py +16 -18
- simtools/applications/validate_camera_efficiency.py +63 -9
- simtools/applications/validate_camera_fov.py +9 -13
- simtools/applications/validate_file_using_schema.py +127 -0
- simtools/applications/validate_optics.py +13 -15
- simtools/camera_efficiency.py +73 -80
- simtools/configuration/commandline_parser.py +52 -22
- simtools/configuration/configurator.py +98 -33
- simtools/constants.py +9 -0
- simtools/corsika/corsika_config.py +28 -22
- simtools/corsika/corsika_default_config.py +282 -0
- simtools/corsika/corsika_histograms.py +328 -282
- simtools/corsika/corsika_histograms_visualize.py +162 -163
- simtools/corsika/corsika_runner.py +8 -4
- simtools/corsika_simtel/corsika_simtel_runner.py +18 -23
- simtools/data_model/data_reader.py +129 -0
- simtools/data_model/metadata_collector.py +346 -118
- simtools/data_model/metadata_model.py +123 -218
- simtools/data_model/model_data_writer.py +79 -22
- simtools/data_model/validate_data.py +96 -46
- simtools/db_handler.py +67 -42
- simtools/io_operations/__init__.py +0 -0
- simtools/io_operations/hdf5_handler.py +112 -0
- simtools/{io_handler.py → io_operations/io_handler.py} +51 -22
- simtools/job_execution/job_manager.py +1 -1
- simtools/layout/{layout_array.py → array_layout.py} +168 -199
- simtools/layout/geo_coordinates.py +196 -0
- simtools/layout/telescope_position.py +12 -12
- simtools/model/array_model.py +16 -14
- simtools/model/camera.py +5 -8
- simtools/model/mirrors.py +136 -73
- simtools/model/model_utils.py +1 -69
- simtools/model/telescope_model.py +32 -25
- simtools/psf_analysis.py +26 -19
- simtools/ray_tracing.py +54 -26
- simtools/schemas/data.metaschema.yml +400 -0
- simtools/schemas/metadata.metaschema.yml +566 -0
- simtools/simtel/simtel_config_writer.py +14 -5
- simtools/simtel/simtel_histograms.py +266 -83
- simtools/simtel/simtel_runner.py +8 -7
- simtools/simtel/simtel_runner_array.py +7 -8
- simtools/simtel/simtel_runner_camera_efficiency.py +48 -2
- simtools/simtel/simtel_runner_ray_tracing.py +61 -25
- simtools/simulator.py +43 -50
- simtools/utils/general.py +232 -286
- simtools/utils/geometry.py +163 -0
- simtools/utils/names.py +294 -142
- simtools/visualization/legend_handlers.py +115 -9
- simtools/visualization/visualize.py +13 -13
- gammasimtools-0.5.1.dist-info/RECORD +0 -83
- simtools/applications/plot_simtel_histograms.py +0 -120
- simtools/applications/validate_schema_files.py +0 -135
- simtools/corsika/corsika_output_visualize.py +0 -345
- simtools/data_model/validate_schema.py +0 -285
- {gammasimtools-0.5.1.dist-info → gammasimtools-0.6.1.dist-info}/LICENSE +0 -0
- {gammasimtools-0.5.1.dist-info → gammasimtools-0.6.1.dist-info}/top_level.txt +0 -0
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
from pathlib import Path
|
|
2
3
|
|
|
3
|
-
import matplotlib.colors as colors
|
|
4
4
|
import matplotlib.pyplot as plt
|
|
5
5
|
import numpy as np
|
|
6
6
|
from astropy import units as u
|
|
7
|
+
from matplotlib import colors
|
|
8
|
+
from matplotlib.backends.backend_pdf import PdfPages
|
|
7
9
|
|
|
8
10
|
_logger = logging.getLogger(__name__)
|
|
9
11
|
|
|
10
12
|
|
|
11
|
-
def
|
|
13
|
+
def _kernel_plot_2d_photons(histograms_instance, property_name, log_z=False):
|
|
12
14
|
"""
|
|
13
|
-
The next functions below are used by the the CorsikaHistograms class to plot all sort of
|
|
14
|
-
from the Cherenkov photons saved.
|
|
15
|
+
The next functions below are used by the the CorsikaHistograms class to plot all sort of
|
|
16
|
+
information from the Cherenkov photons saved.
|
|
15
17
|
|
|
16
18
|
Create the figure of a 2D plot. The parameter `name` indicate which plot.
|
|
17
19
|
Choices are "counts", "density", "direction", "time_altitude", and "num_photons_per_telescope".
|
|
18
20
|
|
|
19
21
|
Parameters
|
|
20
22
|
----------
|
|
21
|
-
|
|
23
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
22
24
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
23
25
|
property_name: string
|
|
24
26
|
Name of the quantity. Options are: "counts", "density", "direction", "time_altitude" and
|
|
@@ -30,63 +32,68 @@ def _kernel_plot_2D_photons(corsika_histograms_instance, property_name, log_z=Fa
|
|
|
30
32
|
-------
|
|
31
33
|
list
|
|
32
34
|
List of figures for the given telescopes.
|
|
33
|
-
list
|
|
34
|
-
List of the figure names.
|
|
35
35
|
|
|
36
36
|
Raises
|
|
37
37
|
------
|
|
38
38
|
ValueError
|
|
39
39
|
if `property` is not allowed.
|
|
40
40
|
"""
|
|
41
|
-
if property_name not in
|
|
42
|
-
msg = (
|
|
43
|
-
|
|
41
|
+
if property_name not in histograms_instance.dict_2d_distributions:
|
|
42
|
+
msg = (
|
|
43
|
+
f"This property does not exist. The valid entries are "
|
|
44
|
+
f"{histograms_instance.dict_2d_distributions}"
|
|
45
|
+
)
|
|
44
46
|
_logger.error(msg)
|
|
45
47
|
raise ValueError
|
|
46
48
|
function = getattr(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
histograms_instance,
|
|
50
|
+
histograms_instance.dict_2d_distributions[property_name]["function"],
|
|
49
51
|
)
|
|
50
|
-
hist_values,
|
|
52
|
+
hist_values, x_bin_edges, y_bin_edges = function()
|
|
51
53
|
|
|
52
54
|
all_figs = []
|
|
53
|
-
|
|
54
|
-
for i_hist, _ in enumerate(x_edges):
|
|
55
|
+
for i_hist, _ in enumerate(x_bin_edges):
|
|
55
56
|
fig, ax = plt.subplots()
|
|
56
57
|
if log_z is True:
|
|
57
58
|
norm = colors.LogNorm(vmin=1, vmax=np.amax([np.amax(hist_values[i_hist]), 2]))
|
|
58
59
|
else:
|
|
59
60
|
norm = None
|
|
60
|
-
mesh = ax.pcolormesh(
|
|
61
|
+
mesh = ax.pcolormesh(
|
|
62
|
+
x_bin_edges[i_hist], y_bin_edges[i_hist], hist_values[i_hist], norm=norm
|
|
63
|
+
)
|
|
61
64
|
if (
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
histograms_instance.dict_2d_distributions[property_name]["x axis unit"]
|
|
66
|
+
is not u.dimensionless_unscaled
|
|
64
67
|
):
|
|
65
68
|
ax.set_xlabel(
|
|
66
|
-
f"{
|
|
67
|
-
f"({
|
|
69
|
+
f"{histograms_instance.dict_2d_distributions[property_name]['x bin edges']} "
|
|
70
|
+
f"({histograms_instance.dict_2d_distributions[property_name]['x axis unit']})"
|
|
68
71
|
)
|
|
69
72
|
else:
|
|
70
73
|
ax.set_xlabel(
|
|
71
|
-
f"{
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
f"{histograms_instance.dict_2d_distributions[property_name]['x bin edges']} "
|
|
75
|
+
)
|
|
76
|
+
if (
|
|
77
|
+
histograms_instance.dict_2d_distributions[property_name]["y axis unit"]
|
|
78
|
+
is not u.dimensionless_unscaled
|
|
79
|
+
):
|
|
74
80
|
ax.set_ylabel(
|
|
75
|
-
f"{
|
|
76
|
-
f"({
|
|
81
|
+
f"{histograms_instance.dict_2d_distributions[property_name]['y bin edges']} "
|
|
82
|
+
f"({histograms_instance.dict_2d_distributions[property_name]['y axis unit']})"
|
|
77
83
|
)
|
|
78
84
|
else:
|
|
79
85
|
ax.set_ylabel(
|
|
80
|
-
f"{
|
|
81
|
-
|
|
82
|
-
ax.
|
|
86
|
+
f"{histograms_instance.dict_2d_distributions[property_name]['y bin edges']} "
|
|
87
|
+
)
|
|
88
|
+
ax.set_xlim(np.amin(x_bin_edges[i_hist]), np.amax(x_bin_edges[i_hist]))
|
|
89
|
+
ax.set_ylim(np.amin(y_bin_edges[i_hist]), np.amax(y_bin_edges[i_hist]))
|
|
83
90
|
ax.set_facecolor("black")
|
|
84
91
|
fig.colorbar(mesh)
|
|
85
92
|
all_figs.append(fig)
|
|
86
|
-
if
|
|
87
|
-
|
|
88
|
-
f"{
|
|
89
|
-
|
|
93
|
+
if histograms_instance.individual_telescopes is False:
|
|
94
|
+
ax.set_title(
|
|
95
|
+
f"{histograms_instance.dict_2d_distributions[property_name]['file name']}"
|
|
96
|
+
"_all_tels"
|
|
90
97
|
)
|
|
91
98
|
else:
|
|
92
99
|
ax.text(
|
|
@@ -98,22 +105,22 @@ def _kernel_plot_2D_photons(corsika_histograms_instance, property_name, log_z=Fa
|
|
|
98
105
|
transform=ax.transAxes,
|
|
99
106
|
color="white",
|
|
100
107
|
)
|
|
101
|
-
|
|
102
|
-
f"{
|
|
103
|
-
f"_tel_index_{
|
|
108
|
+
ax.set_title(
|
|
109
|
+
f"{histograms_instance.dict_2d_distributions[property_name]['file name']}"
|
|
110
|
+
f"_tel_index_{histograms_instance.telescope_indices[i_hist]}",
|
|
104
111
|
)
|
|
105
112
|
plt.close()
|
|
106
113
|
|
|
107
|
-
return all_figs
|
|
114
|
+
return all_figs
|
|
108
115
|
|
|
109
116
|
|
|
110
|
-
def
|
|
117
|
+
def plot_2d_counts(histograms_instance, log_z=True):
|
|
111
118
|
"""
|
|
112
119
|
Plot the 2D histogram of the photon positions on the ground.
|
|
113
120
|
|
|
114
121
|
Parameters
|
|
115
122
|
----------
|
|
116
|
-
|
|
123
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
117
124
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
118
125
|
log_z: bool
|
|
119
126
|
if True, the intensity of the color bar is given in logarithmic scale.
|
|
@@ -122,20 +129,17 @@ def plot_2D_counts(corsika_histograms_instance, log_z=True):
|
|
|
122
129
|
-------
|
|
123
130
|
list
|
|
124
131
|
List of figures for the given telescopes.
|
|
125
|
-
list
|
|
126
|
-
List of the figure names.
|
|
127
|
-
|
|
128
132
|
"""
|
|
129
|
-
return
|
|
133
|
+
return _kernel_plot_2d_photons(histograms_instance, "counts", log_z=log_z)
|
|
130
134
|
|
|
131
135
|
|
|
132
|
-
def
|
|
136
|
+
def plot_2d_density(histograms_instance, log_z=True):
|
|
133
137
|
"""
|
|
134
138
|
Plot the 2D histogram of the photon density distribution on the ground.
|
|
135
139
|
|
|
136
140
|
Parameters
|
|
137
141
|
----------
|
|
138
|
-
|
|
142
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
139
143
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
140
144
|
log_z: bool
|
|
141
145
|
if True, the intensity of the color bar is given in logarithmic scale.
|
|
@@ -144,20 +148,18 @@ def plot_2D_density(corsika_histograms_instance, log_z=True):
|
|
|
144
148
|
-------
|
|
145
149
|
list
|
|
146
150
|
List of figures for the given telescopes.
|
|
147
|
-
list
|
|
148
|
-
List of the figure names.
|
|
149
151
|
|
|
150
152
|
"""
|
|
151
|
-
return
|
|
153
|
+
return _kernel_plot_2d_photons(histograms_instance, "density", log_z=log_z)
|
|
152
154
|
|
|
153
155
|
|
|
154
|
-
def
|
|
156
|
+
def plot_2d_direction(histograms_instance, log_z=True):
|
|
155
157
|
"""
|
|
156
158
|
Plot the 2D histogram of the incoming direction of photons.
|
|
157
159
|
|
|
158
160
|
Parameters
|
|
159
161
|
----------
|
|
160
|
-
|
|
162
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
161
163
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
162
164
|
log_z: bool
|
|
163
165
|
if True, the intensity of the color bar is given in logarithmic scale.
|
|
@@ -166,20 +168,18 @@ def plot_2D_direction(corsika_histograms_instance, log_z=True):
|
|
|
166
168
|
-------
|
|
167
169
|
list
|
|
168
170
|
List of figures for the given telescopes.
|
|
169
|
-
list
|
|
170
|
-
List of the figure names.
|
|
171
171
|
|
|
172
172
|
"""
|
|
173
|
-
return
|
|
173
|
+
return _kernel_plot_2d_photons(histograms_instance, "direction", log_z=log_z)
|
|
174
174
|
|
|
175
175
|
|
|
176
|
-
def
|
|
176
|
+
def plot_2d_time_altitude(histograms_instance, log_z=True):
|
|
177
177
|
"""
|
|
178
178
|
Plot the 2D histogram of the time and altitude where the photon was produced.
|
|
179
179
|
|
|
180
180
|
Parameters
|
|
181
181
|
----------
|
|
182
|
-
|
|
182
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
183
183
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
184
184
|
log_z: bool
|
|
185
185
|
if True, the intensity of the color bar is given in logarithmic scale.
|
|
@@ -188,20 +188,18 @@ def plot_2D_time_altitude(corsika_histograms_instance, log_z=True):
|
|
|
188
188
|
-------
|
|
189
189
|
list
|
|
190
190
|
List of figures for the given telescopes.
|
|
191
|
-
list
|
|
192
|
-
List of the figure names.
|
|
193
191
|
|
|
194
192
|
"""
|
|
195
|
-
return
|
|
193
|
+
return _kernel_plot_2d_photons(histograms_instance, "time_altitude", log_z=log_z)
|
|
196
194
|
|
|
197
195
|
|
|
198
|
-
def
|
|
196
|
+
def plot_2d_num_photons_per_telescope(histograms_instance, log_z=True):
|
|
199
197
|
"""
|
|
200
198
|
Plot the 2D histogram of the number of photons per event and per telescope.
|
|
201
199
|
|
|
202
200
|
Parameters
|
|
203
201
|
----------
|
|
204
|
-
|
|
202
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
205
203
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
206
204
|
log_z: bool
|
|
207
205
|
if True, the intensity of the color bar is given in logarithmic scale.
|
|
@@ -210,22 +208,18 @@ def plot_2D_num_photons_per_telescope(corsika_histograms_instance, log_z=True):
|
|
|
210
208
|
-------
|
|
211
209
|
list
|
|
212
210
|
List of figures for the given telescopes.
|
|
213
|
-
list
|
|
214
|
-
List of the figure names.
|
|
215
211
|
|
|
216
212
|
"""
|
|
217
|
-
return
|
|
218
|
-
corsika_histograms_instance, "num_photons_per_telescope", log_z=log_z
|
|
219
|
-
)
|
|
213
|
+
return _kernel_plot_2d_photons(histograms_instance, "num_photons_per_telescope", log_z=log_z)
|
|
220
214
|
|
|
221
215
|
|
|
222
|
-
def
|
|
216
|
+
def _kernel_plot_1d_photons(histograms_instance, property_name, log_y=True):
|
|
223
217
|
"""
|
|
224
218
|
Create the figure of a 1D plot. The parameter `property` indicate which plot.
|
|
225
219
|
|
|
226
220
|
Parameters
|
|
227
221
|
----------
|
|
228
|
-
|
|
222
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
229
223
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
230
224
|
property_name: string
|
|
231
225
|
Name of the quantity. Choices are
|
|
@@ -238,71 +232,78 @@ def _kernel_plot_1D_photons(corsika_histograms_instance, property_name, log_y=Tr
|
|
|
238
232
|
-------
|
|
239
233
|
list
|
|
240
234
|
List of figures for the given telescopes.
|
|
241
|
-
list
|
|
242
|
-
List of the figure names.
|
|
243
235
|
|
|
244
236
|
Raises
|
|
245
237
|
------
|
|
246
238
|
ValueError
|
|
247
239
|
if `property` is not allowed.
|
|
248
240
|
"""
|
|
249
|
-
if property_name not in
|
|
250
|
-
msg = (
|
|
251
|
-
|
|
241
|
+
if property_name not in histograms_instance.dict_1d_distributions:
|
|
242
|
+
msg = (
|
|
243
|
+
f"This property does not exist. The valid entries are "
|
|
244
|
+
f"{histograms_instance.dict_1d_distributions}"
|
|
245
|
+
)
|
|
252
246
|
_logger.error(msg)
|
|
253
247
|
raise ValueError
|
|
254
248
|
|
|
255
249
|
function = getattr(
|
|
256
|
-
|
|
257
|
-
|
|
250
|
+
histograms_instance,
|
|
251
|
+
histograms_instance.dict_1d_distributions[property_name]["function"],
|
|
258
252
|
)
|
|
259
|
-
hist_values,
|
|
253
|
+
hist_values, bin_edges = function()
|
|
260
254
|
all_figs = []
|
|
261
|
-
|
|
262
|
-
for i_hist, _ in enumerate(edges):
|
|
255
|
+
for i_hist, _ in enumerate(bin_edges):
|
|
263
256
|
fig, ax = plt.subplots()
|
|
264
257
|
ax.bar(
|
|
265
|
-
|
|
258
|
+
bin_edges[i_hist][:-1],
|
|
266
259
|
hist_values[i_hist],
|
|
267
260
|
align="edge",
|
|
268
|
-
width=np.abs(np.diff(
|
|
261
|
+
width=np.abs(np.diff(bin_edges[i_hist])),
|
|
269
262
|
)
|
|
270
263
|
if (
|
|
271
|
-
|
|
272
|
-
|
|
264
|
+
histograms_instance.dict_1d_distributions[property_name]["axis unit"]
|
|
265
|
+
is not u.dimensionless_unscaled
|
|
273
266
|
):
|
|
274
267
|
ax.set_xlabel(
|
|
275
|
-
f"{
|
|
276
|
-
f"({
|
|
268
|
+
f"{histograms_instance.dict_1d_distributions[property_name]['bin edges']} "
|
|
269
|
+
f"({histograms_instance.dict_1d_distributions[property_name]['axis unit']})"
|
|
277
270
|
)
|
|
278
271
|
else:
|
|
279
272
|
ax.set_xlabel(
|
|
280
|
-
f"{
|
|
281
|
-
|
|
273
|
+
f"{histograms_instance.dict_1d_distributions[property_name]['bin edges']} "
|
|
274
|
+
)
|
|
275
|
+
if property_name == "density":
|
|
276
|
+
ax.set_ylabel(
|
|
277
|
+
f"Density ({histograms_instance.dict_1d_distributions[property_name]['axis unit']}"
|
|
278
|
+
r"$^{-2}$)"
|
|
279
|
+
)
|
|
280
|
+
else:
|
|
281
|
+
ax.set_ylabel("Counts")
|
|
282
282
|
|
|
283
283
|
if log_y is True:
|
|
284
284
|
ax.set_yscale("log")
|
|
285
|
-
if
|
|
286
|
-
|
|
287
|
-
f"{
|
|
288
|
-
|
|
285
|
+
if histograms_instance.individual_telescopes is False:
|
|
286
|
+
ax.set_title(
|
|
287
|
+
f"{histograms_instance.dict_1d_distributions[property_name]['file name']}"
|
|
288
|
+
"_all_tels"
|
|
289
289
|
)
|
|
290
290
|
else:
|
|
291
|
-
|
|
292
|
-
f"{
|
|
293
|
-
f"_tel_index_{
|
|
291
|
+
ax.set_title(
|
|
292
|
+
f"{histograms_instance.dict_1d_distributions[property_name]['file name']}"
|
|
293
|
+
f"_tel_index_{histograms_instance.telescope_indices[i_hist]}",
|
|
294
294
|
)
|
|
295
295
|
all_figs.append(fig)
|
|
296
|
-
|
|
296
|
+
plt.close(fig)
|
|
297
|
+
return all_figs
|
|
297
298
|
|
|
298
299
|
|
|
299
|
-
def plot_wavelength_distr(
|
|
300
|
+
def plot_wavelength_distr(histograms_instance, log_y=True):
|
|
300
301
|
"""
|
|
301
302
|
Plots the 1D distribution of the photon wavelengths
|
|
302
303
|
|
|
303
304
|
Parameters
|
|
304
305
|
----------
|
|
305
|
-
|
|
306
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
306
307
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
307
308
|
log_y: bool
|
|
308
309
|
if True, the intensity of the Y axis is given in logarithmic scale.
|
|
@@ -311,19 +312,17 @@ def plot_wavelength_distr(corsika_histograms_instance, log_y=True):
|
|
|
311
312
|
-------
|
|
312
313
|
list
|
|
313
314
|
List of figures for the given telescopes.
|
|
314
|
-
list
|
|
315
|
-
List of the figure names.
|
|
316
315
|
"""
|
|
317
|
-
return
|
|
316
|
+
return _kernel_plot_1d_photons(histograms_instance, "wavelength", log_y=log_y)
|
|
318
317
|
|
|
319
318
|
|
|
320
|
-
def plot_counts_distr(
|
|
319
|
+
def plot_counts_distr(histograms_instance, log_y=True):
|
|
321
320
|
"""
|
|
322
321
|
Plots the 1D distribution, i.e. the radial distribution, of the photons on the ground.
|
|
323
322
|
|
|
324
323
|
Parameters
|
|
325
324
|
----------
|
|
326
|
-
|
|
325
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
327
326
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
328
327
|
log_y: bool
|
|
329
328
|
if True, the intensity of the Y axis is given in logarithmic scale.
|
|
@@ -332,19 +331,17 @@ def plot_counts_distr(corsika_histograms_instance, log_y=True):
|
|
|
332
331
|
-------
|
|
333
332
|
list
|
|
334
333
|
List of figures for the given telescopes.
|
|
335
|
-
list
|
|
336
|
-
List of the figure names.
|
|
337
334
|
"""
|
|
338
|
-
return
|
|
335
|
+
return _kernel_plot_1d_photons(histograms_instance, "counts", log_y=log_y)
|
|
339
336
|
|
|
340
337
|
|
|
341
|
-
def plot_density_distr(
|
|
338
|
+
def plot_density_distr(histograms_instance, log_y=True):
|
|
342
339
|
"""
|
|
343
340
|
Plots the photon density distribution on the ground.
|
|
344
341
|
|
|
345
342
|
Parameters
|
|
346
343
|
----------
|
|
347
|
-
|
|
344
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
348
345
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
349
346
|
log_y: bool
|
|
350
347
|
if True, the intensity of the Y axis is given in logarithmic scale.
|
|
@@ -353,19 +350,17 @@ def plot_density_distr(corsika_histograms_instance, log_y=True):
|
|
|
353
350
|
-------
|
|
354
351
|
list
|
|
355
352
|
List of figures for the given telescopes.
|
|
356
|
-
list
|
|
357
|
-
List of the figure names.
|
|
358
353
|
"""
|
|
359
|
-
return
|
|
354
|
+
return _kernel_plot_1d_photons(histograms_instance, "density", log_y=log_y)
|
|
360
355
|
|
|
361
356
|
|
|
362
|
-
def plot_time_distr(
|
|
357
|
+
def plot_time_distr(histograms_instance, log_y=True):
|
|
363
358
|
"""
|
|
364
359
|
Plots the distribution times in which the photons were generated in ns.
|
|
365
360
|
|
|
366
361
|
Parameters
|
|
367
362
|
----------
|
|
368
|
-
|
|
363
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
369
364
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
370
365
|
log_y: bool
|
|
371
366
|
if True, the intensity of the Y axis is given in logarithmic scale.
|
|
@@ -374,19 +369,17 @@ def plot_time_distr(corsika_histograms_instance, log_y=True):
|
|
|
374
369
|
-------
|
|
375
370
|
list
|
|
376
371
|
List of figures for the given telescopes.
|
|
377
|
-
list
|
|
378
|
-
List of the figure names.
|
|
379
372
|
"""
|
|
380
|
-
return
|
|
373
|
+
return _kernel_plot_1d_photons(histograms_instance, "time", log_y=log_y)
|
|
381
374
|
|
|
382
375
|
|
|
383
|
-
def plot_altitude_distr(
|
|
376
|
+
def plot_altitude_distr(histograms_instance, log_y=True):
|
|
384
377
|
"""
|
|
385
378
|
Plots the distribution of altitude in which the photons were generated in km.
|
|
386
379
|
|
|
387
380
|
Parameters
|
|
388
381
|
----------
|
|
389
|
-
|
|
382
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
390
383
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
391
384
|
log_y: bool
|
|
392
385
|
if True, the intensity of the Y axis is given in logarithmic scale.
|
|
@@ -395,19 +388,17 @@ def plot_altitude_distr(corsika_histograms_instance, log_y=True):
|
|
|
395
388
|
-------
|
|
396
389
|
list
|
|
397
390
|
List of figures for the given telescopes.
|
|
398
|
-
list
|
|
399
|
-
List of the figure names.
|
|
400
391
|
"""
|
|
401
|
-
return
|
|
392
|
+
return _kernel_plot_1d_photons(histograms_instance, "altitude", log_y=log_y)
|
|
402
393
|
|
|
403
394
|
|
|
404
|
-
def plot_photon_per_event_distr(
|
|
395
|
+
def plot_photon_per_event_distr(histograms_instance, log_y=True):
|
|
405
396
|
"""
|
|
406
397
|
Plots the distribution of the number of Cherenkov photons per event.
|
|
407
398
|
|
|
408
399
|
Parameters
|
|
409
400
|
----------
|
|
410
|
-
|
|
401
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
411
402
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
412
403
|
log_y: bool
|
|
413
404
|
if True, the intensity of the Y axis is given in logarithmic scale.
|
|
@@ -416,22 +407,19 @@ def plot_photon_per_event_distr(corsika_histograms_instance, log_y=True):
|
|
|
416
407
|
-------
|
|
417
408
|
list
|
|
418
409
|
List of figures for the given telescopes.
|
|
419
|
-
list
|
|
420
|
-
List of the figure names.
|
|
421
410
|
|
|
422
411
|
"""
|
|
423
412
|
|
|
424
|
-
return
|
|
425
|
-
log_y=log_y)
|
|
413
|
+
return _kernel_plot_1d_photons(histograms_instance, "num_photons_per_event", log_y=log_y)
|
|
426
414
|
|
|
427
415
|
|
|
428
|
-
def plot_photon_per_telescope_distr(
|
|
416
|
+
def plot_photon_per_telescope_distr(histograms_instance, log_y=True):
|
|
429
417
|
"""
|
|
430
418
|
Plots the distribution of the number of Cherenkov photons per telescope.
|
|
431
419
|
|
|
432
420
|
Parameters
|
|
433
421
|
----------
|
|
434
|
-
|
|
422
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
435
423
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
436
424
|
log_y: bool
|
|
437
425
|
if True, the intensity of the Y axis is given in logarithmic scale.
|
|
@@ -440,25 +428,21 @@ def plot_photon_per_telescope_distr(corsika_histograms_instance, log_y=True):
|
|
|
440
428
|
-------
|
|
441
429
|
list
|
|
442
430
|
List of figures for the given telescopes.
|
|
443
|
-
list
|
|
444
|
-
List of the figure names.
|
|
445
431
|
|
|
446
432
|
"""
|
|
447
433
|
|
|
448
|
-
return
|
|
449
|
-
corsika_histograms_instance, "num_photons_per_telescope", log_y=log_y
|
|
450
|
-
)
|
|
434
|
+
return _kernel_plot_1d_photons(histograms_instance, "num_photons_per_telescope", log_y=log_y)
|
|
451
435
|
|
|
452
436
|
|
|
453
|
-
def
|
|
454
|
-
|
|
437
|
+
def plot_1d_event_header_distribution(
|
|
438
|
+
histograms_instance, event_header_element, log_y=True, bins=50, hist_range=None
|
|
455
439
|
):
|
|
456
440
|
"""
|
|
457
441
|
Plots the distribution of the quantity given by .
|
|
458
442
|
|
|
459
443
|
Parameters
|
|
460
444
|
----------
|
|
461
|
-
|
|
445
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
462
446
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
463
447
|
event_header_element: str
|
|
464
448
|
The key to the CORSIKA event header element.
|
|
@@ -473,27 +457,25 @@ def plot_1D_event_header_distribution(
|
|
|
473
457
|
-------
|
|
474
458
|
list
|
|
475
459
|
List of figures for the given telescopes.
|
|
476
|
-
list
|
|
477
|
-
List of the figure names.
|
|
478
460
|
|
|
479
461
|
"""
|
|
480
|
-
hist_values,
|
|
462
|
+
hist_values, bin_edges = histograms_instance.event_1d_histogram(
|
|
481
463
|
event_header_element, bins=bins, hist_range=hist_range
|
|
482
464
|
)
|
|
483
465
|
fig, ax = plt.subplots()
|
|
484
466
|
ax.bar(
|
|
485
|
-
|
|
467
|
+
bin_edges[:-1],
|
|
486
468
|
hist_values,
|
|
487
469
|
align="edge",
|
|
488
|
-
width=np.abs(np.diff(
|
|
470
|
+
width=np.abs(np.diff(bin_edges)),
|
|
489
471
|
)
|
|
490
472
|
if (
|
|
491
|
-
|
|
492
|
-
|
|
473
|
+
histograms_instance.event_information[event_header_element].unit
|
|
474
|
+
is not u.dimensionless_unscaled
|
|
493
475
|
):
|
|
494
476
|
ax.set_xlabel(
|
|
495
477
|
f"{event_header_element} ("
|
|
496
|
-
f"{
|
|
478
|
+
f"{histograms_instance.event_information[event_header_element].unit})"
|
|
497
479
|
)
|
|
498
480
|
else:
|
|
499
481
|
ax.set_xlabel(f"{event_header_element}")
|
|
@@ -501,24 +483,24 @@ def plot_1D_event_header_distribution(
|
|
|
501
483
|
|
|
502
484
|
if log_y is True:
|
|
503
485
|
ax.set_yscale("log")
|
|
504
|
-
|
|
505
|
-
return fig
|
|
486
|
+
ax.set_title(f"hist_1d_{event_header_element}")
|
|
487
|
+
return fig
|
|
506
488
|
|
|
507
489
|
|
|
508
|
-
def
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
490
|
+
def plot_2d_event_header_distribution(
|
|
491
|
+
histograms_instance,
|
|
492
|
+
event_header_element_1,
|
|
493
|
+
event_header_element_2,
|
|
494
|
+
log_z=True,
|
|
495
|
+
bins=50,
|
|
496
|
+
hist_range=None,
|
|
515
497
|
):
|
|
516
498
|
"""
|
|
517
499
|
Plots the distribution of the quantity given by .
|
|
518
500
|
|
|
519
501
|
Parameters
|
|
520
502
|
----------
|
|
521
|
-
|
|
503
|
+
histograms_instance: corsika.corsika_histograms.CorsikaHistograms
|
|
522
504
|
instance of corsika.corsika_histograms.CorsikaHistograms.
|
|
523
505
|
event_header_element_1: str
|
|
524
506
|
The first key to the CORSIKA event header element
|
|
@@ -535,11 +517,9 @@ def plot_2D_event_header_distribution(
|
|
|
535
517
|
-------
|
|
536
518
|
list
|
|
537
519
|
List of figures for the given telescopes.
|
|
538
|
-
list
|
|
539
|
-
List of the figure names.
|
|
540
520
|
|
|
541
521
|
"""
|
|
542
|
-
hist_values,
|
|
522
|
+
hist_values, x_bin_edges, y_bin_edges = histograms_instance.event_2d_histogram(
|
|
543
523
|
event_header_element_1, event_header_element_2, bins=bins, hist_range=hist_range
|
|
544
524
|
)
|
|
545
525
|
fig, ax = plt.subplots()
|
|
@@ -547,29 +527,48 @@ def plot_2D_event_header_distribution(
|
|
|
547
527
|
norm = colors.LogNorm(vmin=1, vmax=np.amax([np.amax(hist_values), 2]))
|
|
548
528
|
else:
|
|
549
529
|
norm = None
|
|
550
|
-
mesh = ax.pcolormesh(
|
|
530
|
+
mesh = ax.pcolormesh(x_bin_edges, y_bin_edges, hist_values, norm=norm)
|
|
551
531
|
|
|
552
532
|
if (
|
|
553
|
-
|
|
554
|
-
|
|
533
|
+
histograms_instance.event_information[event_header_element_1].unit
|
|
534
|
+
is not u.dimensionless_unscaled
|
|
555
535
|
):
|
|
556
536
|
ax.set_xlabel(
|
|
557
537
|
f"{event_header_element_1} ("
|
|
558
|
-
f"{
|
|
538
|
+
f"{histograms_instance.event_information[event_header_element_1].unit})"
|
|
559
539
|
)
|
|
560
540
|
else:
|
|
561
541
|
ax.set_xlabel(f"{event_header_element_2}")
|
|
562
542
|
if (
|
|
563
|
-
|
|
564
|
-
|
|
543
|
+
histograms_instance.event_information[event_header_element_2].unit
|
|
544
|
+
is not u.dimensionless_unscaled
|
|
565
545
|
):
|
|
566
546
|
ax.set_ylabel(
|
|
567
547
|
f"{event_header_element_2} "
|
|
568
|
-
f"({
|
|
548
|
+
f"({histograms_instance.event_information[event_header_element_2].unit})"
|
|
549
|
+
)
|
|
569
550
|
else:
|
|
570
551
|
ax.set_ylabel(f"{event_header_element_2}")
|
|
571
552
|
|
|
572
553
|
ax.set_facecolor("black")
|
|
554
|
+
ax.set_title(f"hist_2d_{event_header_element_1}_{event_header_element_2}")
|
|
573
555
|
fig.colorbar(mesh)
|
|
574
|
-
|
|
575
|
-
|
|
556
|
+
return fig
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
def save_figs_to_pdf(figs, pdf_file_name):
|
|
560
|
+
"""
|
|
561
|
+
Save figures from corsika histograms to an output pdf file.
|
|
562
|
+
|
|
563
|
+
Parameters
|
|
564
|
+
----------
|
|
565
|
+
figs: list or numpy.array
|
|
566
|
+
List with the figures output by `corsika_output_visualize.py`.
|
|
567
|
+
pdf_file_name: str or Path
|
|
568
|
+
Name of the pdf file.
|
|
569
|
+
"""
|
|
570
|
+
pdf_pages = PdfPages(Path(pdf_file_name).absolute().as_posix())
|
|
571
|
+
for fig in figs:
|
|
572
|
+
plt.tight_layout()
|
|
573
|
+
pdf_pages.savefig(fig)
|
|
574
|
+
pdf_pages.close()
|