diff --git a/CITATION.cff b/CITATION.cff index e2d053c68..02d2e94a0 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -39,7 +39,7 @@ authors: date-released: 2023-03-23 doi: 10.5281/zenodo.7869553 -version: "1.4.7" +version: "1.4.8" repository-code: "https://github.com/EIT-ALIVE/eitprocessing" keywords: - Mechanical lung ventilation diff --git a/eitprocessing/__init__.py b/eitprocessing/__init__.py index ac329c9b3..4963389e5 100644 --- a/eitprocessing/__init__.py +++ b/eitprocessing/__init__.py @@ -1 +1 @@ -__version__ = "1.4.7" +__version__ = "1.4.8" diff --git a/eitprocessing/datahandling/loading/draeger.py b/eitprocessing/datahandling/loading/draeger.py index 3e41abb71..0160204b9 100644 --- a/eitprocessing/datahandling/loading/draeger.py +++ b/eitprocessing/datahandling/loading/draeger.py @@ -92,6 +92,9 @@ def load_from_single_path( msg = "No sample frequency provided. " raise ValueError(msg) + # time wraps around the number of seconds in a day + time = np.unwrap(time, period=24 * 60 * 60) + eit_data = EITData( vendor=Vendor.DRAEGER, path=path, diff --git a/pyproject.toml b/pyproject.toml index 788720fdd..8baa70993 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "eitprocessing" -version = "1.4.7" +version = "1.4.8" description = "Processing of lung image data from electrical impedance tomography." readme = "README.md" requires-python = ">=3.10" @@ -173,7 +173,7 @@ isort.known-first-party = ["eitprocessing"] "docs/*" = ["ALL"] [tool.bumpversion] -current_version = "1.4.7" +current_version = "1.4.8" [[tool.bumpversion.files]] filename = "pyproject.toml" diff --git a/tests/conftest.py b/tests/conftest.py index 45bfdd48f..748099f67 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -15,6 +15,7 @@ draeger_file1 = data_directory / "Draeger_Test3.bin" draeger_file2 = data_directory / "Draeger_Test.bin" draeger_file3 = data_directory / "Draeger_Test_event_on_first_frame.bin" +draeger_wrapped_time_axis_file = data_directory / "Draeger_wrapped_time_axis.bin" timpel_file = data_directory / "Timpel_test.txt" dummy_file = data_directory / "not_a_file.dummy" @@ -39,6 +40,13 @@ def timpel1(): return load_eit_data(timpel_file, vendor="timpel", label="timpel") +@pytest.fixture(scope="session") +def draeger_wrapped_time_axis(): + return load_eit_data( + draeger_wrapped_time_axis_file, vendor="draeger", sample_frequency=20, label="draeger_wrapped_time_axis" + ) + + # @pytest.fixture(scope="session") # def timpel_double(): # return load_eit_data([timpel_file, timpel_file], vendor="timpel", label="timpel_double") diff --git a/tests/test_loading.py b/tests/test_loading.py index 265e07fc8..164783b12 100644 --- a/tests/test_loading.py +++ b/tests/test_loading.py @@ -1,3 +1,4 @@ +import numpy as np import pytest from eitprocessing.datahandling.eitdata import EITData, Vendor @@ -145,3 +146,10 @@ def test_event_on_first_frame(draeger2: Sequence): draeger3_events = draeger3.sparse_data["events_(draeger)"] assert draeger3_events == draeger2.sparse_data["events_(draeger)"] assert draeger3_events.time[0] == draeger3.eit_data["raw"].time[0] + + +@pytest.mark.parametrize("fixture_name", ["draeger1", "draeger2", "draeger_wrapped_time_axis"]) +def test_time_axis(fixture_name: str, request: pytest.FixtureRequest): + sequence = request.getfixturevalue(fixture_name) + time_diff = np.diff(sequence.time) + assert np.allclose(time_diff, time_diff.mean())