bpod_core.bpod.flexio#

Classes implementing the FlexIO subsystem.

Classes#

class bpod_core.bpod.flexio.FlexIO #

Bases: AbstractFlexIO

Local FlexIO implementation with direct hardware access.

reset() #

Reset the FlexIO subsystem to its default settings.

Overrides:

AbstractFlexIO.reset

property analog_sampling_rate: int #

Sampling rate for channels configured as analog input, in Hz (1-1000).

The interval between samples is a whole number of state machine cycles (100 µs on a Bpod 2+), so other rates are rounded: 300 Hz, for example, becomes 303.03 Hz. Analog timestamps are based on the actual rate. The rate is fixed from the first trial until the Bpod is closed and reopened.

property n_reads_per_sample: int #

Number of ADC reads averaged per analog sample (1-4).

More reads reduce noise. The Bpod takes all reads of a sample within a single state machine cycle, so they don't limit the sampling rate.

Functions#

bpod_core.bpod.flexio.is_flexio_threshold_ambiguous(channel_types, index) #

Whether channel index's analog-threshold event codes are ambiguous.

Firmware numbers analog-threshold events by rank among ANALOG_INPUT channels only, not by physical channel index, while every other FlexIO event (digital transitions, etc.) is numbered by fixed physical position. The two schemes only agree when channel index is preceded exclusively by other ANALOG_INPUT channels; otherwise its Trig0/Trig1 codes collide with another channel's fixed-position event codes, an upstream firmware quirk also present in MATLAB.

Return type:

bool