IntervalData
eitprocessing.datahandling.intervaldata
¶
Interval
¶
A tuple containing the start time and end time of an interval.
IntervalData
dataclass
¶
IntervalData(
label: str,
name: str,
unit: str | None,
category: str,
intervals: list[Interval | tuple[float, float]],
values: list[Any] | None = None,
parameters: dict[str, Any] = dict(),
derived_from: list[Any] = list(),
description: str = "",
default_partial_inclusion: bool = False,
)
Container for interval data existing over a period of time.
Interval data is data that consists for a given time interval. Examples are a ventilator setting (e.g. end-expiratory pressure), the position of a patient, a maneuver (end-expiratory hold) being performed, detected periods in the data, etc.
Interval data consists of a number of intervals that may or may not have values associated with them.
Examples of IntervalData with associated values are certain ventilator settings (e.g. end-expiratory pressure) and the position of a patient. Examples of IntervalData without associated values are indicators of maneouvres (e.g. a breath hold) or detected occurences (e.g. a breath).
Interval data can be selected by time through the select_by_time(start_time, end_time)
method. Alternatively,
t[start_time:end_time]
can be used.
PARAMETER | DESCRIPTION |
---|---|
label
|
Computer readable label identifying this dataset.
TYPE:
|
name
|
Human readable name for the data.
TYPE:
|
unit
|
The unit of the data, if applicable.
TYPE:
|
category
|
Category the data falls into, e.g. 'breath'.
TYPE:
|
intervals
|
A list of intervals (tuples containing a start time and end time). |
values
|
An optional list of values associated with each interval. |
parameters
|
Parameters used to derive the data. |
derived_from
|
Traceback of intermediates from which the current data was derived. |
description
|
Extended human readible description of the data.
TYPE:
|
default_partial_inclusion
|
Whether to include a trimmed version of an interval when selecting data
TYPE:
|
t
property
¶
t: TimeIndexer
select_by_time
¶
select_by_time(
start_time: float | None = None,
end_time: float | None = None,
partial_inclusion: bool | None = None,
newlabel: str | None = None,
) -> Self
Create a new copy of the object, selecting data between start_time and end_time.
This function returns a shortened copy of the object, containing data from the specified start_time to end_time.
If partial_inclusion
is set to True
, any intervals that overlap with the start_time or end_time are included
in the selection, and their times are adjusted to fit within the specified range. If partial_inclusion
is
False
, intervals that overlap the start or end times are excluded from the selection.
For example:
- Set partial_inclusion
to True
for cases like "set_driving_pressure" where you want to include settings
that were active before the start_time.
- Set partial_inclusion
to False
for cases like "detected_breaths" where you want to exclude partial data
that doesn't fully fit within the time range.
Note that the end_time is always included in the selection if it is present in the original object.
PARAMETER | DESCRIPTION |
---|---|
start_time
|
The earliest time point to include in the copy.
TYPE:
|
end_time
|
The latest time point to include in the copy.
TYPE:
|
partial_inclusion
|
Whether to include intervals that overlap with the start_time or end_time.
TYPE:
|
newlabel
|
A new label for the copied object.
TYPE:
|
select_by_index
¶
select_by_index(
start: int | None = None,
end: int | None = None,
newlabel: str | None = None,
) -> Self
De facto implementation of the __getitem__
function.
This function can also be called directly to add a label to the sliced object. Otherwise a default label describing the slice and original object is attached.
isequivalent
¶
Test whether the data structure between two objects are equivalent.
Equivalence, in this case means that objects are compatible e.g. to be merged. Data content can vary, but e.g. the category of data (e.g. airway pressure, flow, tidal volume) and unit, etc., must match.
PARAMETER | DESCRIPTION |
---|---|
other
|
object that will be compared to self.
TYPE:
|
raise_
|
sets this method's behavior in case of non-equivalence. If
True, an
TYPE:
|
RAISES | DESCRIPTION |
---|---|
EquivalenceError
|
if |
RETURNS | DESCRIPTION |
---|---|
bool
|
bool describing result of equivalence comparison. |