MergeTool#

class ctapipe.tools.merge.MergeTool(**kwargs: Any)[source]#

Bases: Tool

Merge multiple ctapipe HDF5 files into one

Attributes Summary

aliases

classes

description

examples

file_pattern

Give a specific file pattern for matching files in input_dir

flags

input_dir

Input directory

input_files

Input CTA HDF5 files

name

parser

progress_bar

Show progress bar during processing

skip_broken_files

Skip files that cannot be merged instead of raising an error

Methods Summary

finish()

Finish up.

setup()

Set up the tool.

start()

Main function of the tool.

Attributes Documentation

aliases: StrDict = {('i', 'input-dir'): 'MergeTool.input_dir', ('o', 'output'): 'HDF5Merger.output_path', ('p', 'pattern'): 'MergeTool.file_pattern'}#
classes: ClassesType = [<class 'ctapipe.io.hdf5merger.HDF5Merger'>]#
description: str | Unicode[str, str | bytes] = 'Merge multiple ctapipe HDF5 files into one'#
examples: str | Unicode[str, str | bytes] = "\n    To merge several files in the current directory:\n\n    > ctapipe-merge file1.h5 file2.h5 file3.h5 --output=/path/output_file.h5 --progress\n\n    For merging files from a specific directory with a specific pattern, use:\n\n    > ctapipe-merge --input-dir=/input/dir/ --output=/path/output_file.h5 --progress\n    --pattern='*.dl1.h5'\n\n    If no pattern is given, all .h5 files in the given directory will be taken as input.\n    "#
file_pattern#

Give a specific file pattern for matching files in input_dir

flags: StrDict = {'append': ({'HDF5Merger': {'append': True}}, 'Append to existing files'), 'dl1-images': ({'HDF5Merger': {'dl1_images': True}}, 'Include dl1 images'), 'dl1-parameters': ({'HDF5Merger': {'dl1_parameters': True}}, 'Include dl1 parameters'), 'dl2-subarray': ({'HDF5Merger': {'dl2_subarray': True}}, 'Include dl2 subarray-wise data'), 'dl2-telescope': ({'HDF5Merger': {'dl2_telescope': True}}, 'Include dl2 telescope-wise data'), 'no-dl1-images': ({'HDF5Merger': {'dl1_images': False}}, 'Exclude dl1 images'), 'no-dl1-parameters': ({'HDF5Merger': {'dl1_parameters': False}}, 'Exclude dl1 parameters'), 'no-dl2-subarray': ({'HDF5Merger': {'dl2_subarray': False}}, 'Exclude dl2 subarray-wise data'), 'no-dl2-telescope': ({'HDF5Merger': {'dl2_telescope': False}}, 'Exclude dl2 telescope-wise data'), 'no-r0-waveforms': ({'HDF5Merger': {'r0_waveforms': False}}, 'Exclude r0 waveforms'), 'no-r1-waveforms': ({'HDF5Merger': {'r1_waveforms': False}}, 'Exclude r1 waveforms'), 'no-telescope-events': ({'HDF5Merger': {'telescope_events': False}}, 'Exclude telescope-wise data'), 'no-true-images': ({'HDF5Merger': {'true_images': False}}, 'Exclude true images'), 'no-true-parameters': ({'HDF5Merger': {'true_parameters': False}}, 'Exclude true parameters'), 'overwrite': ({'HDF5Merger': {'overwrite': True}}, 'Overwrite existing files'), 'progress': ({'MergeTool': {'progress_bar': True}}, 'Show a progress bar for all given input files'), 'r0-waveforms': ({'HDF5Merger': {'r0_waveforms': True}}, 'Include r0 waveforms'), 'r1-waveforms': ({'HDF5Merger': {'r1_waveforms': True}}, 'Include r1 waveforms'), 'single-ob': ({'HDF5Merger': {'single_ob': True}}, 'By default, the merge tool assumes it is merging multiple observation blocks. This option switches to merging multiple chunks of events of the same ob.'), 'telescope-events': ({'HDF5Merger': {'telescope_events': True}}, 'Include telescope-wise data'), 'true-images': ({'HDF5Merger': {'true_images': True}}, 'Include true images'), 'true-parameters': ({'HDF5Merger': {'true_parameters': True}}, 'Include true parameters')}#
input_dir#

Input directory

input_files#

Input CTA HDF5 files

name: str | Unicode[str, str | bytes] = 'ctapipe-merge'#
parser = ArgumentParser(prog='__main__.py', usage=None, description=None, formatter_class=<class 'argparse.HelpFormatter'>, conflict_handler='error', add_help=True)#
progress_bar#

Show progress bar during processing

skip_broken_files#

Skip files that cannot be merged instead of raising an error

Methods Documentation

finish()[source]#

Finish up.

This is called automatically after start when run is called.

setup()[source]#

Set up the tool.

This method runs after the configuration and command line options have been parsed.

Here the tool should construct all Components, open files, etc.

start()[source]#

Main function of the tool.

This is automatically called after initialize when run is called.