Skip to main content
Ctrl+K

M3Resp documentation

  • Getting started
  • Tutorials
  • How-to guides
  • Concepts
  • Workflows
    • Public API
    • Get help
    • Cite M3Resp
    • Developer guide
  • GitHub
  • Getting started
  • Tutorials
  • How-to guides
  • Concepts
  • Workflows
  • Public API
  • Get help
  • Cite M3Resp
  • Developer guide
  • GitHub
  • Public API
  • m3resp.link_breaths_by_time

m3resp.link_breaths_by_time#

m3resp.link_breaths_by_time(breaths_by_modality=None, *, time_tolerance=0.5)[source]#

Group breaths across modalities by their timing in seconds.

Each breath is used once. Its representative time is extremum_time when available, otherwise the midpoint of start/end. Modalities are visited in mapping order, with each modality’s breaths sorted by this time. For each unassigned breath, the closest unused breath from each other modality is added if it falls within time_tolerance of that breath. For equal distances, the first match in sorted order is used.

Parameters:
  • breaths_by_modality (Mapping[str, Sequence[BreathEvent] | None] | None) – Modality names mapped to breath sequences or None. Breath times must share a time axis. None gives an empty result.

  • time_tolerance (float) – Maximum time difference in seconds from the breath that starts a group; must be at least zero.

Returns:

Groups ordered by the representative time of their

first breath, containing the original breath objects. Unmatched breaths form single-modality groups with confidence=None. Matched groups have confidence 1 - largest_time_difference/tolerance; exact matches with zero tolerance have confidence=1.

Return type:

list[LinkedBreath]

Raises:

ValueError – If time_tolerance is negative.

previous

m3resp.compute_offsets_from_timestamps

next

m3resp.Case

In this section
  • m3resp.M3Session
  • m3resp.Preset
  • m3resp.EITPreset
  • m3resp.EMGPreset
  • m3resp.MultimodalPreset
  • m3resp.WorkflowResult
  • m3resp.available_presets
  • m3resp.get_preset
  • m3resp.register_preset
  • m3resp.load_spec
  • m3resp.run_workflow
  • m3resp.run_spec
  • m3resp.available_steps
  • m3resp.register_step
  • m3resp.workflows.WorkflowSpec
  • m3resp.workflows.StepSpec
  • m3resp.workflows.ValidationReport
  • m3resp.workflows.CompiledWorkflow
  • m3resp.workflows.WorkflowService
  • m3resp.workflows.collect_diagnostics
  • m3resp.workflows.compile_workflow
  • m3resp.workflows.validate_workflow
  • m3resp.workflows.validate_spec
  • m3resp.TimeSeries
  • m3resp.Signal
  • m3resp.SignalCollection
  • m3resp.interpolate_to_time
  • m3resp.ParameterResult
  • m3resp.ParameterResultCollection
  • m3resp.QualityFlag
  • m3resp.QualityReport
  • m3resp.ProcessingStep
  • m3resp.ProcessingHistory
  • m3resp.Event
  • m3resp.Interval
  • m3resp.BreathEvent
  • m3resp.EventData
  • m3resp.IntervalData
  • m3resp.IntervalDataCollection
  • m3resp.PixelMap
  • m3resp.PixelMask
  • m3resp.PixelMaskCollection
  • m3resp.pixel_breath_events
  • m3resp.LinkedBreath
  • m3resp.coerce_event
  • m3resp.coerce_events
  • m3resp.coerce_interval
  • m3resp.coerce_intervals
  • m3resp.coerce_breath_event
  • m3resp.coerce_breath_events
  • m3resp.event_to_dict
  • m3resp.compute_offsets_from_timestamps
  • m3resp.link_breaths_by_time
  • m3resp.Case
  • m3resp.ClinicalEvent
  • m3resp.DataFile
  • m3resp.DataModelRecorder
  • m3resp.DataModelStore
  • m3resp.DerivedFeature
  • m3resp.Device
  • m3resp.ProcessingRun
  • m3resp.QualityAnnotation
  • m3resp.RecordingSession
  • m3resp.SignalStream
  • m3resp.export_store
  • m3resp.validate_store
  • m3resp.export.export_session_summary
  • m3resp.io.load_eit
  • m3resp.io.load_emg
  • m3resp.visualization.plot_eit_processing_summary
  • m3resp.visualization.plot_session_overview
  • m3resp.visualization.plot_synchronization_comparison
  • m3resp.synthetic.SyntheticGeneratorConfig
  • m3resp.synthetic.SyntheticDataset
  • m3resp.synthetic.SyntheticRecord
  • m3resp.synthetic.RespiratoryPatternConfig
  • m3resp.synthetic.EITGeneratorConfig
  • m3resp.synthetic.EMGGeneratorConfig
  • m3resp.synthetic.VentilatorGeneratorConfig
  • m3resp.synthetic.generate_synthetic_dataset
  • m3resp.synthetic.generate_realistic_eit_signal
  • m3resp.synthetic.load_synthetic_generator_config
On this page
  • link_breaths_by_time()

© Copyright 2026, M3Resp contributors.

Built with Sphinx 9.1.1 and the PyData Sphinx Theme 0.23.0.