Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R0 and R1 waveform merging #2386

Merged
merged 2 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions ctapipe/io/hdf5merger.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ class NodeType(enum.Enum):
"/simulation/event/telescope/impact": NodeType.TEL_GROUP,
"/simulation/event/telescope/images": NodeType.TEL_GROUP,
"/simulation/event/telescope/parameters": NodeType.TEL_GROUP,
"/r0/event/telescope": NodeType.TEL_GROUP,
"/r1/event/telescope": NodeType.TEL_GROUP,
"/dl1/event/subarray/trigger": NodeType.TABLE,
"/dl1/event/telescope/trigger": NodeType.TABLE,
"/dl1/event/telescope/images": NodeType.TEL_GROUP,
Expand Down Expand Up @@ -115,6 +117,16 @@ class HDF5Merger(Component):
help="Whether to include parameters calculated on true images in merged output",
).tag(config=True)

r0_waveforms = traits.Bool(
True,
help="Whether to include r0 waveforms in merged output",
).tag(config=True)

r1_waveforms = traits.Bool(
True,
help="Whether to include r1 waveforms in merged output",
).tag(config=True)

dl1_images = traits.Bool(
True,
help="Whether to include dl1 images in merged output",
Expand Down Expand Up @@ -296,6 +308,16 @@ def _append(self, other):
):
self._append_table_group(other, other.root[key])

# R0
key = "/r0/event/telescope/"
if self.telescope_events and self.r0_waveforms and key in other.root:
self._append_table_group(other, other.root[key])

# R1
key = "/r1/event/telescope/"
if self.telescope_events and self.r1_waveforms and key in other.root:
self._append_table_group(other, other.root[key])

# DL1
key = "/dl1/event/subarray/trigger"
if key in other.root:
Expand Down
12 changes: 12 additions & 0 deletions ctapipe/tools/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,18 @@ class MergeTool(Tool):
"Include telescope-wise data",
"Exclude telescope-wise data",
),
**flag(
"r0-waveforms",
"HDF5Merger.r0_waveforms",
"Include r0 waveforms",
"Exclude r0 waveforms",
),
**flag(
"r1-waveforms",
"HDF5Merger.r1_waveforms",
"Include r1 waveforms",
"Exclude r1 waveforms",
),
**flag(
"dl1-images",
"HDF5Merger.dl1_images",
Expand Down
1 change: 1 addition & 0 deletions docs/changes/2386.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for including r1 and r0 waveforms in the ``ctapipe-merge`` tool.
Loading