generate_simtel_array_histograms#

Write sim_telarray histograms into pdf and hdf5 files.

It accepts multiple lists of histograms files, a single list or a histogram file. Each histogram is plotted in a page of the pdf file if the –pdf option is activated.

Command line arguments#

hist_file_names (str, optional)

Name of the histogram files to be plotted. It can be given as the histogram file names (more than one option allowed) or as a text file with the names of the histogram files in it.

figure_name (str, required)

File name for the pdf output (without extension).

pdf (bool, optional)

If set, histograms are saved into pdf files. One pdf file contains all the histograms found in the file. The name of the file is controlled via output_file_name.

hdf5: bool

If true, histograms are saved into hdf5 files. At least one of pdf and hdf5 has to be activated.

output_file_name (str, optional)

The name of the output hdf5 (and/or pdf) files (without the path). If not given, output_file_name takes the name from the (first) input file (hist_file_names). If the output output_file_name.hdf5 file already exists and hdf5 is set, the tables associated to hdf5 will be overwritten. The remaining tables, if any, will stay untouched.

Raises#

TypeError:

if argument passed through hist_file_names is not a file.

Example#

simtools-generate-simtel-array-histograms --hist_file_names tests/resources/ \\
    run2_gamma_za20deg_azm0deg-North-Prod5_test-production-5.hdata.zst \\
    --output_file_name test_hist_hdata --hdf5 --pdf
generate_simtel_array_histograms.build_histogram_files(config_parser, logger)[source]#

Build a list of histogram files from command line arguments.

Parameters:
config_parser: dict

Parsed command line arguments.

logger: logging.Logger

Logger object for logging messages.

Returns:
list

List of histogram file paths.

generate_simtel_array_histograms.check_and_log_overwrite(config_parser, logger)[source]#

Check if the output hdf5 file already exists and log a warning if it does.

Parameters:
config_parser: dict

Parsed command line arguments.

logger: logging.Logger

Logger object for logging messages.

Returns:
bool

True if the hdf5 file exists and should be overwritten, False otherwise.

generate_simtel_array_histograms.create_pdf(simtel_histograms, output_file_name, config_parser, logger)[source]#

Create a PDF file containing histograms.

Parameters:
simtel_histograms: SimtelIOHistograms

SimtelIOHistograms object containing histograms to plot.

output_file_name: str

Base name for the output PDF file.

config_parser: dict

Parsed command line arguments.

logger: logging.Logger

Logger object for logging messages.

generate_simtel_array_histograms.export_to_hdf5(simtel_histograms, output_file_name, overwrite, config_parser, logger)[source]#

Export histograms to an HDF5 file.