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[source]
Bases:
PySide2.QtWidgets.QWidget
Main 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
Methods:
init_plots
(pilot_list)For each pilot, instantiate a
Plot
and add to layout.Attributes:
- init_plots(pilot_list)[source]
For each pilot, instantiate a
Plot
and add to layout.- Parameters
pilot_list (list) – the keys from
Terminal.pilots
- staticMetaObject = <PySide2.QtCore.QMetaObject object at 0x7efe5b3caa00>
- class Plot(pilot, x_width=50, parent=None)[source]
Bases:
PySide2.QtWidgets.QWidget
Widget that hosts a
pyqtgraph.PlotWidget
and 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 theTask
class. Additional parameters can be specified in thePLOT
dictionary. 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_bar
should be drawnroll_window (int): The number of trials
Roll_Mean
take 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.PLOT
attribute.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.PLOT
attribute.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 = <PySide2.QtCore.QMetaObject object at 0x7efe5da30a80>