Muscle models¤
Currently, only variants of the Virtual Muscle Model (Brown et al., 1999) are implemented.
feedbax.mechanics.muscle.MuscleState
(Module)
¤
Type of state PyTree operated on by AbstractMuscle
instances.
Note
Typically, muscle state variables are normalized. For example, muscle length is not in units of meters, but a multiple of the muscle's optimal length.
Attributes:
Name | Type | Description |
---|---|---|
activation |
Array
|
The muscle activation. |
length |
Array
|
The muscle length. |
velocity |
Array
|
The muscle contraction velocity. |
tension |
Array
|
The tensile force generated by the muscle. |
Constructors for specific variants of the Virtual Muscle Model¤
feedbax.mechanics.muscle.brown_1999_virtualmuscle
¤
feedbax.mechanics.muscle.brown_1999_virtualmuscle
brown_1999_virtualmuscle(n_muscles: int = 1, noise_func: Optional[Callable] = None, params: PyTree[float] = BROWN_SLOWFAST_AVG_VIRTUALMUSCLE_PARAMS)
Returns a Virtual Muscle Model using the averaged slow/fast twitch parameters from Brown et al. 1999.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_muscles |
int
|
The number of muscles to model. |
1
|
noise_func |
Optional[Callable]
|
Generates noise to add to the muscle force.
Has the signature |
None
|
params |
PyTree[float]
|
The parameters for the Virtual Muscle Model. |
BROWN_SLOWFAST_AVG_VIRTUALMUSCLE_PARAMS
|
feedbax.mechanics.muscle.todorov_li_2004_virtualmuscle
¤
feedbax.mechanics.muscle.todorov_li_2004_virtualmuscle
todorov_li_2004_virtualmuscle(n_muscles: int = 1, noise_func: Optional[Callable] = None, params: PyTree[float] = TODOROV_LI_VIRTUALMUSCLE_PARAMS)
Muscle model from Todorov & Li 2004.
Simplifies the Brown et al. 1999 Virtual Muscle Model:
- Omits the first passive element, PE1.
- Uses averages of the fast and slow twitch parameters from Brown 1999.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_muscles |
int
|
The number of muscles to model. |
1
|
noise_func |
Optional[Callable]
|
Generates noise to add to the muscle force.
Has the signature |
None
|
params |
PyTree[float]
|
The parameters for the Virtual Muscle Model. |
TODOROV_LI_VIRTUALMUSCLE_PARAMS
|
feedbax.mechanics.muscle.lillicrap_scott_2013_virtualmuscle
¤
feedbax.mechanics.muscle.lillicrap_scott_2013_virtualmuscle
lillicrap_scott_2013_virtualmuscle(n_muscles: int = 1, noise_func: Optional[Callable] = None, params: dict = LILLICRAP_SCOTT_VIRTUALMUSCLE_PARAMS)
Muscle model from Lillicrap & Scott 2013.
Simplifies the Brown et al. 1999 Virtual Muscle Model:
- Uses the Hill approximation (removes denominator
l
dependency) for FV shortening. - Omits both passive elements, PE1 and PE2.
- Uses the activation directly:
A_f = a
, thus also omits anyY
andl_eff
filters. - Uses a mixture of fast twitch and averaged slow/fast twitch
parameters from Brown 1999; see
LILLICRAP_SCOTT_VIRTUALMUSCLE_PARAMS
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
n_muscles |
int
|
The number of muscles to model. |
1
|
noise_func |
Optional[Callable]
|
Generates noise to add to the muscle force.
Has the signature |
None
|
params |
dict
|
The parameters for the Virtual Muscle Model. |
LILLICRAP_SCOTT_VIRTUALMUSCLE_PARAMS
|
Virtual Muscle Model¤
feedbax.mechanics.muscle.VirtualMuscle
(AbstractMuscle)
¤
Implements the Virtual Muscle Model from Brown, Cheng, & Loeb 1999.
Attributes:
Name | Type | Description |
---|---|---|
n_muscles |
int
|
The number of muscles to model. From the perspective of this class, the muscles are modeled independently. |
activation_func |
AbstractActivationFunction
|
The muscle activation function. |
force_func |
AbstractFLVFunction
|
The muscle force-length-velocity function. |
noise_func |
Optional[Callable[[Array, Array, Array], Array]]
|
An optional function that adds noise to the muscle force. |
bounds: StateBounds[MuscleState]
property
¤
Suggested bounds on the state.
__call__
(
input
: ModelInput
,
state
: StateT
,
key
: PRNGKeyArray
)
->
StateT
¤
__call__
(
input
: ModelInput
,
state
: StateT
,
key
: PRNGKeyArray
)
->
StateT
Inherited from feedbax.mechanics.muscle.AbstractMuscle
state_consistency_update
(
state
: StateT
)
->
StateT
¤
state_consistency_update
(
state
: StateT
)
->
StateT
Inherited from feedbax.mechanics.muscle.AbstractMuscle
change_n_muscles
(
n_muscles
: int
)
->
AbstractMuscle
¤
change_n_muscles
(
n_muscles
: int
)
->
AbstractMuscle
Inherited from feedbax.mechanics.muscle.AbstractMuscle
init
(
*,
key
: PRNGKeyArray
)
->
MuscleState
¤
init
(
*,
key
: PRNGKeyArray
)
->
MuscleState
Return a default state for the model.
Muscle input signal filters¤
feedbax.mechanics.muscle.ActivationFilter
(AbstractDynamicalSystem)
¤
First-order model of the calcium dynamics of muscle activation.
Attributes:
Name | Type | Description |
---|---|---|
tau_act |
float
|
The activation time constant. |
tau_deact |
float
|
The deactivation time constant. |
__call__
(
input
: PyTree[Array]
,
state
: StateT
,
key
: PRNGKeyArray
)
->
StateT
¤
__call__
(
input
: PyTree[Array]
,
state
: StateT
,
key
: PRNGKeyArray
)
->
StateT
Inherited from feedbax.dynamics.AbstractDynamicalSystem
vector_field
(
t
: Scalar
,
state
: Array
,
input
: Array
)
¤
vector_field
(
t
: Scalar
,
state
: Array
,
input
: Array
)
Return the time derivative of activation.
Abstract base classes¤
feedbax.mechanics.muscle.AbstractMuscle
(AbstractStagedModel[MuscleState])
¤
Base class for muscle models.
Attributes:
Name | Type | Description |
---|---|---|
n_muscles |
AbstractVar[int]
|
The number of muscles to model. From the perspective of this class, the muscles are modeled independently. |
activation_func |
AbstractVar[AbstractActivationFunction]
|
The muscle activation function. |
force_func |
AbstractVar[AbstractFLVFunction]
|
The muscle force-length-velocity function. |
noise_func |
AbstractVar[Optional[Callable[[Array, Array, Array], Array]]]
|
An optional function that adds noise to the muscle force. |
__call__
(
input
: ModelInput
,
state
: StateT
,
key
: PRNGKeyArray
)
->
StateT
¤
__call__
(
input
: ModelInput
,
state
: StateT
,
key
: PRNGKeyArray
)
->
StateT
Inherited from feedbax._staged.AbstractStagedModel
state_consistency_update
(
state
: StateT
)
->
StateT
¤
state_consistency_update
(
state
: StateT
)
->
StateT
Inherited from feedbax._staged.AbstractStagedModel
init
(
*,
key
: PRNGKeyArray
)
->
StateT
¤
init
(
*,
key
: PRNGKeyArray
)
->
StateT
Inherited from feedbax._staged.AbstractStagedModel
change_n_muscles
(
n_muscles
: int
)
->
AbstractMuscle
¤
change_n_muscles
(
n_muscles
: int
)
->
AbstractMuscle
Return a similar model for a different number of muscles.