bpod_core.bpod.abc¶
Abstract base classes used by the bpod module.
Classes¶
- class bpod_core.bpod.abc.AbstractBpod ¶
Bases:
AbstractContextManagerAbstract base class for Bpod objects.
- abstractmethod get_data(*, concat=True, rechunk=False, lazy=False) ¶
Return trial data from the data queue.
- Parameters:
concat (
bool, default:True) – IfTrue, pop and concatenate all DataFrames currently in the queue into a single DataFrame, blocking until at least one is available. IfFalse, pop and return one DataFrame, blocking until one is available.rechunk (
bool, default:False) – IfTrue, make sure that the result data is in contiguous memory. Only applies whenconcat=True.lazy (
bool, default:False) – IfTrue, return apolars.LazyFrame. IfFalse, return apolars.DataFrame.
- Returns:
One trial’s data, or all available trials concatenated when
concat=True.Columns:
time (
Datetime) – absolute Bpod timestamp.trial (
UInt16) – zero-based trial index.state machine (
Categorical) – state machine hash, seehash().state (
Categorical) – state name.type (
Enum) – event type.event (
Categorical) – input event name.channel (
Categorical) – channel name.value (
UInt8) – channel value.
- Return type:
- Raises:
BpodError – If the queue is empty and no state machine is currently running.
- abstractmethod reset_session_clock() ¶
Reset the Bpod session clock.
- abstractmethod run(state_machine=None, *, trial_number=None, validate=True) ¶
Run a state machine on the Bpod.
Validates, compiles, sends, and queues a state machine for immediate execution. If the Bpod is currently running a state machine, the new one is queued to run as soon as the current one finishes, with no inter-trial gap.
If called without an argument, the previously sent state machine is re-sent from the compilation cache and queued for immediate back-to-back execution.
- Parameters:
state_machine (
StateMachine|None, default:None) – The state machine to run. If not provided, the previously sent state machine is repeated.trial_number (
int|None, default:None) – The trial number to assign to the state machine. If not provided, the trial number is automatically incremented with each run.validate (
bool, default:True) – If False, the state machine will not be validated prior to compilation. This will speed up the process, but may result in errors or unexpected behavior if the state machine is invalid. Use with caution.
- Raises:
RuntimeError – If called without an argument and no state machine has been run yet.
ValueError – If the state machine is invalid or exceeds hardware limitations.
ValidationError – If function arguments don’t match type hints.
Notes
This method returns once the state machine has been queued on the Bpod. The Bpod will then begin executing the state machine as soon as possible — immediately if the device is idle or right after the current state machine finishes. Subsequent calls of this method will result in continuous acquisition and zero inter-trial downtime (as long as the Bpod’s run queue stays filled).
- abstractmethod set_status_led(enable) ¶
Enable or disable the Bpod’s status LED.
- abstractmethod stop_state_machine() ¶
Stop the currently running state machine.
- abstractmethod update_modules() ¶
Update the list of connected modules and their configurations.
- property version: VersionInfo ¶
Version information of the Bpod’s firmware and hardware.