Plot¶
Widgets to plot waveforms of sensor values
The PVP_Gui
creates a Plot_Container
that allows the user to select
which plots (of those in
values.PLOT
) are displayedthe timescale (x range) of the displayed waveforms
Plots display alarm limits as red horizontal bars
Data:
A |
|
Update frequency of |
Classes:
|
Waveform plot of single sensor value. |
|
Container for multiple :class;`.Plot` objects |
- class pvp.gui.widgets.plot.Plot(name: str, buffer_size: int = 4092, plot_duration: float = 10, plot_limits: Optional[tuple] = None, color=None, units='', **kwargs)[source]¶
Waveform plot of single sensor value.
Plots values continuously, wrapping at zero rather than shifting x axis.
- Parameters
- timestamps¶
deque of timestamps
- Type
- history¶
deque of sensor values
- Type
- cycles¶
deque of breath cycles
- Type
When initializing PlotWidget, parent and background are passed to
GraphicsWidget.__init__()
and all others are passed toPlotItem.__init__()
.Attributes:
limits_changed
(*args, **kwargs)Methods:
set_duration
(dur)Set duration, or span of x axis.
update_value
(new_value)Update with new sensor value
set_safe_limits
(limits)Set the position of the max and min lines for a given value
Reset start time -- return the scrolling time bar to position 0
set_units
(units)Set displayed units
- limits_changed(*args, **kwargs) = <PySide2.QtCore.Signal object>¶
- set_duration(dur: float)[source]¶
Set duration, or span of x axis.
- Parameters
dur (float) – span of x axis (in seconds)
- update_value(new_value: tuple)[source]¶
Update with new sensor value
- Parameters
new_value (tuple) – (timestamp from time.time(), breath_cycle, value)
- set_safe_limits(limits: pvp.common.message.ControlSetting)[source]¶
Set the position of the max and min lines for a given value
- Parameters
limits (
ControlSetting
) – Controlsetting that has either amin_value
ormax_value
defined
- set_units(units)[source]¶
Set displayed units
Currently only implemented for Pressure, display either in cmH2O or hPa
- Parameters
units ('cmH2O', 'hPa') – unit to display pressure as
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶
- class pvp.gui.widgets.plot.Plot_Container(plot_descriptors: Dict[pvp.common.values.ValueName, pvp.common.values.Value], *args, **kwargs)[source]¶
Container for multiple :class;`.Plot` objects
Allows user to show/hide different plots and adjust x-span (time zoom)
Note
Currently, the only unfortunately hardcoded parameter in the whole GUI is the instruction to initially hide FIO2, there should be an additional parameter in
Value
that says whether a plot should initialize as hidden or notTodo
Currently, colors are set to alternate between orange and light blue on initialization, but they don’t update when plots are shown/hidden, so the alternating can be lost and colors can look random depending on what’s selcted.
- slider¶
slider used to set x span
- Type
PySide2.QtWidgets.QSlider
Methods:
init_ui
()update_value
(vals)Try to update all plots who have new sensorvalues
toggle_plot
(state)Toggle the visibility of a plot.
set_safe_limits
(control)Try to set horizontal alarm limits on all relevant plots
set_duration
(duration)Set the current duration (span of the x axis) of all plots
Call
Plot.reset_start_time()
on all plotsset_units
(units)Call
Plot.set_units()
for all contained plotsAttributes:
- update_value(vals: pvp.common.message.SensorValues)[source]¶
Try to update all plots who have new sensorvalues
- Parameters
vals (
SensorValues
) – Sensor Values to update plots with
- toggle_plot(state: bool)[source]¶
Toggle the visibility of a plot.
get the name of the plot from the
sender
’sobjectName
- Parameters
state (bool) – Whether the plot should be visible (True) or not (False)
- set_safe_limits(control: pvp.common.message.ControlSetting)[source]¶
Try to set horizontal alarm limits on all relevant plots
- Parameters
control (
ControlSetting
) – with eithermin_value
ormax_value
set
Returns:
- set_duration(duration: float)[source]¶
Set the current duration (span of the x axis) of all plots
Also make sure that the text box and slider reflect this duration
- Parameters
duration (float) – new duration to set
Returns:
- reset_start_time()[source]¶
Call
Plot.reset_start_time()
on all plots
- set_units(units: str)[source]¶
Call
Plot.set_units()
for all contained plots
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶