HillModel#
- class HillModel(
- simulation_time__ms: Quantity__ms,
- time_step__ms: Quantity__ms,
- muscle_parameters: Dict[str, Any],
- n_motor_units_type1: int,
- n_motor_units_type2: int,
- initial_joint_angle__deg: float,
- initial_muscle_length__L0: float = -1.0,
- muscle_role: Literal['flexor', 'extensor'] = 'flexor',
Bases:
objectAPI wrapper for the Hill muscle model.
This class provides an intuitive interface for creating Hill muscle models with user-friendly parameter names that are internally mapped to the correct format expected by the underlying Hill implementation.
- Parameters:
simulation_time__ms (float) – Total simulation time in milliseconds
time_step__ms (float) – Integration time step in milliseconds
muscle_parameters (Dict[str, Any]) – Dictionary containing Hill muscle model parameters
n_motor_units_type1 (int) – Number of type I motor units
n_motor_units_type2 (int) – Number of type II motor units
initial_joint_angle__deg (float) – Initial joint angle in degrees
initial_muscle_length__L0 (float, optional) – Initial muscle length normalized to L0. If -1, automatically calculated from joint angle. Must be between 0.7 and 1.3 if specified.
muscle_role (str, optional) – Muscle role for antagonist pairs (“flexor” or “extensor”), by default “flexor”. Used for joint dynamics calculations and result organization.
Methods
Add a spike event for a specific motor unit.
Create default muscle parameter dictionary.
Integrate the muscle model for one time step.
Attributes
Get maximum isometric force (F0) in Newtons.
Get optimal muscle length (L0) in meters.
Get individual motor unit forces matrix (N_units x time_points).
Get muscle acceleration time series (L0/s^2).
Get muscle force time series (normalized to F0).
Get muscle length time series (normalized to L0).
Get muscle torque time series (F0*m).
Get muscle velocity time series (L0/s).
Get muscle torque with correct sign for joint dynamics (F0*m).
Get simulation time vector in milliseconds.
Get Type I motor unit activation time series.
Get Type II motor unit activation time series.
- add_spike(motor_unit_id: int, delay__ms: float = 0.0) None[source]#
Add a spike event for a specific motor unit.
- integrate(joint_angle__deg: float) tuple[float, float, float][source]#
Integrate the muscle model for one time step.
- property signed_muscle_torque: ndarray#
Get muscle torque with correct sign for joint dynamics (F0*m).
- property motor_unit_forces: ndarray#
Get individual motor unit forces matrix (N_units x time_points).
- static create_default_muscle_parameters(
- muscle_type: str = 'FDI',
Create default muscle parameter dictionary.
- Parameters:
muscle_type (str, optional) – Type of muscle model (“FDI”, “Sol”), by default “FDI”
- Returns:
Dictionary of muscle parameters
- Return type:
Dict[str, Any]
- Raises:
ValueError – If muscle_type is not recognized