Skip to content

Commit 62a97c8

Browse files
committed
add also unit test for R1 reading
1 parent 7f7d0a3 commit 62a97c8

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

dl1_data_handler/conftest.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ def dl1_tmp_path(tmp_path_factory):
1818
"""Temporary directory for global dl1 test data"""
1919
return tmp_path_factory.mktemp("dl1_")
2020

21+
@pytest.fixture(scope="session")
22+
def r1_tmp_path(tmp_path_factory):
23+
"""Temporary directory for global r1 test data"""
24+
return tmp_path_factory.mktemp("r1_")
25+
2126
@pytest.fixture(scope="session")
2227
def dl1_gamma_file(dl1_tmp_path, prod5_gamma_simtel_path):
2328
"""
@@ -39,4 +44,27 @@ def dl1_gamma_file(dl1_tmp_path, prod5_gamma_simtel_path):
3944
"--DataWriter.Contact.name=αℓℓ the äüöß",
4045
]
4146
assert run_tool(ProcessorTool(), argv=argv, cwd=dl1_tmp_path) == 0
47+
return output
48+
49+
@pytest.fixture(scope="session")
50+
def r1_gamma_file(r1_tmp_path, prod5_gamma_simtel_path):
51+
"""
52+
R1 file containing both waveforms and parameters from a gamma simulation set.
53+
"""
54+
from ctapipe.tools.process import ProcessorTool
55+
56+
output = r1_tmp_path / "gamma.r1.h5"
57+
58+
# prevent running process multiple times in case of parallel tests
59+
with FileLock(output.with_suffix(output.suffix + ".lock")):
60+
if output.is_file():
61+
return output
62+
63+
argv = [
64+
f"--input={prod5_gamma_simtel_path}",
65+
f"--output={output}",
66+
f"--DataWriter.write_r1_waveforms=True",
67+
"--DataWriter.Contact.name=αℓℓ the äüöß",
68+
]
69+
assert run_tool(ProcessorTool(), argv=argv, cwd=r1_tmp_path) == 0
4270
return output

0 commit comments

Comments
 (0)