myogen.simulator.IntramuscularElectrodeArray.traj_mixing_mat#

IntramuscularElectrodeArray.traj_mixing_mat(t, n_nodes, n_channels)[source]#

Generate mixing matrix for trajectory interpolation during EMG simulation.

This method creates a diagonal mixing matrix that weights the contribution of different trajectory nodes during temporal interpolation. The matrix enables smooth transitions between electrode positions as the array moves along its trajectory during needle insertion or withdrawal.

Interpolation Strategy: - Linear interpolation between adjacent trajectory nodes - Weights based on distance from current time/position to node positions - Diagonal matrix structure for efficient computation - Smooth transitions avoid discontinuities in EMG signals

Parameters:
  • t (float) – Current normalized time or position in trajectory (0.0 to 1.0). 0.0 corresponds to trajectory start, 1.0 to trajectory end.

  • n_nodes (int) – Total number of trajectory nodes for interpolation.

  • n_channels (int) – Number of recording channels in the electrode array. Depends on differentiation mode and electrode count.

Returns:

Diagonal mixing matrix with shape (n_nodes * n_channels, n_nodes * n_channels). Diagonal elements contain repeated mixing weights for each trajectory node, with each node’s weight repeated n_channels times.

Return type:

numpy.ndarray

Notes

The mixing matrix enables temporal interpolation of EMG signals recorded at different trajectory positions. Higher weights are given to nodes closer to the current time/position parameter.

Examples

>>> # Get mixing weights for mid-trajectory position
>>> mix_mat = array.traj_mixing_mat(t=0.5, n_nodes=10, n_channels=4)
>>> # Matrix will weight middle nodes more heavily

See also

traj_mixing_fun

Individual node mixing function

set_linear_trajectory

Configure trajectory parameters