Repository navigation
0.1.0a16
Pre-release
Pre-release
Immutable
release. Only release title and notes can be modified.
Added
- experimental support for the Bpod State Machine 0.7-1.0 (Arduino Due) with firmware
v23. Bpod.wait(timeout=...)raises aTimeoutErrorwhen the state machine hasn't
finished in time.stop_state_machine(timeout=...)waits at mosttimeoutseconds (one by default) for
the Bpod to end the trial; otherwise it gives the trial up and raises a
TimeoutError, and the connection has to be reopened.- support for Python 3.15.
Fixed
run()waits for the state machine sent before to start: sent while the Bpod still
loaded that one, e.g. right after a session's first trial, the next one garbled the
trial data. If it doesn't start within a second,run()gives that trial up and
raises aTimeoutError, and the connection has to be reopened.- a trial whose data can't be read from the Bpod, e.g. after a firmware fault, makes
the nextwait(),run(),close()or other command raise aBpodError, and the
connection has to be reopened, instead of the reader thread dying with a traceback
and the data staying incomplete without notice. - every handshake ends with a session clock reset, also on reopening the connection,
and a reset the firmware answers late (about 50 ms on Bpod r2.0) is repeated, so
timestamps stay aligned to the host clock. - reopening a
Bpodunlocks its FlexIO channel types and analog sampling rate, as the
error message says, and its next trials record analog samples again. set_relay(True)turns a module's relay on again after a reopen.- connecting no longer fails with firmware that sends a discovery byte when the port is
opened, and no longer waits for the Bpod's next periodic discovery byte. Bpod.close()finishes its cleanup before raising a connection lost during the
trial, and closing an unpluggedBpodno longer raises anOSError.- stopping a queued trial that the Bpod never started logs a warning, instead of
reading the Bpod's reply as the trial's data. - softcode handling no longer ends when a global timer on the softcode channel turns
off. wait()no longer returns about 10 ms late after a process's first trial.- a
Bpodcreated after closing another one for the same device takes over its IPC
service, network advertisement included, instead of failing to bind the same
addresses. - closing a
Bpod, or any IPC host or client, no longer waits up to 100 ms for its
event loop, and closing a remote host no longer waits for its goodbye packets. RemoteBpod.close()returns within a second when the host is gone, instead of
waiting for a goodbye reply forever.- a
RemoteBpodconnecting by one of the host machine's own network addresses is
recognized as local: it uses the IPC transport and skips compressing trial data. iter_servicesanddiscover_remote_bpodreport a service that disappears and
comes back again, and a record changing its address or port as a removal and an
addition. On Windows,iter_servicesno longer stops reporting local services when
one of them closes.- a host without a route to the internet advertises one of its interface addresses via
Zeroconf instead of the loopback address. RemoteErrorsurvives pickling, e.g. when raised in a worker process.
Changed
- softcode actions (
SoftCode,SoftCodeApp) are sent as is, like MATLAB's, not one
higher: they take 1 to 255, and 0 (none to the Bpod) is rejected. Handlers get the
same values as before; the app port and softcodes from global timers get them as set. - the softcode channels have no number, like their actions:
SoftCodeand
SoftCodeAppfor global timers, conditions,Bpod.inputsandBpod.outputs. Bpod.version.machine_strnames the Bpod as precisely as its Teensy model and PCB
revision tell, e.g.r2.5or2+ r1.2instead ofr2.0-2.5or2+ r1.0.- the builder methods of
StateMachinevalidate their arguments through the models
instead ofvalidate_call: validation errors are titled after the model (e.g.
State) rather than the method, unknown keyword arguments raise aTypeError, and
aTransitionsorActionsinstance passed toadd_stateis stored by reference. - state names and operators must be strings;
bytesare no longer coerced. wait()also waits for the trial's softcode handlers to have run.wait()andstop_state_machine()can be interrupted with Ctrl+C while they wait
for a trial, despite polars' signal handler.- leaving the
Bpodcontext manager on an exception stops a running state machine
instead of waiting for it, as doesBpod.close()when its wait is interrupted; if
the Bpod doesn't end the trial, the reader gives it up. - building state machines is two to three times faster, loading them from a file up
to seven times, andBpod.runreturns about 40% sooner. Validating and compiling
state machines andBpod.get_datagained 10-20%. - connecting to a Bpod enumerates the serial ports once instead of three times, and
discover_bpodfinds a Bpod 2+ in under 10 ms instead of 230 ms: it skips a Bpod's
other serial ports and Teensy models no Bpod is built on. - reading trials takes half the CPU time and fewer thread wake-ups at high event rates.
- the warning about a timing violation reports how far the host fell behind in
reading the serial port: a full buffer stalls the Bpod's state machine cycle. - local
RemoteBpodconnections use the IPC transport wherever libzmq supports it,
instead of only on POSIX. filelockis no longer capped below version 4.
Removed
bpod.constants.VIDS_BPODandPIDS_BPOD: Bpod ports are matched by vendor and
product ID together, as listed inbpod.constants.USB_IDS_BPOD.
Full Changelog: 0.1.0a14...0.1.0a16