From 43d451cda2f935ac7e6ecd25fa540cdfb3742bd1 Mon Sep 17 00:00:00 2001 From: Peter Somhorst Date: Wed, 18 Dec 2024 13:20:44 +0100 Subject: [PATCH 1/4] Unwrap time around number of seconds in a day --- eitprocessing/datahandling/loading/draeger.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/eitprocessing/datahandling/loading/draeger.py b/eitprocessing/datahandling/loading/draeger.py index e55003f9c..092c6c980 100644 --- a/eitprocessing/datahandling/loading/draeger.py +++ b/eitprocessing/datahandling/loading/draeger.py @@ -90,6 +90,9 @@ def load_from_single_path( if not sample_frequency: sample_frequency = DRAEGER_SAMPLE_FREQUENCY + # 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, From 14e2f21b5521e9dc77fe572a5c2b0cf545929e8d Mon Sep 17 00:00:00 2001 From: Peter Somhorst Date: Wed, 18 Dec 2024 13:21:00 +0100 Subject: [PATCH 2/4] Add tests for a continuous time axis --- tests/conftest.py | 8 ++++++++ tests/test_loading.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/conftest.py b/tests/conftest.py index 660858610..e020f72cb 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 24d20d834..05faa0766 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 @@ -129,3 +130,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()) From 66fa03a0a21808a60ba402958854977a9daf5fd8 Mon Sep 17 00:00:00 2001 From: Peter Somhorst Date: Wed, 18 Dec 2024 13:25:22 +0100 Subject: [PATCH 3/4] Fix linting issue --- eitprocessing/datahandling/datacollection.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eitprocessing/datahandling/datacollection.py b/eitprocessing/datahandling/datacollection.py index 467ba8114..5d007ede6 100644 --- a/eitprocessing/datahandling/datacollection.py +++ b/eitprocessing/datahandling/datacollection.py @@ -40,7 +40,7 @@ def __init__(self, data_type: type[V], *args, **kwargs): self.data_type = data_type super().__init__(*args, **kwargs) - def __setitem__(self, __key: str, __value: V) -> None: + def __setitem__(self, __key: str, __value: V, /) -> None: self._check_item(__value, key=__key) return super().__setitem__(__key, __value) From ad0bbdbe8445b115bf061d4682fea0cd02454197 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 18 Dec 2024 12:31:35 +0000 Subject: [PATCH 4/4] =?UTF-8?q?Bump=20version:=201.4.7=20=E2=86=92=201.4.8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CITATION.cff | 2 +- eitprocessing/__init__.py | 2 +- pyproject.toml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) 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/pyproject.toml b/pyproject.toml index 245a0e00e..009ee46b6 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" @@ -185,7 +185,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"