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,10 +1,15 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import logging
|
|
3
|
+
import re
|
|
3
4
|
from pathlib import Path
|
|
4
5
|
|
|
5
6
|
__all__ = ["IOHandlerSingleton", "IOHandler"]
|
|
6
7
|
|
|
7
8
|
|
|
9
|
+
class IncompleteIOHandlerInit(Exception):
|
|
10
|
+
"""Exception raised when IOHandler is not initialized"""
|
|
11
|
+
|
|
12
|
+
|
|
8
13
|
class IOHandlerSingleton(type):
|
|
9
14
|
"""
|
|
10
15
|
Singleton base class
|
|
@@ -45,11 +50,11 @@ class IOHandler(metaclass=IOHandlerSingleton):
|
|
|
45
50
|
Parameters
|
|
46
51
|
----------
|
|
47
52
|
output_path: str or Path
|
|
48
|
-
|
|
53
|
+
Path pointing to the output directory.
|
|
49
54
|
data_path: str or Path
|
|
50
|
-
|
|
55
|
+
Path pointing to the data files (e.g., CORSIKA or sim_telarray output).
|
|
51
56
|
model_path: str or Path
|
|
52
|
-
|
|
57
|
+
Path pointing to the model file directory.
|
|
53
58
|
use_plain_output_path: bool
|
|
54
59
|
Use plain output path without adding tool name and date
|
|
55
60
|
|
|
@@ -59,18 +64,22 @@ class IOHandler(metaclass=IOHandlerSingleton):
|
|
|
59
64
|
self.data_path = data_path
|
|
60
65
|
self.model_path = model_path
|
|
61
66
|
|
|
62
|
-
def get_output_directory(self, label=None,
|
|
67
|
+
def get_output_directory(self, label=None, sub_dir=None, dir_type="simtools"):
|
|
63
68
|
"""
|
|
64
|
-
|
|
69
|
+
Return path to output directory
|
|
65
70
|
|
|
66
71
|
Parameters
|
|
67
72
|
----------
|
|
68
73
|
label: str
|
|
69
74
|
Instance label.
|
|
70
|
-
|
|
75
|
+
sub_dir: str
|
|
71
76
|
Name of the subdirectory (ray-tracing, model etc)
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
dir_type: str
|
|
78
|
+
The type of directory (e.g., 'simtools', 'test', 'simtools-result').
|
|
79
|
+
If 'simtools-result' is used, the output directory will be returned
|
|
80
|
+
without appending a subdirectory string when using the
|
|
81
|
+
use_plain_output_path option. For the cause of not using use_plain_output_path,
|
|
82
|
+
output paths appended by 'simtools-output'.
|
|
74
83
|
|
|
75
84
|
Returns
|
|
76
85
|
-------
|
|
@@ -80,21 +89,30 @@ class IOHandler(metaclass=IOHandlerSingleton):
|
|
|
80
89
|
------
|
|
81
90
|
FileNotFoundError
|
|
82
91
|
if error creating directory
|
|
92
|
+
TypeError
|
|
93
|
+
raised for errors while creating directory name
|
|
83
94
|
"""
|
|
84
95
|
|
|
85
96
|
if self.use_plain_output_path:
|
|
86
97
|
path = Path(self.output_path)
|
|
87
98
|
else:
|
|
88
|
-
if
|
|
89
|
-
output_directory_prefix = Path(self.output_path)
|
|
99
|
+
if str(self.output_path).endswith("-output"):
|
|
100
|
+
output_directory_prefix = Path(self.output_path)
|
|
90
101
|
else:
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
102
|
+
try:
|
|
103
|
+
output_directory_prefix = Path(self.output_path).joinpath(
|
|
104
|
+
re.sub(r"\-result$", "", dir_type) + "-output"
|
|
105
|
+
)
|
|
106
|
+
except TypeError:
|
|
107
|
+
self._logger.error(f"Error creating output directory name from {dir_type}")
|
|
108
|
+
raise
|
|
109
|
+
label_dir = label if label is not None else "d-" + str(datetime.date.today())
|
|
95
110
|
path = output_directory_prefix.joinpath(label_dir)
|
|
96
|
-
|
|
97
|
-
|
|
111
|
+
if sub_dir is not None:
|
|
112
|
+
if not self.use_plain_output_path:
|
|
113
|
+
path = path.joinpath(sub_dir)
|
|
114
|
+
elif dir_type != "simtools-result":
|
|
115
|
+
path = path.joinpath(sub_dir)
|
|
98
116
|
|
|
99
117
|
try:
|
|
100
118
|
path.mkdir(parents=True, exist_ok=True)
|
|
@@ -104,7 +122,7 @@ class IOHandler(metaclass=IOHandlerSingleton):
|
|
|
104
122
|
|
|
105
123
|
return path.absolute()
|
|
106
124
|
|
|
107
|
-
def get_output_file(self, file_name, label=None,
|
|
125
|
+
def get_output_file(self, file_name, label=None, sub_dir=None, dir_type="simtools"):
|
|
108
126
|
"""
|
|
109
127
|
Get path of an output file.
|
|
110
128
|
|
|
@@ -114,17 +132,20 @@ class IOHandler(metaclass=IOHandlerSingleton):
|
|
|
114
132
|
File name.
|
|
115
133
|
label: str
|
|
116
134
|
Instance label.
|
|
117
|
-
|
|
135
|
+
sub_dir: str
|
|
118
136
|
Name of the subdirectory (ray-tracing, model etc)
|
|
119
|
-
|
|
120
|
-
|
|
137
|
+
dir_type: str
|
|
138
|
+
Directory type (e.g., 'simtools', 'test', 'simtools-result')
|
|
139
|
+
If 'simtools-result' is used, the output directory will be returned
|
|
140
|
+
without appending a subdirectory string when using the
|
|
141
|
+
use_plain_output_path option.
|
|
121
142
|
|
|
122
143
|
Returns
|
|
123
144
|
-------
|
|
124
145
|
Path
|
|
125
146
|
"""
|
|
126
147
|
return (
|
|
127
|
-
self.get_output_directory(label=label,
|
|
148
|
+
self.get_output_directory(label=label, sub_dir=sub_dir, dir_type=dir_type)
|
|
128
149
|
.joinpath(file_name)
|
|
129
150
|
.absolute()
|
|
130
151
|
)
|
|
@@ -145,10 +166,18 @@ class IOHandler(metaclass=IOHandlerSingleton):
|
|
|
145
166
|
Returns
|
|
146
167
|
-------
|
|
147
168
|
Path
|
|
169
|
+
|
|
170
|
+
Raises
|
|
171
|
+
------
|
|
172
|
+
IncompleteIOHandlerInit
|
|
173
|
+
if data_path is not set
|
|
174
|
+
|
|
148
175
|
"""
|
|
149
176
|
|
|
150
177
|
if test:
|
|
151
178
|
file_prefix = Path("tests/resources/")
|
|
152
|
-
|
|
179
|
+
elif self.data_path is not None:
|
|
153
180
|
file_prefix = Path(self.data_path).joinpath(parent_dir)
|
|
181
|
+
else:
|
|
182
|
+
raise IncompleteIOHandlerInit
|
|
154
183
|
return file_prefix.joinpath(file_name).absolute()
|
|
@@ -81,7 +81,7 @@ class JobManager:
|
|
|
81
81
|
Parameters
|
|
82
82
|
----------
|
|
83
83
|
run_script: str
|
|
84
|
-
Shell script
|
|
84
|
+
Shell script describing the job to be submitted.
|
|
85
85
|
run_out_file: str or Path
|
|
86
86
|
Redirect output/error/job stream to this file (out,err,job suffix).
|
|
87
87
|
log_file: str or Path
|