m3resp.Interval#
- class m3resp.Interval(modality, start_time, end_time, *, name, id=<factory>, label=None, start_index=None, end_index=None, sample_frequency=None, signal_name=None, source=None, confidence=None, metadata=<factory>)[source]#
A stretch of time from one modality, with a start and an end.
Use it for an occlusion, a period of noise, an expiratory hold, or an intervention. Times are in seconds on the recording’s time axis or the shared clock after alignment. Zero duration is allowed when only one time point is known, as with EMG breaths detected from their peaks.
BreathEventis anIntervalwith one more point inside it, the signal’s turning point.- Variables:
modality (str) – The device or technique the interval came from, e.g.
'ventilator'or'emg'.start_time (float) – Start of the interval, in seconds on its time axis.
end_time (float) – End of the interval, in seconds on the same time axis.
name (str) – What kind of interval this is, e.g.
'occlusion'or'noise'. Required, and given by keyword.id (str) – Random identifier that stays the same through time shifts and saving. See
Eventfor the full explanation.label (str | None) – Optional name for this particular occurrence of the interval.
start_index (int | None) – Position of
start_timein the signal this interval was found in.Nonewhen the interval wasn’t derived from indexing into a signal.end_index (int | None) – Position of
end_timein that signal, orNone.sample_frequency (float | None) – Sampling rate of that signal, in Hz. Together with
signal_nameit says which time axis the*_indexfields are relative to, since different signals have different start times, durations, and sampling rates.signal_name (str | None) – Which signal the
*_indexfields refer to.source (str | None) – Optional name of the method that produced this interval.
confidence (float | None) – Optional measure of how sure that method was.
metadata (dict[str, Any]) – Optional extra information about the interval.
- Parameters:
Everything after
end_timeis given by keyword, e.g.Interval("ventilator", 10.0, 12.5, name="occlusion").- Raises:
ValueError – If
end_timeis beforestart_time.- Parameters:
Attributes
Return the interval duration in seconds.