eitprocessing.datahandling.continuousdata

Attributes

T

Classes

ContinuousData

Container for data with a continuous time axis.

Module Contents

eitprocessing.datahandling.continuousdata.T[source]
class eitprocessing.datahandling.continuousdata.ContinuousData[source]

Bases: eitprocessing.datahandling.DataContainer, eitprocessing.datahandling.mixins.slicing.SelectByTime

Container for data with a continuous time axis.

Continuous data is assumed to be sequential (i.e. a single data point at each time point, sorted by time) and continuously measured/created at a fixed sampling frequency. However, a fixed interval between consecutive time points is not enforced to account for floating point arithmetic, devices with imperfect sampling frequencies, and other sources of variation.

Parameters:
  • label – Computer readable naming of the instance.

  • name – Human readable naming of the instance.

  • unit – Unit of the data, if applicable.

  • category – Category the data falls into, e.g. ‘airway pressure’.

  • description – Human readable extended description of the data.

  • parameters – Parameters used to derive this data.

  • derived_from – Traceback of intermediates from which the current data was derived.

  • values – Data points.

label: str[source]
name: str[source]
unit: str[source]
category: str[source]
description: str[source]
parameters: dict[str, typing_extensions.Any][source]
derived_from: typing_extensions.Any | list[typing_extensions.Any][source]
time: numpy.ndarray[source]
values: numpy.ndarray[source]
sample_frequency: float | None[source]
__post_init__() None[source]
__setattr__(attr: str, value: typing_extensions.Any)[source]
copy(label: str, *, name: str | None = None, unit: str | None = None, description: str | None = None, parameters: dict | None = None) typing_extensions.Self[source]

Create a copy.

Whenever data is altered, it should probably be copied first. The alterations should then be made in the copy.

__add__(other: T) T[source]
concatenate(other: T, newlabel: str | None = None) T[source]
derive(label: str, function: collections.abc.Callable, func_args: dict | None = None, **kwargs) typing_extensions.Self[source]

Create a copy deriving data from values attribute.

Parameters:
  • label – New label for the derived object.

  • function – Function that takes the values and returns the derived values.

  • func_args – Arguments to pass to function, if any.

  • **kwargs – Values for changed attributes of derived object.

Example: ``` def convert_data(x, add=None, subtract=None, multiply=None, divide=None):

if add:

x += add

if subtract:

x -= subtract

if multiply:

x *= multiply

if divide:

x /= divide

return x

data = ContinuousData(

name=”Lung volume (in mL)”, label=”volume_mL”, unit=”mL”, category=”volume”, values=some_loaded_data

) derived = data.derive(“volume_L”, convert_data, {“divide”: 1000}, name=”Lung volume (in L)”, unit=”L”) ```

lock(*attr: str) None[source]

Lock attributes, essentially rendering them read-only.

Locked attributes cannot be overwritten. Attributes can be unlocked using unlock().

Parameters:

*attr – any number of attributes can be passed here, all of which will be locked. Defaults to “values”.

Examples

>>> # lock the `values` attribute of `data`
>>> data.lock()
>>> data.values = [1, 2, 3] # will result in an AttributeError
>>> data.values[0] = 1      # will result in a RuntimeError
unlock(*attr: str) None[source]

Unlock attributes, rendering them editable.

Locked attributes cannot be overwritten, but can be unlocked with this function to make them editable.

Parameters:

*attr – any number of attributes can be passed here, all of which will be unlocked. Defaults to “values”.

Examples

>>> # lock the `values` attribute of `data`
>>> data.lock()
>>> data.values = [1, 2, 3] # will result in an AttributeError
>>> data.values[0] = 1      # will result in a RuntimeError
>>> data.unlock()
>>> data.values = [1, 2, 3]
>>> print(data.values)
[1,2,3]
>>> data.values[0] = 1      # will result in a RuntimeError
>>> print(data.values)
1
property locked: bool[source]

Return whether the values attribute is locked.

See lock().

property loaded: bool[source]

Return whether the data was loaded from disk, or derived from elsewhere.

__len__()[source]
_sliced_copy(start_index: int, end_index: int, newlabel: str) typing_extensions.Self[source]

Slicing method that must be implemented by all subclasses.

Must return a copy of self object with all attached data within selected indices.