bpod_core.bpod.structs#

Data structures used by the bpod module.

Classes#

class bpod_core.bpod.structs.BpodInfo #

Bases: Struct

Information about a specific Bpod device.

location: str#

User-defined location of the device.

name: str#

User-defined name of the device.

port: str | None#

Port on which the device is connected.

serial_number: str#

Serial number of the device.

zmq_pub: str | None#

ZeroMQ PUB service address.

zmq_rep: str | None#

ZeroMQ REP service address.

class bpod_core.bpod.structs.BpodMessage #

Bases: Struct

Base class for all messages exchanged between ServiceHost and ServiceClient.

class bpod_core.bpod.structs.EventInput #

Bases: BpodMessage

Message for a single input event.

channel: str | None#

Name of the input channel, or None for synthetic events.

event: str#

Name of the input event.

time_us: int#

Absolute time of the event (microseconds since epoch, UTC).

value: int | None#

The event's value, or None if not applicable.

class bpod_core.bpod.structs.EventOutput #

Bases: BpodMessage

Message for a single output action.

channel: str#

Name of the output channel.

time_us: int#

Absolute time of the action (microseconds since epoch, UTC).

value: int#

The value set on the output channel.

class bpod_core.bpod.structs.EventStateEnd #

Bases: BpodMessage

Message marking the end of a state.

state: str#

Name of the state.

time_us: int#

Absolute time of the event (microseconds since epoch, UTC).

class bpod_core.bpod.structs.EventStateStart #

Bases: BpodMessage

Message marking the start of a state.

state: str#

Name of the state.

time_us: int#

Absolute time of the event (microseconds since epoch, UTC).

class bpod_core.bpod.structs.EventTrialEnd #

Bases: BpodMessage

Message marking the end of a trial.

Only published when the hardware exit packet is received: a trial aborted without one publishes neither EventTrialEnd nor EventTrialEndControl - its stream simply ends. See EventTrialStart for the ordering semantics.

time_us: int#

Absolute time of the trial end, derived from the hardware cycle count (microseconds since epoch, UTC).

trial: int#

Zero-based trial index.

class bpod_core.bpod.structs.EventTrialEndControl #

Bases: BpodMessage

Message terminating a trial's stream with timing-verification data.

Trails EventTrialEnd and carries the hardware's independent end-of-trial microsecond count, which the reader's timing-violation warning compares with EventTrialEnd.

n_events: int#

Total number of messages published for the trial (completeness check).

time_us: int#

Hardware microsecond count at the end of the trial (microseconds since epoch, UTC).

trial: int#

Zero-based trial index.

class bpod_core.bpod.structs.EventTrialStart #

Bases: BpodMessage

Message marking the start of a trial.

Trial streams are strictly sequential: all messages between an EventTrialStart and the next EventTrialEnd belong to the trial identified by these markers, and a clean trial's stream is terminated by a trailing EventTrialEndControl.

fsm_hash: str#

Hex digest of the state machine's hash.

time_us: int#

Absolute time of the trial start (microseconds since epoch, UTC).

trial: int#

Zero-based trial index.

class bpod_core.bpod.structs.VersionInfo #

Bases: Struct

Data structure representing various version information.

bpod_core: str#

bpod-core version

firmware: tuple[int, int]#

Firmware version (major, minor)

machine: int#

Machine type (numerical)

machine_str: str#

Machine type (string)

pcb: int | None#

PCB revision, if applicable

Attributes#

bpod_core.bpod.structs.BpodEventType#

Vocabulary of the trial DataFrame's type column.

alias of Literal['TrialStart', 'TrialEnd', 'TrialEndControl', 'StateStart', 'StateEnd', 'InputEvent', 'OutputAction']

bpod_core.bpod.structs.BpodEventUnion: TypeAlias = bpod_core.bpod.structs.EventTrialStart | bpod_core.bpod.structs.EventStateStart | bpod_core.bpod.structs.EventStateEnd | bpod_core.bpod.structs.EventInput | bpod_core.bpod.structs.EventOutput | bpod_core.bpod.structs.EventTrialEnd | bpod_core.bpod.structs.EventTrialEndControl#

Tagged union of all concrete BpodMessage subclasses used for events.