playground

Functions

measure_softcode_latency(bpod[, n_trials])

Measures the round-trip latency of softcodes sent to Bpod.

Classes

BpodWithLatencyTest(*args, **kwargs)

Class to test Bpod latency by measuring round-trip time of softcodes.

class BpodWithLatencyTest(*args, **kwargs)[source]

Bases: object

Class to test Bpod latency by measuring round-trip time of softcodes.

softcode_handler_function(data: int)[source]

Callback executed when a softcode is received from Bpod.

This function is used to measure the time when the softcode response arrives. It sets the _softcode_event to signal completion of a round trip.

Parameters:

data (int) – The softcode data received (opcode).

measure_softcode_latency(bpod: BpodWithLatencyTest, n_trials: int = 100)[source]

Measures the round-trip latency of softcodes sent to Bpod.

Sends a softcode to Bpod and waits for an echo response (softcode opcode 2), measuring the time taken for the round trip.

Parameters:
  • bpod (BpodWithLatencyTest) – The Bpod instance wrapper to test.

  • n_trials (int, optional) – Number of trials to run. Defaults to 100.