myogen.simulator.Muscle.resulting_fiber_assignment#

Muscle.resulting_fiber_assignment(mu)[source]#

Get the muscle fiber positions assigned to a specific motor unit.

Parameters:

mu (int) – Motor unit index (0-based). Must be less than the total number of motor units.

Returns:

Array of shape (n_assigned_fibers, 2) containing the [x, y] coordinates (in mm) of all muscle fibers assigned to the specified motor unit. If no fibers are assigned to the motor unit, returns an empty array.

Return type:

numpy.ndarray

Raises:
  • IndexError – If mu is outside the valid range [0, n_motor_units-1].

  • ValueError – If the muscle fiber assignment has not been completed yet.

Examples

>>> fiber_positions = muscle.resulting_fiber_assignment(0)
>>> print(f"Motor unit 0 has {len(fiber_positions)} fibers")
>>> print(f"First fiber position: x={fiber_positions[0,0]:.2f}, y={fiber_positions[0,1]:.2f}")

Notes

This method should only be called after assign_mfs2mns() has been executed. The returned coordinates are in the muscle’s coordinate system with the origin at the muscle center.