bpod_core.bpod.Bpod
- class bpod_core.bpod.Bpod
Bases:
AbstractBpod
Bpod class for interfacing with the Bpod Finite State Machine.
- open() None
Open the connection to the Bpod.
- Raises:
SerialException – If the port could not be opened.
BpodException – If the handshake fails.
- Return type:
- send_state_machine(state_machine, *, run_asap=False, validate_only=False) None
Send a state machine to the Bpod.
This method compiles the provided state machine into a byte array format compatible with the Bpod and sends it to the device. It also validates the state machine for compatibility with the hardware before sending.
- Parameters:
state_machine (
StateMachine
) – The state machine to be sent to the Bpod device.run_asap (
bool
, optional) – If True, the state machine will run immediately after the current one has finished. Default is False.validate_only (
bool
, optional) – If True, the state machine is only validated and not sent to the device. Default is False.
- Raises:
ValueError – If the state machine is invalid or exceeds hardware limitations.
validate_callCallHintViolation – If function arguments don’t match type hints.
- Return type:
- validate_state_machine(state_machine) None
Validate the provided state machine for compatibility with the hardware.
- Parameters:
state_machine (
StateMachine
) – The state machine to validate.- Raises:
ValueError – If the state machine is invalid or not compatible with the hardware.
- Return type:
- wait() None
Wait for the currently running state machine to finish.
This method blocks until the state machine has finished executing. If no state machine is currently running, it raises a RuntimeError.
- Return type:
-
inputs:
NamedTuple
Available input channels.
-
modules:
NamedTuple
Available modules.
-
outputs:
NamedTuple
Available output channels.
-
serial0:
ExtendedSerial
Primary serial device for communication with the Bpod.
-
serial1:
ExtendedSerial
|None
= None Secondary serial device for communication with the Bpod.
-
serial2:
ExtendedSerial
|None
= None Tertiary serial device for communication with the Bpod - used by Bpod 2+ only.