m3resp.coerce_interval#
- m3resp.coerce_interval(value, *, name=None, modality=None, source=None)[source]#
Convert one timed interval into an
Interval.- Parameters:
value (Any) – An
Interval, a dictionary or object withstart_timeandend_time(including eitprocessing’sInterval), or a(start_time, end_time)pair. Times are in seconds.name (str | None) – Interval kind used when the input’s name is missing or empty. Required for a pair.
'breath'selectsBreathEvent.modality (str | None) – Device or technique used when the input’s modality is missing or empty. Required for a pair.
source (str | None) – Method name used when the input’s source is missing or empty.
- Returns:
- The existing interval unchanged, or a new interval with the
input’s fields. A converted input named
'breath'or carrying a turning point becomes aBreathEvent; the turning point is read as incoerce_breath_event(). Input identifiers are preserved; a new identifier is generated when omitted.
- Return type:
- Raises:
ValueError – If a required name, modality or dictionary time is missing, a pair has other than two entries, or the end precedes the start. Also raised when a time or sampling rate cannot be converted to a number, or an input with a turning point has a name other than
'breath'.TypeError – If the input has an unsupported form or a time or sampling rate has an unsupported type.