menus
file
Classes:
|
A dialog window to create a new protocol. |
- class Protocol_Wizard(self, /, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags), *, sizeGripEnabled: bool | None = None, modal: bool | None = None)[source]
Bases:
QDialogA dialog window to create a new protocol.
Warning
This is a heavily overloaded class, and will be split into separate objects to handle parameters separately. For now this is what we got though and it works.
Protocols are collections of multiple tasks (steps) with some graduation criterion for moving between them.
This widget is composed of three windows:
left: possible task types from
autopilot.get_task()center: current steps in task
right:
Parametersfor currently selected step.
The parameters that are used are of the form used by
Task.PARAMS(seeNafc.PARAMSfor an example).Todo
Make specific parameter class so this definition is less squishy
its general structure is:
{'parameter_key': {'tag':'Human Readable Name', 'type':'param_type'}}
while some parameter types have extra items, eg.:
{'list_param': {'tag':'Select from a List of Parameters', 'type': 'list', 'values': {'First Option':0, 'Second Option':1}}
where k:v pairs are still used with lists to allow parameter values (0, 1) be human readable.
The available types include:
int - integer
float - floating point number
bool - boolean boolbox
list - a list of values to choose from
sounds - a
Sound_Widgetthat allows sounds to be defined.graduation - a
Graduation_Widgetthat allows graduation criteria to be defined
- Variables:
task_list (
QtWidgets.QListWidget) – The leftmost window, lists available tasksstep_list (
QtWidgets.QListWidget) – The center window, lists tasks currently in protocolparam_layout (
QtWidgets.QFormLayout) – The right window, allows changing available parameters for currently selected step.steps (list) – A list of dictionaries defining the protocol.
Initialize self. See help(type(self)) for accurate signature.
Methods:
add_step()Loads PARAMS from task object, adds base parameters to
stepslistWhen the step name widget's text is changed, fire this function to update
step_listwhich updatesstepsRemove step from
step_listandstepsCalls
clear_params()and then creates widgets to edit parameter values.Clears widgets from parameter window
reorder_steps(*args)When steps are dragged into a different order, update the step dictionary
Callback function connected to the signal each widget uses to signal it has changed.
Stores parameters that define sounds.
Stores parameters that define graduation criteria in self.steps
Handle dependencies between parameters, eg.
Attributes:
- rename_step()[source]
When the step name widget’s text is changed, fire this function to update
step_listwhich updatessteps
- populate_params()[source]
Calls
clear_params()and then creates widgets to edit parameter values. Returns:
- reorder_steps(*args)[source]
When steps are dragged into a different order, update the step dictionary
- Parameters:
*args – Input from our
step_list‘sQtWidgets.QListModel‘s reorder signal.
- set_param()[source]
Callback function connected to the signal each widget uses to signal it has changed.
Identifies the param that was changed, gets the current value, and updates self.steps
- set_sounds()[source]
Stores parameters that define sounds.
Sound parameters work a bit differently, specifically we have to retrieve
Sound_Widget.sound_dict.
- set_graduation()[source]
Stores parameters that define graduation criteria in self.steps
Graduation parameters work a bit differently, specifically we have to retrieve
Graduation_Widget.param_dict.
- check_depends()[source]
Handle dependencies between parameters, eg. if “correction trials” are unchecked, the box that defines the correction trial percentage should be grayed out.
Todo
Not implemented.
- staticMetaObject = PySide6.QtCore.QMetaObject("Protocol_Wizard" inherits "QDialog": )
plots
Classes:
|
A Dialog to select subjects, steps, and variables to use in a psychometric curve plot. |
- class Psychometric(self, /, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags), *, sizeGripEnabled: bool | None = None, modal: bool | None = None)[source]
Bases:
QDialogA Dialog to select subjects, steps, and variables to use in a psychometric curve plot.
See
Terminal.plot_psychometric()- Parameters:
subjects_protocols (dict) – The Terminals
Terminal.subjects_protocolsdict- Variables:
plot_params (list) – A list of tuples, each consisting of (subject_id, step, variable) to be given to
viz.plot_psychometric()
Initialize self. See help(type(self)) for accurate signature.
Methods:
init_ui()populate_steps(subject)When a protocol is selected, populate the selection box with the steps that can be chosen.
Fill selection boxes with step and variable names
Toggle all checkboxes on or off
Attributes:
Generate parameters for plot to be passed to
viz.plot_psychometric()- populate_steps(subject)[source]
When a protocol is selected, populate the selection box with the steps that can be chosen.
- Parameters:
subject (str) – ID of subject whose steps are being populated
- property plot_params
Generate parameters for plot to be passed to
viz.plot_psychometric()- Returns:
(subject_name, step_name, x_var_name, n_trials_back)
- Return type:
- staticMetaObject = PySide6.QtCore.QMetaObject("Psychometric" inherits "QDialog": )
plugins
Classes:
|
Dialog window that allows plugins to be viewed and installed. |
- class Plugins(self, /, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags), *, sizeGripEnabled: bool | None = None, modal: bool | None = None)[source]
Bases:
QDialogDialog window that allows plugins to be viewed and installed.
Works by querying the wiki , find anything in the category
Autopilot Plugins, clone the related repo, and reload plugins.At the moment this widget is a proof of concept and will be made functional asap :)
Initialize self. See help(type(self)) for accurate signature.
Methods:
init_ui()Attributes:
- staticMetaObject = PySide6.QtCore.QMetaObject("Plugins" inherits "QDialog": )
swarm
Classes:
|
Dialogue to stream, display, and save video. |
- class Stream_Video(pilots: dict, *args, **kwargs)[source]
Bases:
QDialogDialogue to stream, display, and save video.
- Parameters:
pilots (dict) – The
Terminal.pilot_dbwith theprefsof each pilot (given byPilot.handshake())
Methods:
init_ui()l_frame(value)closeEvent(self, arg__1, /)Attributes:
- writer
- comboboxes
- buttons
- cam_info
- staticMetaObject = PySide6.QtCore.QMetaObject("Stream_Video" inherits "QDialog": )
tests
Classes:
|
Test the limits of the rate of messaging from the connected Pilots. |
- class Bandwidth_Test(self, /, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags), *, sizeGripEnabled: bool | None = None, modal: bool | None = None)[source]
Bases:
QDialogTest the limits of the rate of messaging from the connected Pilots.
Asks pilots to send messages at varying rates and with varying payload sizes, and with messages with/without receipts.
Measures drop rates and message latency
- Variables:
Initialize self. See help(type(self)) for accurate signature.
Methods:
init_ui()Look we're just making the stuff in the window over here alright? relax.
start()Start the test!!!
send_test(rate, payload, n_msg, confirm, ...)Send a message describing the test to each of the pilots in
Bandwidth_Test.test_pilotsprocess_test(rate, n_msg, confirm, blosc, ...)Process the results of the test and update the plot window.
save()Select save file location for test results (csv) and then save them there
register_msg(value)Receive message from pilot, stash timestamp, number and pilot
update_pbar(val)Checks that the entries in
Bandwidth_Test.ratesandBandwidth_Test.payloadsare well formed.Attributes:
- send_test(rate: int, payload: int, n_msg: int, confirm: bool, blosc: bool, random: bool, preserialized: bool)[source]
Send a message describing the test to each of the pilots in
Bandwidth_Test.test_pilots- Parameters:
rate (int) – Rate of message sending in Hz
payload (int) – Size of message payload in bytes
n_msg (int) – Number of messages to send
confirm (bool) – If True, use message confirmation, if False no confirmation.
blosc (bool) – Use blosc compression?
random (bool) – Use random arrays?
preserialized (bool) – Serialize the message once, rather than serializing every time?
Returns:
- process_test(rate, n_msg, confirm, blosc, random, preserialized)[source]
Process the results of the test and update the plot window.
Reads message results from
messages, appends computed results toresults, and starts the next test if any remain.- Parameters:
rate (int) – Rate of current test in Hz
n_msg (int) – Number of expected messages in this test
confirm (bool) – Whether message confirmations were enabled for this test.
- register_msg(value)[source]
Receive message from pilot, stash timestamp, number and pilot
- Parameters:
value (dict) – Value should contain
Pilot
Timestamp
Message number
Payload
- validate_list()[source]
Checks that the entries in
Bandwidth_Test.ratesandBandwidth_Test.payloadsare well formed.ie. that they are of the form ‘integer, integer, integer’…
pops a window that warns about ill formed entry and clears line edit if badly formed
If the list validates, stored as either
Bandwidth_Test.rate_listorBandwidth_Test.payload_list
- staticMetaObject = PySide6.QtCore.QMetaObject("Bandwidth_Test" inherits "QDialog": )
tools
Classes:
|
A window to calibrate the volume of water dispensed per ms. |
|
A dialog that lets subjects be batch reassigned to new protocols or steps. |
|
A table for viewing and editing the most recent subject weights. |
|
Created by |
- class Calibrate_Water(pilots)[source]
Bases:
QDialogA window to calibrate the volume of water dispensed per ms.
- Parameters:
pilots (
Terminal.pilots) – A dictionary of pilotsmessage_fn (
Net_Node.send()) – The method the Terminal uses to send messages via its net node.
Methods:
init_ui()Attributes:
- staticMetaObject = PySide6.QtCore.QMetaObject("Calibrate_Water" inherits "QDialog": )
- class Reassign(subjects, protocols)[source]
Bases:
QDialogA dialog that lets subjects be batch reassigned to new protocols or steps.
- Parameters:
subjects (dict) –
A dictionary that contains each subject’s protocol and step, ie.:
{'subject_id':['protocol_name', step_int], ... }
protocols (list) – list of protocol files in the prefs.get(‘PROTOCOLDIR’). Not entirely sure why we don’t just list them ourselves here.
Methods:
init_ui()Initializes graphical elements.
populate_steps(subject)When a protocol is selected, populate the selection box with the steps that can be chosen.
When the protocol is changed, stash that and call
Reassign.populate_steps().set_step()When the step is changed, stash that.
Attributes:
- init_ui()[source]
Initializes graphical elements.
Makes a row for each subject where its protocol and step can be changed.
- populate_steps(subject)[source]
When a protocol is selected, populate the selection box with the steps that can be chosen.
- Parameters:
subject (str) – ID of subject whose steps are being populated
- set_protocol()[source]
When the protocol is changed, stash that and call
Reassign.populate_steps(). Returns:
- staticMetaObject = PySide6.QtCore.QMetaObject("Reassign" inherits "QDialog": )
- class Weights(subject_weights, subjects)[source]
Bases:
QTableWidgetA table for viewing and editing the most recent subject weights.
- Parameters:
subject_weights (list) – a list of weights of the format returned by
Subject.get_weight(baseline=True)().subjects (dict) – the Terminal’s
Terminal.subjectsdictionary ofSubjectobjects.
Methods:
init_ui()Initialized graphical elements.
set_weight(row, column)Updates the most recent weights in
gui.Weights.subjectsobjects.Attributes:
- set_weight(row, column)[source]
Updates the most recent weights in
gui.Weights.subjectsobjects.Note
Only the daily weight measurements can be changed this way - not subject name, baseline weight, etc.
- Parameters:
row (int) – row of table
column (int) – column of table
- staticMetaObject = PySide6.QtCore.QMetaObject("Weights" inherits "QTableWidget": )
- class Pilot_Ports(pilot, n_clicks=1000, click_dur=30)[source]
Bases:
QWidgetCreated by
Calibrate_Water, Each pilot’s ports and buttons to control repeated release.- Parameters:
pilot (str) – name of pilot to calibrate
n_clicks (int) – number of times to open the port during calibration
click_dur (int) – how long to open the port (in ms)
Methods:
init_ui()Init the layout for one pilot's ports:
Store the result of a volume calibration test in
volumesSend the calibration test parameters to the
Pilotl_progress(value)Value should contain
Attributes:
- init_ui()[source]
Init the layout for one pilot’s ports:
pilot name
port buttons
3 times and vol dispersed
- Returns:
- start_calibration()[source]
Send the calibration test parameters to the
PilotSends a message with a
'CALIBRATE_PORT'key, which is handled byPilot.l_cal_port()
- l_progress(value)[source]
Value should contain
Pilot
Port
Current Click (click_num)
- Parameters:
value –
- Returns:
- staticMetaObject = PySide6.QtCore.QMetaObject("Pilot_Ports" inherits "QWidget": )