Skip to content

Review figures

plotting

Figures to review a recording before trusting its numbers.

  • plot_segmentation(raw, segments): the parts chosen by the user (phases, exclusions, PEEP steps placed by hand) on the global signal and the airway pressure of the file, before preprocess();
  • plot_breaths(result): the breaths found by preprocess(), which ones are used for the indices, flagged or excluded; for a PEEP trial the steps with their PEEP level; the lung mask with its tidal image.

Colours and markers are fixed here, so that every figure shows the same thing in the same way. Each function returns a matplotlib Figure.

plot_segmentation

plot_segmentation(raw: ReconstructedFrameData, segments: Sequence[Segment] = (), title: str = '') -> Figure

The segments typed by the user on the file, before preprocess().

Phases are coloured by protocol, exclusions are grey and hatched, PEEP steps placed by hand carry their level. The airway pressure (cmH2O) is drawn below when the file has it.

Parameters:

Name Type Description Default
raw ReconstructedFrameData

Output of load_data().

required
segments Sequence[Segment]

Phases, exclusions and PEEP steps (Segment), in seconds from the start of the recording.

()
title str

Title of the figure.

''

Returns:

Type Description
Figure

The figure: global signal on top, airway pressure below.

plot_breaths

plot_breaths(result: EITRecording | PeepTrial | TidalFeatures | PeepTrialFeatures, title: str = '') -> Figure

The breaths found by preprocess() and the ones used for the indices.

Each breath is a marker at its end-inspiratory peak on the signal the breaths were found on: used for the indices (filled blue circle), valid but not used (empty blue circle, e.g. outside the phase, or in the first seconds of a PEEP step), flagged by a quality check (orange triangle), excluded (grey cross, with the excluded parts as grey bands). For a PEEP trial the steps are shaded and labelled with their PEEP level of the protocol (or the measured level), and the PEEP of each breath is drawn below. On the right: the tidal image inside the lung mask.

Parameters:

Name Type Description Default
result EITRecording | PeepTrial | TidalFeatures | PeepTrialFeatures

Output of preprocess(), segment_peep_trial(), tidal_features() or peep_trial_features().

required
title str

Title of the figure.

''

Returns:

Type Description
Figure

The figure.