myogen.simulator.Muscle.assign_mfs2mns#

Muscle.assign_mfs2mns(n_neighbours=3, conf=0.999)[source]#

Assign muscle fibers to motor neurons using biologically realistic principles.

This method implements an assignment algorithm that balances multiple biological constraints:

  1. Proximity: Fibers closer to innervation centers are more likely to be assigned

  2. Territory size: Each motor unit has a target number of fibers based on its size

  3. Self-avoidance: Neighboring fibers avoid belonging to the same motor unit

  4. Gaussian territories: Fiber territories follow roughly Gaussian distributions

The assignment uses a probabilistic approach where each fiber is assigned based on the posterior probability computed from prior probabilities (target fiber numbers) and likelihoods (spatial clustering with Gaussian territories).

Parameters:
  • n_neighbours (int, default 3) – Number of neighboring fibers to consider for self-avoiding phenomena. Higher values increase intermingling between motor units but may slow computation. Typical range: 2-5.

  • conf (float, default 0.999) – Confidence interval that defines the relationship between innervation area and Gaussian distribution variance. Higher values create tighter, more compact territories. Should be between 0.9 and 0.999.

  • execution. (Results are stored in the assignment property after)

Raises:

ValueError – If innervation_center_positions is None. Call distribute_innervation_centers() first, or if muscle fiber centers are not available.

Return type:

None

Notes

The algorithm compensates for out-of-muscle effects by calculating how much of each motor unit’s Gaussian distribution falls outside the circular muscle boundary and adjusting the in-muscle probabilities accordingly.

The self-avoidance mechanism promotes realistic intermingling by reducing the probability of assigning a fiber to a motor unit if its neighbors are already assigned to that unit.