neurodec.mdt.MotorUnits#

class neurodec.mdt.MotorUnits(dictionary: dict)#

Motor units of a single muscle

property id: int#

Returns the ID of the object

classmethod new(fibers: Fibers, n_motor_units: int, area_min: float = 0.1, area_max: float = 0.7, distribution_radius: float = 0.95, force_computation: bool = False, random_seed: int = 0) MotorUnits#

Create new motor units for a single muscle

Creates new motor units by grouping the fibers of a muscle. This will initiate a call to the Neurodec Myoelectric Digital Twin (MDT) API that will generate motor units and return their metadata.

Parameters
  • fibers – The fibers for which to generate the motor units.

  • n_motor_units – The number of motor units to generate.

  • area_min – The minimum area of motor units.

  • area_max – The maximum area of the motor units.

  • distribution_radius – The maximum radius inside a unit circle at which the motor unit centers can be created.

  • force_computation – Boolean flag that allows to bypass a status check. Normally, the API would check if an object with the requested parameters was already present in the database. If this was the case, the API would not request its computation and would simply return its identifier. By setting this flag to True, the user can bypass this logic and force the computation of the resource even if it existed already. The main reason is to allow starting a calculation again in case of unexpected errors.

  • random_seed – A specific random seed to be used for the calculations. Changing the seed allows to create multiple instances from the same parameters.

Returns

The metadata of the new motor units. If another set of motor units with the same parameters already exits, those will be returned instead of building new ones.

property sizes: ArrayLike#

Returns the sizes of the MUs

Returns

A NumPy array of length N (total number of motor units). The i-th entry corresponds to the number of fibers associated to the i-th motor unit.

property status: Status#

Returns the up-to-date status of the object, by performing an API request.

wait()#

Wait for the object to be ready