m3resp.coerce_breath_event#
- m3resp.coerce_breath_event(value, *, modality=None, source=None)[source]#
Convert one detected breath into a
BreathEvent.The turning point is read from
extremum_timeandextremum_index, then from the olderpeak_timeandpeak_index, then from eitprocessing’smiddle_time. The first pair with a value is used, and both time and index come from that pair. Readingpeak_timeorpeak_indexgives aUserWarningnaming the current fields.- Parameters:
value (Any) – A
BreathEvent, a dictionary or object withstart_timeandend_time, or a(start_time, end_time)sequence with an optional third entry,extremum_time. All times are in seconds.modality (str | None) – Device or technique used when the input’s modality is missing or empty. Required for a sequence.
source (str | None) – Method name used when the input’s source is missing or empty.
- Returns:
- The existing breath unchanged, or a new breath with the
input’s timing, sample indices, label, identifier and metadata. A new identifier is generated when the input omits one.
- Return type:
- Raises:
ValueError – If the input has a name other than
'breath', omits a required modality or dictionary time, has other than two or three sequence entries, or ends before it starts. Also raised when a time or sampling rate cannot be converted to a number.TypeError – If the input has an unsupported form or a time or sampling rate has an unsupported type.