Skip to content
Open
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
16 changes: 8 additions & 8 deletions eitprocessing/datahandling/loading/draeger.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def load_from_single_path( # noqa: PLR0915
unit=None,
category="minvalue",
derived_from=[eit_data],
time=np.array([t for t, d in phases if d == -1]),
time=np.array([time[i] for i, d in phases if d == -1]),
),
)
sparsedata_collection.add(
Expand All @@ -164,23 +164,23 @@ def load_from_single_path( # noqa: PLR0915
unit=None,
category="maxvalue",
derived_from=[eit_data],
time=np.array([t for t, d in phases if d == 1]),
time=np.array([time[i] for i, d in phases if d == 1]),
),
)
if events:
time_, events_ = zip(*events, strict=True)
time = np.array(time_)
event_idxs, events_ = zip(*events, strict=True)
event_time = time[list(event_idxs)]
events = list(events_)
else:
time, events = np.array([]), []
event_time, events = np.array([]), []
sparsedata_collection.add(
SparseData(
label="events_(draeger)",
name="Events loaded from Draeger data",
unit=None,
category="event",
derived_from=[eit_data],
time=time,
time=event_time,
values=events,
),
)
Expand Down Expand Up @@ -311,12 +311,12 @@ def _read_frame(
# Therefore, check whether the event marker has changed with
# respect to the most recent event. If so, create a new event.
if ((previous_marker is not None) and (event_marker > previous_marker)) or (index == 0 and event_text):
events.append((frame_time, Event(event_marker, event_text)))
events.append((index, Event(event_marker, event_text)))
if timing_error:
warnings.warn("A timing error was encountered during loading.", RuntimeWarning, stacklevel=2)
# TODO: expand on what timing errors are in some documentation.
if min_max_flag in (1, -1):
phases.append((frame_time, min_max_flag))
phases.append((index, min_max_flag))

return event_marker

Expand Down
2 changes: 2 additions & 0 deletions tests/eitdata/test_loading_draeger.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def test_load_draeger(
"Loading without sample frequency should yield the same data"
)

assert len(sequence[:100]) == 100


def test_draeger_20hz_healthy_volunteer_2_differ(
draeger_20hz_healthy_volunteer: Sequence, draeger_20hz_healthy_volunteer_fixed_rr: Sequence
Expand Down
Loading