plot
Primary plot widgets that contain items from geom
Functions:
|
Wrapper/decorator around an event that posts GUI events back to the main thread that our window is running in. |
Classes:
|
Main plot widget that holds plots for all pilots |
|
Widget that hosts a |
- gui_event(fn)[source]
Wrapper/decorator around an event that posts GUI events back to the main thread that our window is running in.
- Parameters:
fn (callable) – a function that does something to the GUI
- class Plot_Widget(self, /, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags), *, modal: bool | None = None, windowModality: PySide6.QtCore.Qt.WindowModality | None = None, enabled: bool | None = None, geometry: PySide6.QtCore.QRect | None = None, frameGeometry: PySide6.QtCore.QRect | None = None, normalGeometry: PySide6.QtCore.QRect | None = None, x: int | None = None, y: int | None = None, pos: PySide6.QtCore.QPoint | None = None, frameSize: PySide6.QtCore.QSize | None = None, size: PySide6.QtCore.QSize | None = None, width: int | None = None, height: int | None = None, rect: PySide6.QtCore.QRect | None = None, childrenRect: PySide6.QtCore.QRect | None = None, childrenRegion: PySide6.QtGui.QRegion | None = None, sizePolicy: PySide6.QtWidgets.QSizePolicy | None = None, minimumSize: PySide6.QtCore.QSize | None = None, maximumSize: PySide6.QtCore.QSize | None = None, minimumWidth: int | None = None, minimumHeight: int | None = None, maximumWidth: int | None = None, maximumHeight: int | None = None, sizeIncrement: PySide6.QtCore.QSize | None = None, baseSize: PySide6.QtCore.QSize | None = None, palette: PySide6.QtGui.QPalette | None = None, font: PySide6.QtGui.QFont | None = None, cursor: PySide6.QtGui.QCursor | None = None, mouseTracking: bool | None = None, tabletTracking: bool | None = None, isActiveWindow: bool | None = None, focusPolicy: PySide6.QtCore.Qt.FocusPolicy | None = None, focus: bool | None = None, contextMenuPolicy: PySide6.QtCore.Qt.ContextMenuPolicy | None = None, updatesEnabled: bool | None = None, visible: bool | None = None, minimized: bool | None = None, maximized: bool | None = None, fullScreen: bool | None = None, sizeHint: PySide6.QtCore.QSize | None = None, minimumSizeHint: PySide6.QtCore.QSize | None = None, acceptDrops: bool | None = None, windowTitle: str | None = None, windowIcon: PySide6.QtGui.QIcon | None = None, windowIconText: str | None = None, windowOpacity: float | None = None, windowModified: bool | None = None, toolTip: str | None = None, toolTipDuration: int | None = None, statusTip: str | None = None, whatsThis: str | None = None, accessibleName: str | None = None, accessibleDescription: str | None = None, layoutDirection: PySide6.QtCore.Qt.LayoutDirection | None = None, autoFillBackground: bool | None = None, styleSheet: str | None = None, locale: PySide6.QtCore.QLocale | None = None, windowFilePath: str | None = None, inputMethodHints: PySide6.QtCore.Qt.InputMethodHint | None = None)[source]
Bases:
QWidgetMain plot widget that holds plots for all pilots
Essentially just a container to give plots a layout and handle any logic that should apply to all plots.
- Variables:
Initialize self. See help(type(self)) for accurate signature.
Methods:
init_plots(pilot_list)For each pilot, instantiate a
Plotand add to layout.Attributes:
- init_plots(pilot_list)[source]
For each pilot, instantiate a
Plotand add to layout.- Parameters:
pilot_list (list) – the keys from
Terminal.pilots
- staticMetaObject = PySide6.QtCore.QMetaObject("Plot_Widget" inherits "QWidget": )
- class Plot(pilot, x_width=50, parent=None)[source]
Bases:
QWidgetWidget that hosts a
pyqtgraph.PlotWidgetand manages graphical objects for one pilot depending on the task.listens
Key
Method
Description
‘START’
starting a new task
‘DATA’
getting a new datapoint
‘STOP’
stop the task
‘PARAM’
change some parameter
Plot Parameters
The plot is built from the
PLOT={data:plot_element}mappings described in theTaskclass. Additional parameters can be specified in thePLOTdictionary. Currently:continuous (bool): whether the data should be plotted against the trial number (False or NA) or against time (True)
chance_bar (bool): Whether to draw a red horizontal line at chance level (default: 0.5)
chance_level (float): The position in the y-axis at which the
chance_barshould be drawnroll_window (int): The number of trials
Roll_Meantake the average over.
- Variables:
pilot (str) –
The name of our pilot, used to set the identity of our socket, specifically:
'P_{pilot}'
infobox (
QtWidgets.QFormLayout) – Box to plot basic task information like trial number, etc.info (dict) –
Widgets in infobox:
’N Trials’:
QtWidgets.QLabel,’Runtime’ :
Timer,’Session’ :
QtWidgets.QLabel,’Protocol’:
QtWidgets.QLabel,’Step’ :
QtWidgets.QLabel
plot (
pyqtgraph.PlotWidget) – The widget where we draw our plotsplot_params (dict) – A dictionary of plot parameters we receive from the Task class
data (dict) – A dictionary of the data we’ve received
plots (dict) – The collection of plots we instantiate based on plot_params
node (
Net_Node) – Our local net node where we listen for data.state (str) – state of the pilot, used to keep plot synchronized.
- Parameters:
pilot (str) – The name of our pilot
x_width (int) – How many trials in the past should we plot?
Methods:
Make pre-task GUI objects and set basic visual parameters of self.plot
l_start(value)Starting a task, initialize task-specific plot objects described in the
Task.PLOTattribute.l_data(value)Receive some data, if we were told to plot it, stash the data and update the assigned plot.
l_stop(value)Clean up the plot objects.
l_param(value)Warning
Not implemented
l_state(value)Pilot letting us know its state has changed.
Attributes:
- l_start(value)[source]
Starting a task, initialize task-specific plot objects described in the
Task.PLOTattribute.Matches the data field name (keys of
Task.PLOT) to the plot object that represents it, eg, to make the standard nafc plot:{'target' : 'point', 'response' : 'segment', 'correct' : 'rollmean'}
- Parameters:
value (dict) – The same parameter dictionary sent by
Terminal.toggle_start(), includingcurrent_trial
step
session
step_name
task_type
- l_data(value)[source]
Receive some data, if we were told to plot it, stash the data and update the assigned plot.
- Parameters:
value (dict) – Value field of a data message sent during a task.
- l_stop(value)[source]
Clean up the plot objects.
- Parameters:
value (dict) – if “graduation” is a key, don’t stop the timer.
- l_state(value)[source]
Pilot letting us know its state has changed. Mostly for the case where we think we’re running but the pi doesn’t.
- Parameters:
value (
Pilot.state) – the state of our pilot
- staticMetaObject = PySide6.QtCore.QMetaObject("Plot" inherits "QWidget": )