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

Updates for ACADA-LST tests of 2024 #3

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ authors = [
]
dynamic = ["version"]

requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"numpy",
"protozfits~=2.4",
"ctapipe~=0.20.0",
"protozfits~=2.6",
"ctapipe~=0.23.0",
]

[project.optional-dependencies]
Expand Down
8 changes: 2 additions & 6 deletions src/ctapipe_io_zfits/dl0.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,8 @@ def _fill_dl0_container(
n_pixels_nominal = camera_geometry.n_pixels

# fill not readout pixels with 0, reorder pixels, use 2d array when gain reduced
if n_channels == 2:
waveform = np.zeros((n_channels, n_pixels_nominal, n_samples), dtype=np.float32)
waveform[:, camera_config.pixel_id_map[pixel_stored]] = zfits_waveform
else:
waveform = np.zeros((n_pixels_nominal, n_samples), dtype=np.float32)
waveform[camera_config.pixel_id_map[pixel_stored]] = zfits_waveform[0]
waveform = np.zeros((n_channels, n_pixels_nominal, n_samples), dtype=np.float32)
waveform[:, camera_config.pixel_id_map[pixel_stored]] = zfits_waveform

if ignore_samples_start != 0 or ignore_samples_end != 0:
start = ignore_samples_start
Expand Down
47 changes: 22 additions & 25 deletions src/ctapipe_io_zfits/tests/test_dl0.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import astropy.units as u
import numpy as np
import pytest
from astropy.time import Time
from ctapipe.core.tool import run_tool
from ctapipe.instrument import SubarrayDescription
Expand Down Expand Up @@ -53,18 +52,17 @@ def test_subarray_events(dummy_dl0):
def test_process(dummy_dl0, tmp_path):
path = tmp_path / "dummy.dl1.h5"

with pytest.warns(UserWarning, match="Encountered an event with no R1 data"):
run_tool(
ProcessorTool(),
[
f"--input={dummy_dl0}",
f"--output={path}",
"--write-images",
"--write-parameters",
"--EventTypeFilter.allowed_types=SUBARRAY",
],
raises=True,
)
run_tool(
ProcessorTool(),
[
f"--input={dummy_dl0}",
f"--output={path}",
"--write-images",
"--write-parameters",
"--EventTypeFilter.allowed_types=SUBARRAY",
],
raises=True,
)


def test_telescope_event_source(dummy_tel_file):
Expand All @@ -83,18 +81,17 @@ def test_telescope_event_source(dummy_tel_file):
def test_process_tel_events(dummy_tel_file, tmp_path):
path = tmp_path / "dummy.dl1.h5"

with pytest.warns(UserWarning, match="Encountered an event with no R1 data"):
run_tool(
ProcessorTool(),
[
f"--input={dummy_tel_file}",
f"--output={path}",
"--write-images",
"--write-parameters",
"--MultiFiles.all_chunks=True",
],
raises=True,
)
run_tool(
ProcessorTool(),
[
f"--input={dummy_tel_file}",
f"--output={path}",
"--write-images",
"--write-parameters",
"--MultiFiles.all_chunks=True",
],
raises=True,
)

with TableLoader(path) as loader:
events = loader.read_telescope_events()
Expand Down