SparseData
eitprocessing.datahandling.sparsedata
¶
SparseData
dataclass
¶
SparseData(
label: str,
name: str,
unit: str | None,
category: str,
time: ndarray,
description: str = "",
parameters: dict[str, Any] = dict(),
derived_from: list[Any] = list(),
values: Any | None = None,
)
Container for data related to individual time points.
Sparse data is data for which the time points are not necessarily evenly spaced. Data can consist time-value pairs or only time points.
Sparse data differs from interval data in that each data points is associated with a single time point rather than a time range.
Examples are data points at end of inspiration/end of expiration (e.g. tidal volume, end-expiratoy lung impedance) or detected time points (e.g. QRS complexes).
PARAMETER | DESCRIPTION |
---|---|
label
|
Computer readable name.
TYPE:
|
name
|
Human readable name.
TYPE:
|
unit
|
Unit of the data, if applicable.
TYPE:
|
category
|
Category the data falls into, e.g. 'detected r peak'.
TYPE:
|
description
|
Human readable extended description of the data.
TYPE:
|
parameters
|
Parameters used to derive the data. |
derived_from
|
Traceback of intermediates from which the current data was derived. |
values
|
List or array of values. These van be numeric data, text or Python objects.
TYPE:
|
t
property
¶
t: TimeIndexer
select_by_time
¶
select_by_time(
start_time: float | None = None,
end_time: float | None = None,
start_inclusive: bool = False,
end_inclusive: bool = False,
label: str | None = None,
) -> Self
Get a shortened copy of the object, starting from start_time and ending at end_time.
Given a start and end time stamp (i.e. its value, not its index), return a slice of the original object, which must contain a time axis.
PARAMETER | DESCRIPTION |
---|---|
start_time
|
first time point to include. Defaults to first frame of sequence.
TYPE:
|
end_time
|
last time point. Defaults to last frame of sequence.
TYPE:
|
start_inclusive
|
TYPE:
|
label
|
Description. Defaults to None, which will create a label based on the original object label and the frames by which it is sliced.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
TypeError
|
if |
ValueError
|
if time stamps are not sorted. |
RETURNS | DESCRIPTION |
---|---|
Self
|
A shortened copy of the object. |
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. |