Bioafferent
JAX-based proprioceptive sensory feedback for physics simulators and reinforcement-learning environments.
Converts mechanical muscle/joint state (length, velocity, force) into biologically motivated afferent signals:
- muscle spindle primary afferents (Ia) and secondary afferents (II), following the structural formulation of Mileusnic et al. (2006) with the first-order reduction of Vannucci et al. (2017);
- Golgi tendon organ afferents (Ib) from muscle-tendon force, combining the static properties reported by Houk & Simon with first-order dynamics in the style of Lin & Crago (2002);
- continuous firing rates plus discrete spike trains (Poisson, inhomogeneous Poisson, gamma-renewal encoding) with explicit JAX PRNG handling.
Core models are pure JAX (jit/vmap/scan compatible) and independent of any simulator. Optional adapters cover Gymnasium, MuJoCo, and MuJoCo MJX.
Scientific status: the spindle implements the structure of the published models (three intrafusal fiber types, polar/sensory tension dynamics, fusimotor drives, partial occlusion of Ia). Exact ODE coefficients are documented engineering parameters, not the copyrighted Table 1 values of Mileusnic et al. See
docs/physiology.mdfor the full formulation record.
Quick start
import jax.numpy as jnp
from bioafferent import MuscleSpindle, SpindleConfig
spindle = MuscleSpindle(SpindleConfig())
state = spindle.init_state(shape=())
for _ in range(1000):
state, out = spindle.step(
state, length=1.02, velocity=0.0, gamma_dynamic=0.3, gamma_static=0.2, dt=0.001
)
print(float(out.ia_rate), float(out.ii_rate))
Prefer fewer moving parts? Afferents(n_muscles=2).step(length, velocity, force) hides states and defaults the rest; wrap(gym.make("CartPole-v1"))
does the same for Gymnasium envs. See examples/, docs/usage.md, and
docs/ for details.
Metadata
Release files for bioafferent 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bioafferent-0.1.0.tar.gz | 26.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bioafferent-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 61.3 kB
Release files / bioafferent-0.1.0.tar.gz
| Download URL | bioafferent-0.1.0.tar.gz |
|---|---|
| Size | 26.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7411c25120b37cec851e8c8161759269db5ad5105471dfafc43112b7c2142e55
|
|
BLAKE2b-256 checksum How to use checksums |
32ad0b8016b3172d4864105df6527433e694fdfb19cdb28c8441b7ae75bbf84b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / bioafferent-0.1.0-py3-none-any.whl
| Download URL | bioafferent-0.1.0-py3-none-any.whl |
|---|---|
| Size | 35.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2b3fb8ae8dcf1d7193e02a3348ccc2c3be5a0a1785617ab91fa5ab0ce4d8b815
|
|
BLAKE2b-256 checksum How to use checksums |
247321fa617fa86f058551d7003e387e593cd983c6a572663e39f306944f6800
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|