ForceModel#

class ForceModel(
recruitment_thresholds,
recording_frequency__Hz,
longest_duration_rise_time__ms=90.0,
contraction_time_range__unitless=3.0,
)[source]#

Bases: object

Force model based on Fuglevand et al. (1993) [1].

This class implements the Fuglevand force generation model for motor unit pools, computing individual motor unit twitch responses and their nonlinear gain modulation based on discharge rates. The model generates realistic force outputs from spike trains using physiologically-based parameters.

Parameters:
  • recruitment_thresholds (RECRUITMENT_THRESHOLDS__ARRAY) – Recruitment thresholds for each motor unit. Array of values typically ranging from 0 to 1 where larger motor units have higher thresholds.

  • recording_frequency__Hz (float) – Recording frequency in Hz. Determines temporal resolution of force calculations. Typical values: 1000-10000 Hz.

  • longest_duration_rise_time__ms (float, default 90.0) – Longest duration of the rise time in milliseconds. This parameter (T_L in [1]) determines the contraction time of the slowest motor unit. Typical range: 50-150 ms.

  • contraction_time_range__unitless (float, default 3.0) – Contraction time range factor (RT in [1]). Determines the spread of contraction times across motor units. Generally between 2 and 5. Higher values create larger differences between fast and slow motor units.

peak_twitch_forces__unitless#

Peak twitch forces for each motor unit (unitless). Available after initialization. Computed according to Fuglevand equation 13.

Type:

numpy.ndarray

contraction_times__samples#

Contraction times for each motor unit in samples. Available after initialization. Computed according to Fuglevand equation 14.

Type:

numpy.ndarray

twitch_mat#

Complete twitch matrix for all motor units. Available after initialization. Shape: (max_twitch_length, n_motor_units).

Type:

numpy.ndarray

twitch_list#

List of individual twitch responses for each motor unit. Available after initialization. Each element contains the twitch response for one motor unit.

Type:

list[numpy.ndarray]

Raises:

ValueError – If recruitment_thresholds is empty or contains invalid values. If recording_frequency__Hz is not positive. If longest_duration_rise_time__ms is not positive. If contraction_time_range__unitless is not greater than 1.

Parameters:

References

Examples

>>> import numpy as np
>>> from myogen.simulator.core.force import ForceModel
>>> thresholds = np.linspace(0.1, 1.0, 10)
>>> force_model = ForceModel(
...     recruitment_thresholds=thresholds,
...     recording_frequency__Hz=2000.0
... )

Methods

__init__

generate_force

Generate force output from motor unit spike trains using the Fuglevand model.

Attributes

contraction_times__samples

Contraction times for each motor unit in samples.

peak_twitch_forces__unitless

Peak twitch forces for each motor unit (unitless).

twitch_list

List of individual twitch responses for each motor unit.

twitch_mat

Complete twitch matrix for all motor units.

generate_force(spike_train__matrix)[source]#

Generate force output from motor unit spike trains using the Fuglevand model.

This method simulates muscle force by converting spike trains into force output through individual motor unit twitches with nonlinear gain modulation based on discharge rate. Each motor unit contributes to the total force according to its twitch properties and firing pattern.

Parameters:

spike_train__matrix (SPIKE_TRAIN__MATRIX) – Spike train matrix with shape (n_pools, n_neurons, n_time_points). Binary array where 1 indicates a spike occurrence. The number of neurons (axis 1) must match the number of recruitment thresholds.

Returns:

Force output array with shape (n_pools, n_time_points). Force values in arbitrary units representing muscle force over time. Each row corresponds to one motor neuron pool’s force response.

Return type:

numpy.ndarray

Raises:

ValueError – If spike train matrix dimensions don’t match the number of motor units. If twitch parameters have not been computed.

Notes

The force generation follows these steps: 1. Convert spike trains to inter-pulse intervals (IPIs) 2. Calculate nonlinear gain based on discharge rates 3. Sum weighted twitch responses for each spike 4. Apply gain modulation to final force output

property peak_twitch_forces__unitless: ndarray#

Peak twitch forces for each motor unit (unitless).

Returns:

Array of peak twitch forces according to Fuglevand model equation 13.

Return type:

numpy.ndarray

Raises:

ValueError – If twitch parameters have not been computed yet.

property contraction_times__samples: ndarray#

Contraction times for each motor unit in samples.

Returns:

Array of contraction times according to Fuglevand model equation 14.

Return type:

numpy.ndarray

Raises:

ValueError – If twitch parameters have not been computed yet.

property twitch_mat: ndarray#

Complete twitch matrix for all motor units.

Returns:

Matrix of shape (max_twitch_length, n_motor_units) containing the twitch responses for each motor unit.

Return type:

numpy.ndarray

Raises:

ValueError – If twitches have not been initialized yet.

property twitch_list: list[ndarray]#

List of individual twitch responses for each motor unit.

Returns:

List where each element is the twitch response array for one motor unit. Each array may have different lengths based on the motor unit’s contraction time.

Return type:

list[numpy.ndarray]

Raises:

ValueError – If twitches have not been initialized yet.