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
|
@@ -3,9 +3,9 @@ import matplotlib.patches as mpatches
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
5
|
from simtools.corsika.corsika_config import CorsikaConfig
|
|
6
|
-
from simtools.io_handler import IOHandler
|
|
6
|
+
from simtools.io_operations.io_handler import IOHandler
|
|
7
7
|
from simtools.utils import names
|
|
8
|
-
from simtools.utils.names import lst, mst, sct, sst
|
|
8
|
+
from simtools.utils.names import hess, lst, magic, mst, sct, sst, veritas
|
|
9
9
|
|
|
10
10
|
__all__ = [
|
|
11
11
|
"EdgePixelObject",
|
|
@@ -50,9 +50,12 @@ class TelescopeHandler(object):
|
|
|
50
50
|
mst: "dodgerblue",
|
|
51
51
|
sct: "black",
|
|
52
52
|
sst: "darkgreen",
|
|
53
|
+
hess: "grey",
|
|
54
|
+
magic: "grey",
|
|
55
|
+
veritas: "grey",
|
|
53
56
|
}
|
|
54
|
-
for
|
|
55
|
-
self.radius_dict[
|
|
57
|
+
for key, value in corsika_info["corsika_sphere_radius"].items():
|
|
58
|
+
self.radius_dict[key] = value["value"]
|
|
56
59
|
|
|
57
60
|
|
|
58
61
|
class PixelObject(object):
|
|
@@ -83,6 +86,18 @@ class SSTObject(object):
|
|
|
83
86
|
"""SST Object."""
|
|
84
87
|
|
|
85
88
|
|
|
89
|
+
class HESSObject(object):
|
|
90
|
+
"""HESS Object."""
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class MAGICObject(object):
|
|
94
|
+
"""MAGIC Object."""
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class VERITASObject(object):
|
|
98
|
+
"""VERITAS Object."""
|
|
99
|
+
|
|
100
|
+
|
|
86
101
|
class MeanRadiusOuterEdgeObject(object):
|
|
87
102
|
"""Object for Mean radius outer edge."""
|
|
88
103
|
|
|
@@ -288,7 +303,7 @@ class SSTHandler(TelescopeHandler):
|
|
|
288
303
|
return patch
|
|
289
304
|
|
|
290
305
|
|
|
291
|
-
class SCTHandler(
|
|
306
|
+
class SCTHandler(TelescopeHandler):
|
|
292
307
|
"""
|
|
293
308
|
Legend handler class to plot a representation of an SCT in an array layout.
|
|
294
309
|
"""
|
|
@@ -308,6 +323,78 @@ class SCTHandler(object):
|
|
|
308
323
|
return patch
|
|
309
324
|
|
|
310
325
|
|
|
326
|
+
class HESSHandler(TelescopeHandler):
|
|
327
|
+
"""
|
|
328
|
+
Legend handler class to plot a representation of an HESS in an array layout.
|
|
329
|
+
"""
|
|
330
|
+
|
|
331
|
+
def legend_artist(self, legend, orig_handle, fontsize, handlebox):
|
|
332
|
+
x0, y0 = (
|
|
333
|
+
handlebox.xdescent + handlebox.width / 3,
|
|
334
|
+
handlebox.ydescent + handlebox.height / 3,
|
|
335
|
+
)
|
|
336
|
+
radius = handlebox.height
|
|
337
|
+
patch = mpatches.RegularPolygon(
|
|
338
|
+
(x0, y0),
|
|
339
|
+
numVertices=6,
|
|
340
|
+
radius=0.7 * radius * self.radius_dict[hess] / self.radius_dict[lst],
|
|
341
|
+
orientation=np.deg2rad(30),
|
|
342
|
+
facecolor=self.colors_dict[hess],
|
|
343
|
+
edgecolor=self.colors_dict[hess],
|
|
344
|
+
transform=handlebox.get_transform(),
|
|
345
|
+
)
|
|
346
|
+
handlebox.add_artist(patch)
|
|
347
|
+
return patch
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
class MAGICHandler(TelescopeHandler):
|
|
351
|
+
"""
|
|
352
|
+
Legend handler class to plot a representation of an MAGIC in an array layout.
|
|
353
|
+
"""
|
|
354
|
+
|
|
355
|
+
def legend_artist(self, legend, orig_handle, fontsize, handlebox):
|
|
356
|
+
x0, y0 = (
|
|
357
|
+
handlebox.xdescent + handlebox.width / 3,
|
|
358
|
+
handlebox.ydescent + handlebox.height / 3,
|
|
359
|
+
)
|
|
360
|
+
radius = handlebox.height
|
|
361
|
+
patch = mpatches.RegularPolygon(
|
|
362
|
+
(x0, y0),
|
|
363
|
+
numVertices=6,
|
|
364
|
+
radius=0.7 * radius * self.radius_dict[magic] / self.radius_dict[lst],
|
|
365
|
+
orientation=np.deg2rad(30),
|
|
366
|
+
facecolor=self.colors_dict[magic],
|
|
367
|
+
edgecolor=self.colors_dict[magic],
|
|
368
|
+
transform=handlebox.get_transform(),
|
|
369
|
+
)
|
|
370
|
+
handlebox.add_artist(patch)
|
|
371
|
+
return patch
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
class VERITASHandler(TelescopeHandler):
|
|
375
|
+
"""
|
|
376
|
+
Legend handler class to plot a representation of an VERITAS in an array layout.
|
|
377
|
+
"""
|
|
378
|
+
|
|
379
|
+
def legend_artist(self, legend, orig_handle, fontsize, handlebox):
|
|
380
|
+
x0, y0 = (
|
|
381
|
+
handlebox.xdescent + handlebox.width / 3,
|
|
382
|
+
handlebox.ydescent + handlebox.height / 3,
|
|
383
|
+
)
|
|
384
|
+
radius = handlebox.height
|
|
385
|
+
patch = mpatches.RegularPolygon(
|
|
386
|
+
(x0, y0),
|
|
387
|
+
numVertices=6,
|
|
388
|
+
radius=0.7 * radius * self.radius_dict[veritas] / self.radius_dict[lst],
|
|
389
|
+
orientation=np.deg2rad(30),
|
|
390
|
+
facecolor=self.colors_dict[veritas],
|
|
391
|
+
edgecolor=self.colors_dict[veritas],
|
|
392
|
+
transform=handlebox.get_transform(),
|
|
393
|
+
)
|
|
394
|
+
handlebox.add_artist(patch)
|
|
395
|
+
return patch
|
|
396
|
+
|
|
397
|
+
|
|
311
398
|
class MeanRadiusOuterEdgeHandler(object):
|
|
312
399
|
"""
|
|
313
400
|
Legend handler class to plot a the mean radius outer edge of the dish.
|
|
@@ -331,8 +418,27 @@ class MeanRadiusOuterEdgeHandler(object):
|
|
|
331
418
|
return patch
|
|
332
419
|
|
|
333
420
|
|
|
334
|
-
all_telescope_objects = {
|
|
335
|
-
|
|
421
|
+
all_telescope_objects = {
|
|
422
|
+
lst: LSTObject,
|
|
423
|
+
mst: MSTObject,
|
|
424
|
+
sct: SCTObject,
|
|
425
|
+
sst: SSTObject,
|
|
426
|
+
hess: HESSObject,
|
|
427
|
+
magic: MAGICObject,
|
|
428
|
+
veritas: VERITASObject,
|
|
429
|
+
}
|
|
430
|
+
all_telescope_handlers = {
|
|
431
|
+
lst: LSTHandler,
|
|
432
|
+
mst: MSTHandler,
|
|
433
|
+
sct: SCTHandler,
|
|
434
|
+
sst: SSTHandler,
|
|
435
|
+
hess: HESSHandler,
|
|
436
|
+
magic: MAGICHandler,
|
|
437
|
+
veritas: VERITASHandler,
|
|
438
|
+
}
|
|
336
439
|
legend_handler_map = {}
|
|
337
|
-
|
|
338
|
-
|
|
440
|
+
try:
|
|
441
|
+
for tel_type in names.all_telescope_class_names:
|
|
442
|
+
legend_handler_map[all_telescope_objects[tel_type]] = all_telescope_handlers[tel_type]
|
|
443
|
+
except KeyError:
|
|
444
|
+
pass
|
|
@@ -12,7 +12,7 @@ from cycler import cycler
|
|
|
12
12
|
from matplotlib import gridspec
|
|
13
13
|
from matplotlib.collections import PatchCollection
|
|
14
14
|
|
|
15
|
-
from simtools.utils import
|
|
15
|
+
from simtools.utils import geometry as transf
|
|
16
16
|
from simtools.utils import names
|
|
17
17
|
from simtools.utils.names import mst, sct
|
|
18
18
|
from simtools.visualization import legend_handlers as leg_h
|
|
@@ -22,9 +22,9 @@ __all__ = [
|
|
|
22
22
|
"get_lines",
|
|
23
23
|
"get_markers",
|
|
24
24
|
"get_telescope_patch",
|
|
25
|
-
"
|
|
25
|
+
"plot_1d",
|
|
26
26
|
"plot_array",
|
|
27
|
-
"
|
|
27
|
+
"plot_hist_2d",
|
|
28
28
|
"plot_table",
|
|
29
29
|
"set_style",
|
|
30
30
|
]
|
|
@@ -272,7 +272,7 @@ def get_lines():
|
|
|
272
272
|
return LINES
|
|
273
273
|
|
|
274
274
|
|
|
275
|
-
def
|
|
275
|
+
def plot_1d(data, **kwargs):
|
|
276
276
|
"""
|
|
277
277
|
Produce a high contrast one dimensional plot from multiple data sets. A ratio plot can be \
|
|
278
278
|
added at the bottom to allow easy comparison. Additional options, such as plot title, plot
|
|
@@ -481,10 +481,10 @@ def plot_table(table, y_title, **kwargs):
|
|
|
481
481
|
for column in table.keys()[1:]:
|
|
482
482
|
data_dict[column] = QTable([table[x_axis], table[column]], names=[x_axis, y_title])
|
|
483
483
|
|
|
484
|
-
return
|
|
484
|
+
return plot_1d(data_dict, **kwargs)
|
|
485
485
|
|
|
486
486
|
|
|
487
|
-
def
|
|
487
|
+
def plot_hist_2d(data, **kwargs):
|
|
488
488
|
"""
|
|
489
489
|
Produce a two dimensional histogram plot. Any option that can be changed after plotting (e.g.,\
|
|
490
490
|
axes limits, log scale, etc.) should be done using the returned plt instance.
|
|
@@ -511,7 +511,7 @@ def plot_hist_2D(data, **kwargs):
|
|
|
511
511
|
else:
|
|
512
512
|
title = ""
|
|
513
513
|
|
|
514
|
-
# Set default style since the usual options do not affect
|
|
514
|
+
# Set default style since the usual options do not affect 2d plots (for now).
|
|
515
515
|
set_style()
|
|
516
516
|
|
|
517
517
|
gs = gridspec.GridSpec(1, 1)
|
|
@@ -563,7 +563,7 @@ def get_telescope_patch(name, x, y, radius):
|
|
|
563
563
|
Instance of mpatches.Circle.
|
|
564
564
|
"""
|
|
565
565
|
tel_obj = leg_h.TelescopeHandler()
|
|
566
|
-
valid_name = names.
|
|
566
|
+
valid_name = names.get_telescope_class(name)
|
|
567
567
|
fill_flag = False
|
|
568
568
|
|
|
569
569
|
x = x.to(u.m)
|
|
@@ -627,13 +627,13 @@ def plot_array(telescopes, rotate_angle=0, show_tel_label=False):
|
|
|
627
627
|
legend_labels = []
|
|
628
628
|
tel_counters = {one_telescope: 0 for one_telescope in names.all_telescope_class_names}
|
|
629
629
|
if rotate_angle != 0:
|
|
630
|
-
pos_x_rotated, pos_y_rotated =
|
|
631
|
-
telescopes["
|
|
630
|
+
pos_x_rotated, pos_y_rotated = transf.rotate(
|
|
631
|
+
telescopes["position_x"], telescopes["position_y"], rotate_angle
|
|
632
632
|
)
|
|
633
633
|
else:
|
|
634
|
-
pos_x_rotated, pos_y_rotated = telescopes["
|
|
634
|
+
pos_x_rotated, pos_y_rotated = telescopes["position_x"], telescopes["position_y"]
|
|
635
635
|
|
|
636
|
-
pos_x_rotated, pos_y_rotated =
|
|
636
|
+
pos_x_rotated, pos_y_rotated = transf.rotate(pos_x_rotated, pos_y_rotated, 90 * u.deg)
|
|
637
637
|
|
|
638
638
|
if len(pos_x_rotated) > 30:
|
|
639
639
|
fontsize = 4
|
|
@@ -647,7 +647,7 @@ def plot_array(telescopes, rotate_angle=0, show_tel_label=False):
|
|
|
647
647
|
for tel_type in tel_counters:
|
|
648
648
|
if tel_type in tel_now["telescope_name"]:
|
|
649
649
|
tel_counters[tel_type] += 1
|
|
650
|
-
i_tel_name = names.
|
|
650
|
+
i_tel_name = names.get_telescope_class(telescopes[i_tel]["telescope_name"])
|
|
651
651
|
patches.append(
|
|
652
652
|
get_telescope_patch(
|
|
653
653
|
i_tel_name,
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
simtools/__init__.py,sha256=yvx0i5ygbllmMtF2Tzy7pohvhQNH_dBdj0Bt8bKFYpc,231
|
|
2
|
-
simtools/_version.py,sha256=d4lWkB7Jtv-a_y1raRjfA2309LsV73tQCinVV-F9tv8,160
|
|
3
|
-
simtools/camera_efficiency.py,sha256=Kpj0XOZ7bWUqR1TQY_7q0uHry_hrRicgsr8CgvIE3S4,17879
|
|
4
|
-
simtools/db_handler.py,sha256=VBhYfoIx0VV-3z6dPm5o0_3vhH8pJwXtYjJJ5TEoSTo,46955
|
|
5
|
-
simtools/io_handler.py,sha256=2fuOh119SdV74jHGiYHrsd_luhASYCq0LkFKpFzNWcw,4207
|
|
6
|
-
simtools/psf_analysis.py,sha256=7w_fVKPGhut8ofp_RaJHwYiNh8FoRqOqKB93pSEWXTU,14475
|
|
7
|
-
simtools/ray_tracing.py,sha256=ce52aoNxXAo5pcz8T4sP6Mx-_wRc8UkOtGxrlxbYv9Q,17199
|
|
8
|
-
simtools/simulator.py,sha256=r2N9hWDCsrPbvvgO-83goWKemp_BlsZeb1nu3qjKxDM,26288
|
|
9
|
-
simtools/version.py,sha256=QH3JDagS1ROImltyE_xRzRZlDxIr90poVpXToqNQUFI,595
|
|
10
|
-
simtools/_dev_version/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
simtools/_dev_version/scm_version.py,sha256=o3HfXziUHq0iIHUQm1RBv_8HDEpckXHFl0kYgmmwdAA,375
|
|
12
|
-
simtools/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
-
simtools/applications/add_file_to_db.py,sha256=rbZ2MLynqXyWh9fqKquL9vkqnz-Ul3ImPIrr2ZiqOjE,4997
|
|
14
|
-
simtools/applications/compare_cumulative_psf.py,sha256=yiFd2oldOiiz41Qh5fqs932cRJGB8GMebLj0sE3ZYPs,6772
|
|
15
|
-
simtools/applications/derive_mirror_rnda.py,sha256=ocs1AoGQKBZ1CKaIkEl-N9jY0ErH_kIwtkIhtQU7ev8,15104
|
|
16
|
-
simtools/applications/generate_corsika_histograms.py,sha256=6DaFUP2QIoKhnZgGj9ft-qkABk6EH2A4kHyZMpwKTIA,15189
|
|
17
|
-
simtools/applications/get_file_from_db.py,sha256=dr66mSmbv0StsZph-lisPmW3Fdccv-rEWGPJTuC5JUY,2921
|
|
18
|
-
simtools/applications/get_parameter.py,sha256=bmTbl9NAIEgXsWXYyYRNcozygTSWsiBphCNN0C_BSaE,2880
|
|
19
|
-
simtools/applications/make_regular_arrays.py,sha256=VAEVoAfAl147pJe0yceQ4FQk8a8FMIF2VRl2cSSWWjc,5759
|
|
20
|
-
simtools/applications/plot_layout_array.py,sha256=K-NJZv5nMl7lDSsF1RjD3Hap-hIQJb4siLZ-cqFzBwc,6326
|
|
21
|
-
simtools/applications/plot_simtel_histograms.py,sha256=-7zcWYbW6RPJoDOGKO1ZMi8u3f1Ad_oanEORDkgn2kQ,3746
|
|
22
|
-
simtools/applications/print_array_elements.py,sha256=1ecPKGtZVxWQMhx2ZHAwpGCMyhWi9b2B2sX7XF4fYSs,3989
|
|
23
|
-
simtools/applications/produce_array_config.py,sha256=AnioMEsW7TZ6RxmPgsa1YOW1DAWmdWdnmPLHJv-Yl78,4142
|
|
24
|
-
simtools/applications/production.py,sha256=gcMeOGQ3D3QaTAxmbwUW7tmb9pEpba9WzJxSDUrcLvQ,9172
|
|
25
|
-
simtools/applications/sim_showers_for_trigger_rates.py,sha256=aQfs3fd5prGgFLeZ5Y8tLM2h5HphU2z5w6sC6C21274,6638
|
|
26
|
-
simtools/applications/simulate_prod.py,sha256=CCkk_Pxk_sJorvGwNNdi603mNGcp4IBNJOP5OGDsOh8,13012
|
|
27
|
-
simtools/applications/submit_data_from_external.py,sha256=FU6hPN5VyL8Ji-r2G0R8qfLepRZQR8ulqnO1U8d7mqA,3134
|
|
28
|
-
simtools/applications/tune_psf.py,sha256=Ob6aH0OKrMYazcps8Gj46-gkBF8ciT7V3zDh7-rTt0s,11575
|
|
29
|
-
simtools/applications/validate_camera_efficiency.py,sha256=jcD8-m2oMPxVEGzyhiKKE7P2nqiRS2tbkbUO68Vqy-I,4188
|
|
30
|
-
simtools/applications/validate_camera_fov.py,sha256=H4gnj_nwFeYe5zJ1EJGdApmW6q2HuHHZ40V6_EDZ-bI,4899
|
|
31
|
-
simtools/applications/validate_optics.py,sha256=MrcKAEPBfGlsh8ealE2zar0jRIqXedcNxG1vRUaGR5M,6617
|
|
32
|
-
simtools/applications/validate_schema_files.py,sha256=HgpqqQVVMpoSVJoHA1sct_CNx3BgmKP7f-YNMHohuXQ,3013
|
|
33
|
-
simtools/applications/db_development_tools/add_new_parameter_to_db.py,sha256=K4rdaXii-v7hOPveF6dh8zb5tZCPu6AzPeIkPS8NHJE,2565
|
|
34
|
-
simtools/applications/db_development_tools/add_unit_to_parameter_in_db.py,sha256=eqcV_yFyaOl8GOEtQozY09J_IKFy9OtRNVekIcuX0m4,1809
|
|
35
|
-
simtools/applications/db_development_tools/mark_non_optics_parameters_non_applicable.py,sha256=-0ImMFRyHmhB9XGA9pgXHe2laqQo1EoL9Zy13e92Ogs,3001
|
|
36
|
-
simtools/configuration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
37
|
-
simtools/configuration/commandline_parser.py,sha256=ofgOTFGm7tPf-xtg_LHxIGVcMxyMXPSwMDGzbbr6Lec,12519
|
|
38
|
-
simtools/configuration/configurator.py,sha256=8VO6J8nw3NxIISjPgF4H_ajrFTAZqbFjrDeCra_3D3w,12160
|
|
39
|
-
simtools/corsika/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
|
-
simtools/corsika/corsika_config.py,sha256=u-X5lu_GdkdrcaVxMEtAiFf2IuuIzBXtenIcp4cl4f0,19175
|
|
41
|
-
simtools/corsika/corsika_histograms.py,sha256=dZVqVvx3uIkxcji6djL543DSM7eAo3aGU_iveMrUOKQ,65160
|
|
42
|
-
simtools/corsika/corsika_histograms_visualize.py,sha256=9pQqy0iw5l9gEC46KsGGSNtUFGWNvqflmZgwNjLMa1I,18733
|
|
43
|
-
simtools/corsika/corsika_output_visualize.py,sha256=Hi-K58pxMQ_DSII-35Ow6etx3cBo0SUcDiRTXJgi6LE,12080
|
|
44
|
-
simtools/corsika/corsika_runner.py,sha256=_qypZytK4_WWw_d052hj-6twhPKwR_BG93FIG2cLS3I,16871
|
|
45
|
-
simtools/corsika_simtel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
46
|
-
simtools/corsika_simtel/corsika_simtel_runner.py,sha256=W_GXKulDpgXytaxjvmBtrJ8vTwA5Y9QLug75s-a7UtU,7804
|
|
47
|
-
simtools/data_model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
|
-
simtools/data_model/metadata_collector.py,sha256=oMjOVkVR7wv2NnvAc8Z2g4t9Gkz5qoAWW5Q_Ffi05aI,10245
|
|
49
|
-
simtools/data_model/metadata_model.py,sha256=Po2k734pm9nMtqVRYaCLEnI73TKZHja-MFPZ9I0frc8,8151
|
|
50
|
-
simtools/data_model/model_data_writer.py,sha256=p-yYgkQ8E9QxhSmnb7MWCMvE1GFwM4snTncNMX4mBhg,3882
|
|
51
|
-
simtools/data_model/validate_data.py,sha256=4t2P6XaV3i3le0itsggfllac7TVLNPKN65_1SzVyt4A,16980
|
|
52
|
-
simtools/data_model/validate_schema.py,sha256=Fqt3lpmwOulSjvDYlFNJIf-wXIG_BoExkBu7hxgJ8kE,8542
|
|
53
|
-
simtools/job_execution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
54
|
-
simtools/job_execution/job_manager.py,sha256=zj9cJLzY-I-_gNp42ClSBjoOzaczH8CYfdgJ5CCLoew,6048
|
|
55
|
-
simtools/layout/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
56
|
-
simtools/layout/layout_array.py,sha256=pCSjENXIGNLTaz5qKGAkq7m8knuC4LDZYZYvLCgW0Z0,31305
|
|
57
|
-
simtools/layout/telescope_position.py,sha256=_IMfwpKgWlp7ruQkqr_MZtETZMG6nTomAEwtXhS6rS4,17361
|
|
58
|
-
simtools/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
59
|
-
simtools/model/array_model.py,sha256=qCl3SH07b1gtRQlrQU4_zKBfKwttdK7Wh4cDDhINLUQ,14179
|
|
60
|
-
simtools/model/camera.py,sha256=ZOJhfMcRY5J8SQNZVAVFro4P7arHGzJkOGE1wi1Ic58,30775
|
|
61
|
-
simtools/model/mirrors.py,sha256=jU13bG7kp5yQrxp6_hT5bVFVh0TbyCOAA4RtcjH32pw,5266
|
|
62
|
-
simtools/model/model_utils.py,sha256=YrKl96I3pb3WzNkQLlejHMq5w-XwFMvfu5xlsED12P0,3748
|
|
63
|
-
simtools/model/telescope_model.py,sha256=_yDh7XGfRsTd6EHBNOcWR9ZmR2lJlAXs-CMUxpth6rM,29204
|
|
64
|
-
simtools/simtel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
65
|
-
simtools/simtel/simtel_config_writer.py,sha256=DYVEt6-pZtFRgvbbh1YmEVz3wwuMMncptjQh07NbqV4,7903
|
|
66
|
-
simtools/simtel/simtel_events.py,sha256=YzIvZ0p96LclPBCGfw1zzRGIMjgVnh4xIurzYokM8q4,9091
|
|
67
|
-
simtools/simtel/simtel_histograms.py,sha256=0SDlmKnL_kQN-ETQC7-L3pCIxPRorxN0FOUZs39rKR4,7262
|
|
68
|
-
simtools/simtel/simtel_runner.py,sha256=W16jA7epT4LXIDVoz76tBaHNln5haToY_Art7NscC_g,7489
|
|
69
|
-
simtools/simtel/simtel_runner_array.py,sha256=f_AQvE4YwIg1j-RVjvPPqWg8-yofKgje8IUqHz6R_ww,10426
|
|
70
|
-
simtools/simtel/simtel_runner_camera_efficiency.py,sha256=zUggzjYxcqjJBBjDJDH8DqtVvSWDhq9731jWEdSzm78,8244
|
|
71
|
-
simtools/simtel/simtel_runner_ray_tracing.py,sha256=fkLyfxVeyEv49xGQWASsWmO110IAGGEA3lNbs3hs4Kg,10031
|
|
72
|
-
simtools/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
|
-
simtools/utils/general.py,sha256=bfNbGVpxpcNBXeWS00AkIB6NkcwESKe0VAC4CiuLnTs,28736
|
|
74
|
-
simtools/utils/names.py,sha256=qiqgpQH3tgQa_LSnPU0tlqnoGO9DeDqds9odB_Imj2U,18192
|
|
75
|
-
simtools/visualization/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
|
-
simtools/visualization/legend_handlers.py,sha256=ItWeTvwrXi7-ZMv3ZEyTdO832zFMPB7IGYDuK90LujE,9737
|
|
77
|
-
simtools/visualization/visualize.py,sha256=9W-7l1uTtuPw_CQxrMvRnvyJWvZXXIs1PIR_G2JGczc,21783
|
|
78
|
-
gammasimtools-0.5.1.dist-info/LICENSE,sha256=idBrtxX6eQcUlG0YBTx-O2RNKNKg1Gidb8OQf9q0X7s,1543
|
|
79
|
-
gammasimtools-0.5.1.dist-info/METADATA,sha256=EqlVxeU00ZpLjrQ54ohGQP5KOXbt9BCcQJIh8ANO6Nk,6090
|
|
80
|
-
gammasimtools-0.5.1.dist-info/WHEEL,sha256=5sUXSg9e4bi7lTLOHcm6QEYwO5TIF1TNbTSVFVjcJcc,92
|
|
81
|
-
gammasimtools-0.5.1.dist-info/entry_points.txt,sha256=IXTMPrGSRbZg5Hy9Uqx09L_iPemB2L2uWyU5joAcAE4,1566
|
|
82
|
-
gammasimtools-0.5.1.dist-info/top_level.txt,sha256=9Yi7Q7aQX6alvpP2YGQtIYo208wdGkXUApHboEdj-ys,9
|
|
83
|
-
gammasimtools-0.5.1.dist-info/RECORD,,
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python3
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Summary
|
|
5
|
-
-------
|
|
6
|
-
This application plots and prints sim_telarray histograms into pdf file.
|
|
7
|
-
It accepts multiple lists of histograms files that are plot together,
|
|
8
|
-
side-by-side. Each histogram is plotted in a page of the pdf.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
Command line arguments
|
|
12
|
-
----------------------
|
|
13
|
-
file_lists (str, required)
|
|
14
|
-
Text file containing the list of sim_telarray histogram files to be plotted. \
|
|
15
|
-
Multiple text files can be given.
|
|
16
|
-
figure_name (str, required)
|
|
17
|
-
File name for the pdf output (without extension).
|
|
18
|
-
verbosity (str, optional)
|
|
19
|
-
Log level to print (default=INFO).
|
|
20
|
-
|
|
21
|
-
Example
|
|
22
|
-
-------
|
|
23
|
-
.. code-block:: console
|
|
24
|
-
|
|
25
|
-
simtools-plot-simtel-histograms \
|
|
26
|
-
--file_lists list_test1.txt list_test2.txt --figure_name histograms_comparison
|
|
27
|
-
|
|
28
|
-
"""
|
|
29
|
-
|
|
30
|
-
import logging
|
|
31
|
-
from pathlib import Path
|
|
32
|
-
|
|
33
|
-
import matplotlib.pyplot as plt
|
|
34
|
-
from matplotlib.backends.backend_pdf import PdfPages
|
|
35
|
-
|
|
36
|
-
import simtools.utils.general as gen
|
|
37
|
-
from simtools.configuration import configurator
|
|
38
|
-
from simtools.simtel.simtel_histograms import SimtelHistograms
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def main():
|
|
42
|
-
config = configurator.Configurator(
|
|
43
|
-
label=Path(__file__).stem,
|
|
44
|
-
description=("Plots sim_telarray histograms."),
|
|
45
|
-
)
|
|
46
|
-
config.parser.add_argument(
|
|
47
|
-
"--file_lists",
|
|
48
|
-
help="File containing the list of histogram files to be plotted.",
|
|
49
|
-
nargs="+",
|
|
50
|
-
type=str,
|
|
51
|
-
required=True,
|
|
52
|
-
)
|
|
53
|
-
config.parser.add_argument(
|
|
54
|
-
"--figure_name", help="File name for the pdf output.", type=str, required=True
|
|
55
|
-
)
|
|
56
|
-
|
|
57
|
-
args_dict, _ = config.initialize()
|
|
58
|
-
|
|
59
|
-
logger = logging.getLogger()
|
|
60
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
61
|
-
|
|
62
|
-
n_lists = len(args_dict["file_lists"])
|
|
63
|
-
simtel_histograms = []
|
|
64
|
-
for this_list_of_files in args_dict["file_lists"]:
|
|
65
|
-
# Collecting hist files
|
|
66
|
-
histogram_files = []
|
|
67
|
-
with open(this_list_of_files, encoding="utf-8") as file:
|
|
68
|
-
for line in file:
|
|
69
|
-
# Removing '\n' from filename, in case it is left there.
|
|
70
|
-
histogram_files.append(line.replace("\n", ""))
|
|
71
|
-
|
|
72
|
-
# Building SimtelHistograms
|
|
73
|
-
sh = SimtelHistograms(histogram_files)
|
|
74
|
-
simtel_histograms.append(sh)
|
|
75
|
-
|
|
76
|
-
# Checking if number of histograms is consistent
|
|
77
|
-
number_of_hists = [sh.number_of_histograms for sh in simtel_histograms]
|
|
78
|
-
# Converting list to set will remove the duplicated entries.
|
|
79
|
-
# If all entries in the list are the same, len(set) will be 1
|
|
80
|
-
if len(set(number_of_hists)) > 1:
|
|
81
|
-
msg = (
|
|
82
|
-
"Number of histograms in different sets of simulations is inconsistent"
|
|
83
|
-
" - please make sure the simulations sets are consistent"
|
|
84
|
-
)
|
|
85
|
-
logger.error(msg)
|
|
86
|
-
raise IOError(msg)
|
|
87
|
-
|
|
88
|
-
# Plotting
|
|
89
|
-
|
|
90
|
-
# Checking if it is needed to add the pdf extension to the file name
|
|
91
|
-
if args_dict["figure_name"].split(".")[-1] == "pdf":
|
|
92
|
-
fig_name = args_dict["figure_name"]
|
|
93
|
-
else:
|
|
94
|
-
fig_name = args_dict["figure_name"] + ".pdf"
|
|
95
|
-
|
|
96
|
-
pdf_pages = PdfPages(fig_name)
|
|
97
|
-
for i_hist in range(number_of_hists[0]):
|
|
98
|
-
title = simtel_histograms[0].get_histogram_title(i_hist)
|
|
99
|
-
|
|
100
|
-
logger.debug(f"Processing: {title}")
|
|
101
|
-
|
|
102
|
-
fig, axs = plt.subplots(1, n_lists, figsize=(6 * n_lists, 6))
|
|
103
|
-
|
|
104
|
-
if n_lists == 1:
|
|
105
|
-
# If only one simulation set, axs is a single axes (not iterable)
|
|
106
|
-
sh.plot_one_histogram(i_hist, axs)
|
|
107
|
-
else:
|
|
108
|
-
for sh, ax in zip(simtel_histograms, axs):
|
|
109
|
-
sh.plot_one_histogram(i_hist, ax)
|
|
110
|
-
|
|
111
|
-
plt.tight_layout()
|
|
112
|
-
pdf_pages.savefig(fig)
|
|
113
|
-
plt.clf()
|
|
114
|
-
|
|
115
|
-
plt.close()
|
|
116
|
-
pdf_pages.close()
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
if __name__ == "__main__":
|
|
120
|
-
main()
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python3
|
|
2
|
-
"""
|
|
3
|
-
Summary
|
|
4
|
-
-------
|
|
5
|
-
Validate parameter description files using a json schema file.
|
|
6
|
-
|
|
7
|
-
Command line arguments
|
|
8
|
-
----------------------
|
|
9
|
-
file_name (str)
|
|
10
|
-
input file to be validated
|
|
11
|
-
schema (str)
|
|
12
|
-
schema file (jsonschema format) used for validation
|
|
13
|
-
|
|
14
|
-
Example
|
|
15
|
-
-------
|
|
16
|
-
|
|
17
|
-
.. code-block:: console
|
|
18
|
-
|
|
19
|
-
simtools-validate-schema-file \
|
|
20
|
-
--file_name tests/resources/MST_mirror_2f_measurements.schema.yml \
|
|
21
|
-
--schema jsonschema.yml
|
|
22
|
-
|
|
23
|
-
"""
|
|
24
|
-
|
|
25
|
-
import logging
|
|
26
|
-
from pathlib import Path
|
|
27
|
-
|
|
28
|
-
import jsonschema
|
|
29
|
-
import yaml
|
|
30
|
-
|
|
31
|
-
import simtools.utils.general as gen
|
|
32
|
-
from simtools.configuration import configurator
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def _parse(label, description):
|
|
36
|
-
"""
|
|
37
|
-
Parse command line configuration
|
|
38
|
-
|
|
39
|
-
Parameters
|
|
40
|
-
----------
|
|
41
|
-
label (str)
|
|
42
|
-
application label
|
|
43
|
-
description (str)
|
|
44
|
-
application description
|
|
45
|
-
|
|
46
|
-
Returns
|
|
47
|
-
-------
|
|
48
|
-
config (Configurator)
|
|
49
|
-
application configuration
|
|
50
|
-
|
|
51
|
-
"""
|
|
52
|
-
|
|
53
|
-
config = configurator.Configurator(label=label, description=description)
|
|
54
|
-
config.parser.add_argument("--file_name", help="file to be validated", required=True)
|
|
55
|
-
config.parser.add_argument("--schema", help="json schema file", required=True)
|
|
56
|
-
return config.initialize()
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def load_schema(schema_file):
|
|
60
|
-
"""
|
|
61
|
-
Load parameter schema from file.
|
|
62
|
-
|
|
63
|
-
Parameters
|
|
64
|
-
----------
|
|
65
|
-
schema_file (str)
|
|
66
|
-
schema file
|
|
67
|
-
|
|
68
|
-
Returns
|
|
69
|
-
-------
|
|
70
|
-
parameter_schema (dict)
|
|
71
|
-
parameter schema
|
|
72
|
-
|
|
73
|
-
Raises
|
|
74
|
-
------
|
|
75
|
-
FileNotFoundError
|
|
76
|
-
if schema file is not found
|
|
77
|
-
|
|
78
|
-
"""
|
|
79
|
-
|
|
80
|
-
try:
|
|
81
|
-
with open(schema_file, "r", encoding="utf-8") as file:
|
|
82
|
-
parameter_schema = yaml.safe_load(file)
|
|
83
|
-
except FileNotFoundError:
|
|
84
|
-
logging.error(f"Schema file {schema_file} not found")
|
|
85
|
-
raise
|
|
86
|
-
|
|
87
|
-
return parameter_schema
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
def validate_schema_file(input_file, schema, logger):
|
|
91
|
-
"""
|
|
92
|
-
Validate parameter file against schema.
|
|
93
|
-
|
|
94
|
-
Parameters
|
|
95
|
-
----------
|
|
96
|
-
input_file (str)
|
|
97
|
-
input file to be validated
|
|
98
|
-
schema (dict)
|
|
99
|
-
schema used for validation
|
|
100
|
-
|
|
101
|
-
Raises
|
|
102
|
-
------
|
|
103
|
-
FileNotFoundError
|
|
104
|
-
if input file is not found
|
|
105
|
-
|
|
106
|
-
"""
|
|
107
|
-
|
|
108
|
-
try:
|
|
109
|
-
with open(input_file, "r", encoding="utf-8") as file:
|
|
110
|
-
data = yaml.safe_load(file)
|
|
111
|
-
except FileNotFoundError:
|
|
112
|
-
logger.error(f"Input file {input_file} not found")
|
|
113
|
-
raise
|
|
114
|
-
|
|
115
|
-
try:
|
|
116
|
-
jsonschema.validate(data, schema=schema)
|
|
117
|
-
except jsonschema.exceptions.ValidationError:
|
|
118
|
-
logger.error(f"Schema validation failed for {input_file} using {schema}")
|
|
119
|
-
raise
|
|
120
|
-
|
|
121
|
-
logger.info(f"Schema validation successful for {input_file}")
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def main():
|
|
125
|
-
label = Path(__file__).stem
|
|
126
|
-
args_dict, _ = _parse(label, description="Parameter file schema checking")
|
|
127
|
-
|
|
128
|
-
logger = logging.getLogger()
|
|
129
|
-
logger.setLevel(gen.get_log_level_from_user(args_dict["log_level"]))
|
|
130
|
-
|
|
131
|
-
validate_schema_file(args_dict["file_name"], load_schema(args_dict["schema"]), logger)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if __name__ == "__main__":
|
|
135
|
-
main()
|