gammasimtools 0.25.0__py3-none-any.whl → 0.27.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.27.0.dist-info}/METADATA +6 -1
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.27.0.dist-info}/RECORD +135 -130
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.27.0.dist-info}/WHEEL +1 -1
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.27.0.dist-info}/entry_points.txt +3 -2
- {gammasimtools-0.25.0.dist-info → gammasimtools-0.27.0.dist-info}/licenses/LICENSE +1 -1
- simtools/_version.py +2 -2
- simtools/application_control.py +35 -7
- simtools/applications/convert_geo_coordinates_of_array_elements.py +3 -3
- 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 +3 -7
- 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/{calculate_incident_angles.py → derive_incident_angle.py} +16 -18
- simtools/applications/derive_mirror_rnda.py +112 -180
- 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 +79 -229
- simtools/applications/generate_regular_arrays.py +76 -69
- 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 +3 -15
- simtools/applications/simulate_illuminator.py +2 -11
- simtools/applications/simulate_pedestals.py +1 -5
- simtools/applications/simulate_prod.py +8 -11
- simtools/applications/simulate_prod_htcondor_generator.py +1 -1
- simtools/applications/submit_array_layouts.py +2 -4
- simtools/applications/submit_data_from_external.py +2 -1
- simtools/applications/submit_model_parameter_from_external.py +1 -3
- simtools/applications/validate_camera_efficiency.py +28 -28
- simtools/applications/validate_camera_fov.py +0 -1
- simtools/applications/validate_cumulative_psf.py +1 -5
- simtools/applications/validate_optics.py +2 -14
- simtools/atmosphere.py +83 -0
- simtools/camera/camera_efficiency.py +171 -53
- simtools/camera/single_photon_electron_spectrum.py +8 -7
- simtools/configuration/commandline_parser.py +82 -11
- simtools/configuration/configurator.py +6 -11
- simtools/constants.py +5 -0
- simtools/corsika/corsika_config.py +100 -202
- simtools/corsika/corsika_histograms.py +561 -1708
- 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 +59 -64
- simtools/data_model/schema.py +2 -0
- simtools/data_model/validate_data.py +1 -3
- simtools/db/db_handler.py +23 -10
- simtools/db/mongo_db.py +2 -2
- simtools/dependencies.py +81 -38
- simtools/io/ascii_handler.py +55 -5
- simtools/io/io_handler.py +23 -12
- simtools/io/table_handler.py +1 -1
- simtools/job_execution/job_manager.py +154 -79
- simtools/job_execution/process_pool.py +137 -0
- simtools/layout/array_layout.py +4 -13
- simtools/layout/array_layout_utils.py +348 -57
- simtools/model/array_model.py +23 -63
- simtools/model/calibration_model.py +4 -8
- simtools/model/legacy_model_parameter.py +134 -0
- simtools/model/model_parameter.py +147 -86
- simtools/model/model_utils.py +40 -6
- simtools/model/site_model.py +4 -8
- simtools/model/telescope_model.py +10 -16
- simtools/production_configuration/derive_corsika_limits.py +6 -11
- simtools/production_configuration/interpolation_handler.py +16 -16
- simtools/ray_tracing/incident_angles.py +92 -17
- simtools/ray_tracing/mirror_panel_psf.py +338 -222
- simtools/ray_tracing/psf_analysis.py +62 -48
- simtools/ray_tracing/psf_parameter_optimisation.py +3 -3
- simtools/ray_tracing/ray_tracing.py +43 -25
- simtools/reporting/docs_auto_report_generator.py +8 -13
- simtools/reporting/docs_read_parameters.py +2 -8
- simtools/runners/corsika_runner.py +52 -195
- simtools/runners/corsika_simtel_runner.py +77 -108
- simtools/runners/runner_services.py +214 -213
- simtools/runners/simtel_runner.py +27 -160
- simtools/runners/simtools_runner.py +11 -73
- simtools/schemas/application_workflow.metaschema.yml +8 -0
- simtools/settings.py +173 -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 -91
- simtools/simtel/simtel_seeds.py +184 -0
- simtools/simtel/simtel_table_reader.py +6 -4
- simtools/simtel/simulator_array.py +114 -109
- simtools/simtel/simulator_camera_efficiency.py +68 -46
- simtools/simtel/simulator_light_emission.py +164 -132
- simtools/simtel/simulator_ray_tracing.py +80 -71
- simtools/simulator.py +137 -355
- 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 +14 -12
- simtools/testing/validate_output.py +121 -42
- simtools/utils/general.py +43 -17
- simtools/utils/geometry.py +0 -77
- simtools/utils/names.py +5 -5
- simtools/utils/random.py +36 -0
- simtools/visualization/legend_handlers.py +7 -6
- simtools/visualization/plot_array_layout.py +91 -16
- simtools/visualization/plot_corsika_histograms.py +145 -605
- simtools/visualization/plot_incident_angles.py +48 -1
- simtools/visualization/plot_mirrors.py +1 -4
- simtools/visualization/plot_pixels.py +2 -4
- simtools/visualization/plot_psf.py +160 -19
- 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.27.0.dist-info}/top_level.txt +0 -0
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python3
|
|
2
|
-
"""
|
|
3
|
-
Read array element positions from file and add them to model repository.
|
|
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
|
-
Command line arguments
|
|
9
|
-
|
|
10
|
-
input : str
|
|
11
|
-
File containing a table of array element positions.
|
|
12
|
-
repository_path : str
|
|
13
|
-
Path of local copy of model parameter repository.
|
|
14
|
-
parameter_version : str
|
|
15
|
-
Parameter version.
|
|
16
|
-
site : str
|
|
17
|
-
Observatory site.
|
|
18
|
-
coordinate_system : str
|
|
19
|
-
Coordinate system of array element positions (ground or utm).
|
|
20
|
-
|
|
21
|
-
Examples
|
|
22
|
-
--------
|
|
23
|
-
Add array element positions to repository:
|
|
24
|
-
|
|
25
|
-
.. code-block:: console
|
|
26
|
-
|
|
27
|
-
simtools-write-array-element-positions-to-repository \
|
|
28
|
-
--input /path/to/positions.txt \
|
|
29
|
-
--repository_path /path/to/repository \
|
|
30
|
-
--parameter_version 0.1.0 \
|
|
31
|
-
--coordinate_system ground \
|
|
32
|
-
--site North
|
|
33
|
-
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
from pathlib import Path
|
|
37
|
-
|
|
38
|
-
import astropy.table
|
|
39
|
-
|
|
40
|
-
from simtools.application_control import get_application_label, startup_application
|
|
41
|
-
from simtools.configuration import configurator
|
|
42
|
-
from simtools.data_model.model_data_writer import ModelDataWriter
|
|
43
|
-
from simtools.io import ascii_handler
|
|
44
|
-
from simtools.model.array_model import ArrayModel
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def _parse():
|
|
48
|
-
"""Parse command line configuration."""
|
|
49
|
-
config = configurator.Configurator(
|
|
50
|
-
label=get_application_label(__file__),
|
|
51
|
-
description="Add array element positions to model parameter repository",
|
|
52
|
-
)
|
|
53
|
-
config.parser.add_argument(
|
|
54
|
-
"--input",
|
|
55
|
-
help="File containing a table of array element positions.",
|
|
56
|
-
required=False,
|
|
57
|
-
)
|
|
58
|
-
config.parser.add_argument(
|
|
59
|
-
"--repository_path",
|
|
60
|
-
help="Output path to model parameter repository.",
|
|
61
|
-
type=Path,
|
|
62
|
-
required=False,
|
|
63
|
-
)
|
|
64
|
-
config.parser.add_argument(
|
|
65
|
-
"--coordinate_system",
|
|
66
|
-
help="Coordinate system of array element positions (utm or ground).",
|
|
67
|
-
default="ground",
|
|
68
|
-
required=False,
|
|
69
|
-
type=str,
|
|
70
|
-
choices=["ground", "utm"],
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
return config.initialize(db_config=True, simulation_model=["site", "parameter_version"])
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def write_utm_array_elements_to_repository(args_dict, logger):
|
|
77
|
-
"""
|
|
78
|
-
Write UTM position of array elements to model repository.
|
|
79
|
-
|
|
80
|
-
Read array element positions from file. The ecsv row definition might
|
|
81
|
-
include telescope_name or asset_code and sequence_number.
|
|
82
|
-
|
|
83
|
-
Parameters
|
|
84
|
-
----------
|
|
85
|
-
args_dict : dict
|
|
86
|
-
Command line arguments.
|
|
87
|
-
app_context.logger : app_context.logger
|
|
88
|
-
app_context.logger object.
|
|
89
|
-
|
|
90
|
-
"""
|
|
91
|
-
array_elements = astropy.table.Table.read(args_dict["input"])
|
|
92
|
-
for row in array_elements:
|
|
93
|
-
instrument = (
|
|
94
|
-
row["telescope_name"]
|
|
95
|
-
if "telescope_name" in array_elements.colnames
|
|
96
|
-
else f"{row['asset_code']}-{row['sequence_number']}"
|
|
97
|
-
)
|
|
98
|
-
output_path = Path(args_dict["repository_path"]) / f"{instrument}"
|
|
99
|
-
output_path.mkdir(parents=True, exist_ok=True)
|
|
100
|
-
logger.info(f"Writing array element positions (utm) to {output_path}")
|
|
101
|
-
|
|
102
|
-
ModelDataWriter.dump_model_parameter(
|
|
103
|
-
parameter_name="array_element_position_utm",
|
|
104
|
-
instrument=instrument,
|
|
105
|
-
value=f"{row['utm_east']} {row['utm_north']} {row['altitude']}",
|
|
106
|
-
parameter_version=args_dict["parameter_version"],
|
|
107
|
-
output_path=output_path,
|
|
108
|
-
output_file="array_element_position_utm.json",
|
|
109
|
-
)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
def write_ground_array_elements_to_repository(args_dict, db_config, logger):
|
|
113
|
-
"""
|
|
114
|
-
Write ground position of array elements to model repository.
|
|
115
|
-
|
|
116
|
-
Parameters
|
|
117
|
-
----------
|
|
118
|
-
args_dict : dict
|
|
119
|
-
Command line arguments.
|
|
120
|
-
db_config : dict
|
|
121
|
-
Database configuration.
|
|
122
|
-
logger : logger
|
|
123
|
-
logger object.
|
|
124
|
-
|
|
125
|
-
"""
|
|
126
|
-
array_model = ArrayModel(
|
|
127
|
-
db_config=db_config,
|
|
128
|
-
model_version=None,
|
|
129
|
-
site=args_dict["site"],
|
|
130
|
-
array_elements=args_dict["input"],
|
|
131
|
-
)
|
|
132
|
-
for element_name, data in array_model.array_elements.items():
|
|
133
|
-
output_path = Path(args_dict["repository_path"]) / f"{element_name}"
|
|
134
|
-
output_path.mkdir(parents=True, exist_ok=True)
|
|
135
|
-
logger.info(f"Writing array element positions (ground) to {output_path}")
|
|
136
|
-
ascii_handler.write_data_to_file(
|
|
137
|
-
data=data,
|
|
138
|
-
output_file=output_path / "array_element_position_ground.json",
|
|
139
|
-
sort_keys=False,
|
|
140
|
-
numpy_types=True,
|
|
141
|
-
)
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
def main():
|
|
145
|
-
"""Application main."""
|
|
146
|
-
app_context = startup_application(_parse)
|
|
147
|
-
|
|
148
|
-
if app_context.args["coordinate_system"] == "utm":
|
|
149
|
-
write_utm_array_elements_to_repository(app_context.args, app_context.logger)
|
|
150
|
-
elif app_context.args["coordinate_system"] == "ground":
|
|
151
|
-
write_ground_array_elements_to_repository(
|
|
152
|
-
app_context.args, app_context.db_config, app_context.logger
|
|
153
|
-
)
|
|
154
|
-
else:
|
|
155
|
-
app_context.logger.error("Invalid coordinate system. Allowed are 'utm' and 'ground'.")
|
|
156
|
-
raise ValueError
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
if __name__ == "__main__":
|
|
160
|
-
main()
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/python3
|
|
2
|
-
"""
|
|
3
|
-
Print the versions of the simtools software.
|
|
4
|
-
|
|
5
|
-
The versions of simtools, the DB, sim_telarray, and CORSIKA are printed.
|
|
6
|
-
|
|
7
|
-
"""
|
|
8
|
-
|
|
9
|
-
from simtools import dependencies, version
|
|
10
|
-
from simtools.application_control import get_application_label, startup_application
|
|
11
|
-
from simtools.configuration import configurator
|
|
12
|
-
from simtools.io import ascii_handler
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def _parse():
|
|
16
|
-
"""Parse command line configuration."""
|
|
17
|
-
config = configurator.Configurator(
|
|
18
|
-
label=get_application_label(__file__),
|
|
19
|
-
description="Print the versions of simtools, the DB, sim_telarray and CORSIKA.",
|
|
20
|
-
usage="simtools-print-version",
|
|
21
|
-
)
|
|
22
|
-
return config.initialize(db_config=True, output=True, require_command_line=False)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
def main():
|
|
26
|
-
"""Print the versions of the simtools software."""
|
|
27
|
-
app_context = startup_application(_parse)
|
|
28
|
-
|
|
29
|
-
version_string = dependencies.get_version_string(app_context.db_config)
|
|
30
|
-
version_dict = {"simtools version": version.__version__}
|
|
31
|
-
|
|
32
|
-
print()
|
|
33
|
-
# The loop below is not necessary, there is only one entry, but it is cleaner
|
|
34
|
-
for key, value in version_dict.items(): #
|
|
35
|
-
print(f"{key}: {value}")
|
|
36
|
-
print(version_string)
|
|
37
|
-
|
|
38
|
-
version_list = version_string.strip().split("\n")
|
|
39
|
-
for version_entry in version_list:
|
|
40
|
-
key, value = version_entry.split(": ", 1)
|
|
41
|
-
version_dict[key] = value
|
|
42
|
-
|
|
43
|
-
if not app_context.args.get("output_file_from_default", False):
|
|
44
|
-
ascii_handler.write_data_to_file(
|
|
45
|
-
data=version_dict,
|
|
46
|
-
output_file=app_context.io_handler.get_output_file(
|
|
47
|
-
app_context.args.get("output_file", "simtools_version.json")
|
|
48
|
-
),
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if __name__ == "__main__":
|
|
53
|
-
main()
|
simtools/io/hdf5_handler.py
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"""Helper module for reading and writing in hd5 format."""
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
from pathlib import PosixPath
|
|
5
|
-
|
|
6
|
-
import astropy.units as u
|
|
7
|
-
import tables
|
|
8
|
-
from astropy.table import Table
|
|
9
|
-
from ctapipe.io import read_table
|
|
10
|
-
|
|
11
|
-
from simtools.utils.names import sanitize_name
|
|
12
|
-
|
|
13
|
-
_logger = logging.getLogger(__name__)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
def fill_hdf5_table(hist, x_bin_edges, y_bin_edges, x_label, y_label, meta_data):
|
|
17
|
-
"""
|
|
18
|
-
Create and fill an hdf5 table with the histogram information.
|
|
19
|
-
|
|
20
|
-
It works for both 1D and 2D distributions.
|
|
21
|
-
|
|
22
|
-
Parameters
|
|
23
|
-
----------
|
|
24
|
-
hist: numpy.ndarray
|
|
25
|
-
The counts of the histograms.
|
|
26
|
-
x_bin_edges: numpy.array
|
|
27
|
-
The x bin edges of the histograms.
|
|
28
|
-
y_bin_edges: numpy.array
|
|
29
|
-
The y bin edges of the histograms.
|
|
30
|
-
Use None for 1D histograms.
|
|
31
|
-
x_label: str
|
|
32
|
-
X bin edges label.
|
|
33
|
-
y_label: str
|
|
34
|
-
Y bin edges label.
|
|
35
|
-
Use None for 1D histograms.
|
|
36
|
-
meta_data: dict
|
|
37
|
-
Dictionary with the histogram metadata.
|
|
38
|
-
"""
|
|
39
|
-
validate_histogram(hist, y_bin_edges)
|
|
40
|
-
|
|
41
|
-
meta_data["x_bin_edges"] = x_bin_edges
|
|
42
|
-
meta_data["x_bin_edges_unit"] = (
|
|
43
|
-
x_bin_edges.unit if isinstance(x_bin_edges, u.Quantity) else u.dimensionless_unscaled
|
|
44
|
-
)
|
|
45
|
-
if y_bin_edges is not None:
|
|
46
|
-
meta_data["y_bin_edges"] = y_bin_edges
|
|
47
|
-
meta_data["y_bin_edges_unit"] = (
|
|
48
|
-
y_bin_edges.unit if isinstance(y_bin_edges, u.Quantity) else u.dimensionless_unscaled
|
|
49
|
-
)
|
|
50
|
-
|
|
51
|
-
if hist.ndim == 1:
|
|
52
|
-
if x_label is not None:
|
|
53
|
-
names = sanitize_name(x_label)
|
|
54
|
-
try:
|
|
55
|
-
names = meta_data["Title"]
|
|
56
|
-
except KeyError:
|
|
57
|
-
_logger.warning("Title not found in metadata.")
|
|
58
|
-
|
|
59
|
-
table = Table(
|
|
60
|
-
[
|
|
61
|
-
x_bin_edges[:-1],
|
|
62
|
-
hist,
|
|
63
|
-
],
|
|
64
|
-
names=(names, sanitize_name("Values")),
|
|
65
|
-
meta=meta_data,
|
|
66
|
-
)
|
|
67
|
-
else:
|
|
68
|
-
if y_label is not None:
|
|
69
|
-
names = [
|
|
70
|
-
f"{sanitize_name(y_label).split('__')[0]}_{i}" for i in range(len(y_bin_edges[:-1]))
|
|
71
|
-
]
|
|
72
|
-
try:
|
|
73
|
-
names = [
|
|
74
|
-
f"{(meta_data['Title']).split('__')[0]}_{sanitize_name(y_label)}_{i}"
|
|
75
|
-
for i in range(len(y_bin_edges[:-1]))
|
|
76
|
-
]
|
|
77
|
-
except KeyError:
|
|
78
|
-
_logger.warning("Title not found in metadata.")
|
|
79
|
-
names = [
|
|
80
|
-
f"{sanitize_name(y_label).split('__')[0]}_{i}" for i in range(len(y_bin_edges[:-1]))
|
|
81
|
-
]
|
|
82
|
-
|
|
83
|
-
table = Table(
|
|
84
|
-
[hist[i, :] for i in range(len(y_bin_edges[:-1]))],
|
|
85
|
-
names=names,
|
|
86
|
-
meta=meta_data,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
return table
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
def validate_histogram(hist, y_bin_edges):
|
|
93
|
-
"""Validate histogram dimensions and y_bin_edges consistency.
|
|
94
|
-
|
|
95
|
-
Parameters
|
|
96
|
-
----------
|
|
97
|
-
hist (np.ndarray): The histogram array, expected to be 1D or 2D.
|
|
98
|
-
y_bin_edges (array-like or None): Bin edges for the second dimension (if applicable).
|
|
99
|
-
|
|
100
|
-
Raises
|
|
101
|
-
------
|
|
102
|
-
ValueError: If histogram dimensions are invalid or inconsistent with y_bin_edges.
|
|
103
|
-
"""
|
|
104
|
-
if hist.ndim not in (1, 2):
|
|
105
|
-
raise ValueError("Histogram must be either 1D or 2D.")
|
|
106
|
-
|
|
107
|
-
if hist.ndim == 1 and y_bin_edges is not None:
|
|
108
|
-
raise ValueError("y_bin_edges should be None for 1D histograms.")
|
|
109
|
-
|
|
110
|
-
if hist.ndim == 2 and y_bin_edges is None:
|
|
111
|
-
raise ValueError("y_bin_edges should not be None for 2D histograms.")
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def read_hdf5(hdf5_file_name):
|
|
115
|
-
"""
|
|
116
|
-
Read a hdf5 output file.
|
|
117
|
-
|
|
118
|
-
Parameters
|
|
119
|
-
----------
|
|
120
|
-
hdf5_file_name: str or Path
|
|
121
|
-
Name or Path of the hdf5 file to read from.
|
|
122
|
-
|
|
123
|
-
Returns
|
|
124
|
-
-------
|
|
125
|
-
list
|
|
126
|
-
The list with the astropy.Table instances for the various 1D and 2D histograms saved
|
|
127
|
-
in the hdf5 file.
|
|
128
|
-
"""
|
|
129
|
-
if isinstance(hdf5_file_name, PosixPath):
|
|
130
|
-
hdf5_file_name = hdf5_file_name.absolute().as_posix()
|
|
131
|
-
|
|
132
|
-
tables_list = []
|
|
133
|
-
|
|
134
|
-
with tables.open_file(hdf5_file_name, mode="r") as file:
|
|
135
|
-
for node in file.walk_nodes("/", "Table"):
|
|
136
|
-
table_path = node._v_pathname # pylint: disable=protected-access
|
|
137
|
-
table = read_table(hdf5_file_name, table_path)
|
|
138
|
-
tables_list.append(table)
|
|
139
|
-
return tables_list
|
|
File without changes
|