Skip to main content
eLife logoLink to eLife
. 2024 Oct 2;12:RP88670. doi: 10.7554/eLife.88670

I-Spin live, an open-source software based on blind-source separation for real-time decoding of motor unit activity in humans

Julien Rossato 1, François Hug 2,3, Kylie Tucker 3, Ciara Gibbs 4, Lilian Lacourpaille 1, Dario Farina 4, Simon Avrillon 4,
Editors: J Andrew Pruszynski5, Christian Büchel6
PMCID: PMC11446545  PMID: 39356736

Abstract

Decoding the activity of individual neural cells during natural behaviours allows neuroscientists to study how the nervous system generates and controls movements. Contrary to other neural cells, the activity of spinal motor neurons can be determined non-invasively (or minimally invasively) from the decomposition of electromyographic (EMG) signals into motor unit firing activities. For some interfacing and neuro-feedback investigations, EMG decomposition needs to be performed in real time. Here, we introduce an open-source software that performs real-time decoding of motor neurons using a blind-source separation approach for multichannel EMG signal processing. Separation vectors (motor unit filters) are optimised for each motor unit from baseline contractions and then re-applied in real time during test contractions. In this way, the firing activity of multiple motor neurons can be provided through different forms of visual feedback. We provide a complete framework with guidelines and examples of recordings to guide researchers who aim to study movement control at the motor neuron level. We first validated the software with synthetic EMG signals generated during a range of isometric contraction patterns. We then tested the software on data collected using either surface or intramuscular electrode arrays from five lower limb muscles (gastrocnemius lateralis and medialis, vastus lateralis and medialis, and tibialis anterior). We assessed how the muscle or variation of contraction intensity between the baseline contraction and the test contraction impacted the accuracy of the real-time decomposition. This open-source software provides a set of tools for neuroscientists to design experimental paradigms where participants can receive real-time feedback on the output of the spinal cord circuits.

Research organism: Human

Introduction

Motor units transduce the neural signals that originate from supraspinal centres, spinal circuits, and sensory systems into force (Sherrington, 1925). In healthy individuals, each action potential propagating along the axon of an alpha motor neuron elicits action potentials in all its innervated muscle fibres. The activity of motor neuron – in the form of spike trains – represents the neural code of movement to muscles. Decoding this firing activity in real time during various behaviours can thus substantially enhance our understanding of movement control (Basmajian, 1963; Formento et al., 2021; Bräcklein et al., 2022; Rossato et al., 2024). Real-time decoding is also essential for interfacing with external devices (Farina et al., 2023) or virtual limbs (Oliveira et al., 2024) when activity is present at the periphery of the nervous system. For example, individuals with a spinal cord injury can control a virtual hand with the residual firing activity of the motor units in their forearm (Oliveira et al., 2024). Furthermore, sampling the activity of motor units receiving a substantial portion of independent synaptic inputs may pave the way for movement augmentation – specifically, extending a person’s movement repertoire through the increase of controllable degrees of freedom (Eden et al., 2022). In this way, Formento et al., 2021 showed that individuals can intuitively learn to independently control motor units within the same muscle using visual cues. Having access to open-source tools that perform the real-time decoding of motor units would allow an increasing number of researchers to improve and expand the range of these applications.

To date, researchers classically identify a few motor units during relatively weak contractions using concentric needle or fine wire recording electrodes (LeFever and De Luca, 1982). They then separate the overlapping spike trains with a spike-sorting algorithm (e.g. McGill et al., 2005). Recent developments of intramuscular (Farina et al., 2008b; Muceli et al., 2015; Muceli et al., 2022; Chung et al., 2023) and surface (Farina et al., 2016; Caillet et al., 2023) electromyography (EMG) electrode arrays facilitate both a larger recording zone (i.e. the volume from which motor unit action potentials are recorded), and the recording of the same motor unit action potential across multiple channels. In conjunction with this hardware advance, the development of novel EMG decomposition software/programs, such as multichannel spike-sorting (Rey et al., 2015; Buccino et al., 2020; Steinmetz et al., 2021; Pachitariu et al., 2023) and blind-source separation (Holobar and Zazula, 2007; Holobar and Farina, 2014; Farina and Holobar, 2016; Negro et al., 2016; Chen et al., 2019) algorithms, enables a relatively large number of individual motor units to be decoded from each recording (Muceli et al., 2015; Muceli et al., 2022; Chung et al., 2023; Caillet et al., 2023). Contrary to spike-sorting algorithms, blind-source separation does not directly sort action potential shapes, but rather optimises a set of separation vectors, that is, motor unit filters, which maximises the sparseness of motor unit pulse trains from which discharge times are estimated (Holobar and Zazula, 2007; Holobar and Farina, 2014; Farina and Holobar, 2016; Negro et al., 2016; Chen et al., 2019). The current open-source implementations of this approach rely on offline processing, which restricts its ability to be used for neurofeedback and human interfacing technologies.

Recent studies have reported real-time capabilities of motor unit identification by adapting the offline blind-source separation algorithm (Formento et al., 2021; Bräcklein et al., 2022; Barsakcioglu et al., 2021; Chen et al., 2020; Zheng and Hu, 2019). These studies used a two-step approach: (1) the separation vector for each motor unit is identified with offline decomposition during the training phase and (2) the same vectors are applied in real time to new EMG recordings. The real-time identification of motor units is only used by a few specialised research teams, and there are no publicly available algorithms or user interfaces for this task. In addition, the accuracy and capabilities of online decomposition have not been systematically tested in multiple muscles or intensities.

Here, we provide an open-source software that can be used to visualise and track motor unit firing activities in real time. We document the software validity and its capabilities on data collected from five lower limb muscles (gastrocnemius lateralis and medialis, vastus lateralis and medialis, and tibialis anterior) during isometric contractions of varying force levels, using either surface or intramuscular electrode arrays. The real-time identification of motor unit firing activity was first validated using synthetic EMG signals. Then, the accuracy of the algorithm was determined during experiments from the rate of agreement calculated between the motor unit spike trains identified in real time and those identified offline after manual editing. Data, codes, and a user manual are available at https://github.com/simonavrillon/I-Spin (copy archived at Avrillon, 2024).

Results

Overview of the approach

An EMG signal represents the sum of trains of action potentials from all the active motor units within the recorded muscle volume (Figure 1A). During stationary conditions, for example, isometric contractions, the train of motor unit action potentials can be modelled as the convolution of series of discrete delta functions, representing the discharge times, and motor unit action potentials that have a consistent shape across time. When EMG signals are recorded with an array of electrodes, the shape of the recorded potential of each motor unit differs across electrodes. This is due to (1) the varying conduction velocity of action potentials among the muscle fibres and (2) the location/depth of the muscle fibres that belong to each motor unit relatively to the electrodes, which impact the low pass filtering effect of the tissue on the recorded potential. Increasing the number and density of recording electrodes increases the likelihood that each motor unit will have a unique motor unit action potential profile (shape), that is, a temporal and spatial profile that differs from all the other active motor unit within the recorded volume (Caillet et al., 2023; Farina et al., 2008a). The uniqueness of motor unit action potential profiles is necessary for the blind-source separation to accurately estimate the motor unit discharge times. Conversely, the spike trains of two motor units with similar action potential profiles will be merged by the model.

Figure 1. Overview of the approach.

(A) During isometric contractions, electromyographic (EMG) signals can be considered as the sum of all action potentials that originate from the muscle fibres of all the active motor units that lie within the electrodes recording zone. The shape of the recorded action potentials differs across electrodes when recorded with an array of surface or intramuscular electrodes. The EMG signal and each individual MUAP profile depends on the position of the electrode, as highlighted by the different colours. (B) Decomposing EMG signals consists of solving the inverse problem, that is, to estimate the discharge times of the active motor units from the EMG signals. Our software uses a fast independent component analysis (fasICA) to optimise a set of separation vectors for each motor unit. To this end, each separation vector is iteratively optimised to maximise the sparseness of the motor unit pulse train. At the end of this step, the motor unit pulse train is refined, and a k-mean classification is applied to separate the high peaks, which represent the targeted motor unit spikes, from the low peaks (other motor units and noise). (C) During the online EMG decomposition, the extended EMG signals recorded over 125 ms segments are projected on the separation vectors, and the peaks are detected using the function ‘islocalmax’. Each peak is classified as spike or noise depending on the distance separating them from the centroids of the classes identified during the calibration. At the end of this process, the motor unit firing activity is translated into visual feedback, in the form of a raster plot, a quadrant, or the smoothed firing rate of an identified motor unit.

Figure 1.

Figure 1—figure supplement 1. Workflow of a typical experimental session with I-Spin live.

Figure 1—figure supplement 1.

Our software uses a fast independent component analysis (fastICA) to retrieve motor unit spike trains from the EMG signals. For this, it iteratively optimises a separation vector (i.e. the motor unit filter) for each motor unit (Figure 1B; Negro et al., 2016; Chen et al., 2019; Barsakcioglu et al., 2021; Negro et al., 2016; Chen et al., 2019; Barsakcioglu et al., 2021). The projection of the EMG signals on this separation vector generates a sparse motor unit pulse train, with most of its samples close to zero and a smaller number of samples significantly greater than zero (Figure 1B). The discharge times are estimated from this motor unit pulse train using a peak detection function and a k-mean classification with two classes to separate the high peaks (spikes) from the low peaks (noise and other motor units). During the decomposition in real time, short segments of EMG signals are projected on the saved separation vectors, and the peaks are classified as discharge times if they are closer to the centroid of the class ‘spikes’ than to the centroid of the class ‘noise’ (Figure 1C). The algorithm used to identify motor units discharge activity is based on that proposed by Negro et al., 2016 and Barsakcioglu et al., 2021.

Overview of the software

The software used in this article was coded as a MATLAB app (version 2022a, The MathWorks, Inc, USA), but an alternative version coded with Python is also available. It allows researchers to record and process signals from surface and intramuscular electrode arrays using multiple acquisition systems (EMG-Quattrocento, OT Bioelettronica, Italy; Open Ephys acquisition board, Open Ephys, USA; Intan RHD recording system; Intan Technologies, USA). As the accuracy of the algorithm relies on the consistency of motor unit filters, it is recommended to record these EMG signals during stationary conditions – for example, isometric contractions – to limit changes in muscle geometry or position/orientation of the active muscle fibres relative to the electrodes (Glaser and Holobar, 2019; Oliveira and Negro, 2021). The framework to perform real-time identification of motor neuron activity has four steps (Figure 1—figure supplement 1). First, the EMG signal is recorded while participants perform a contraction at the requested intensity such that an electrode mask is manually generated to remove channels with artefacts or low signal-to-noise ratio. This electrode mask is then used for the rest of the experimental session. Second, the force offset is measured and removed before performing maximal voluntary contraction (MVC). The measured MVC is used to standardise all the submaximal isometric contractions. Third, a baseline contraction is performed at a force level close to, or slightly above, the intensity of the testing task, and the separation vectors are identified with offline blind-source separation. Fourth, the separation vectors are applied over incoming segments of EMG signals during a test contraction to identify motor unit firing activity in real time.

Three forms of feedback can be displayed to the participant: a raster plot of the discharge times for each motor unit of a given array, a quadrant displaying the firing rates of two motor units, and the smoothed firing rate of a given motor unit with a scrolling target to track (Figure 1C).

Manual editing to improve the accuracy of the motor unit pulse train

Manual editing of motor unit discharge times identified with automatic decomposition (or spike-sorting) generally improves the accuracy of the spike trains (Del Vecchio et al., 2020; Hug et al., 2021; Avrillon et al., 2024). In the case of online decomposition, manual editing can be performed after the baseline contraction to improve the accuracy of the motor unit filters. It results in a motor unit pulse train with peaks easily separable from the noise. Several metrics have been proposed to automatically remove the unreliable motor unit pulse trains (Negro et al., 2016; Holobar et al., 2014). For example, the silhouette value (SIL) measures the normalised distance between the spikes and the noise after k-mean classification (Negro et al., 2016). As an example, Figure 2A displays the silhouette values of all the motor units identified after the baseline contraction in five different muscles (vastus lateralis [VL] and medialis [VM], gastrocnemius lateralis [GL] and medialis [GM], and tibialis anterior [TA]) with either grids of surface electrodes or intramuscular electrodes arrays. When considering the baseline contractions performed at 20% MVC, on average 20 ± 9 (VL), 14 ± 5 (VM), 25 ± 11 (GL), 19 ± 9 (GM), 15 ± 4 (TA grid), and 10 (TA intra) motor units per participant were identified. Their SIL values calculated before manual editing were 0.89 ± 0.05 for VL, 0.83 ± 0.04 for VM, 0.82 ± 0.03 for GL, 0.87 ± 0.04 for GM, 0.94 ± 0.01 for TAgrid, and 0.95 ± 0.02 for TAintra. After visual inspection, a significant number of motor units was removed as their pulse train showed no clear separation between the spikes and the noise. The number of motor units removed was 6 ± 5 for VL, 10 ± 5 for VM, 21 ± 12 for GL, 6 ± 5 for GM, and 1 for TA grid and TA intra (Figure 2A). The remaining motor units exhibited a SIL value of 0.91 ± 0.04, 0.89 ± 0.06, 0.89 ± 0.03, and 0.90 ± 0.02, 0.94 ± 0.01, and 0.95 ± 0.02 for VL, VM, GL, GM, TAgrid, and TA intra, respectively (Figure 2B).

Figure 2. Effect of the manual editing on the reliability of motor unit pulse trains.

Figure 2.

Once the participants completed the baseline contraction, we ran an automatic offline decomposition. Then, an operator visually inspected and removed all the motor units for which the spikes were not clearly separated from the noise (red dots in A). The remaining motor units were manually edited (black dots in A). (B) The manual editing consisted of removing false positives and adding the false negatives, before updating the motor unit filter. The effect of this step on the SIL value and the coefficient of variation of the interspike intervals (CoV of ISI, without units) is shown on the right panel. The CoV of ISI estimates the regularity of spiking for each motor unit, an expected behaviour during isometric contractions at consistent levels of force. The red dots are the motor units before editing and the green dots are the motor units after editing. These scatters are connected with a grey vector to show the changes in SIL value and CoV of ISI. Vastus lateralis (VL), vastus medialis (VM), gastrocnemius lateralis (GL), gastrocnemius medialis (GM), and tibialis anterior (TA).

When considering the baseline contraction performed at 40% MVC, on average 17 ± 6 (VL), 15 ± 5 (VM), 29 ± 13 (GL), and 13 ± 4 (GM) motor units were identified by automatic decomposition, with 12 ± 8 (VL), 3 ± 3 (VM), 5 ± 6 (GL), and 4 ± 3 (GM) motor units kept after visual inspection (Figure 2A). The SIL value of the selected motor units reached 0.91 ± 0.03 for VL, 0.89 ± 0.05 for VM, 0.87 ± 0.02 for GL, and 0.88 ± 0.03 for GM after manual editing (Figure 2B). These results show how manual editing can improve the accuracy of spike detection from the motor unit pulse trains. Moreover, a SIL value around 0.9 can be used as a threshold to automatically remove the motor unit pulse trains with a poor quality a priori. Thus, these two steps were performed in the all the subsequent analyses. Importantly, it is worth noting that the motor unit pulse train must always be visually inspected after the session to check for errors of the automatic identification of discharge times.

Validation of the algorithm

We first validated the accuracy of the algorithm using synthetic EMG signals generated with an anatomical model entailing a cylindrical muscle volume with parallel fibres (see Farina et al., 2008a, Konstantin et al., 2020 for a full description of the model). In this model, subcutaneous and skin layers separate the muscle from a grid of 65 surface electrodes (5 columns, 13 rows), while an intramuscular array of electrodes is directly inserted in the muscle under the grid with an angle of 30°. A total of 150 motor units were distributed within the cross-section of the muscle. Recruitment thresholds, firing rate/excitatory drive relations, and twitch parameters were assigned to each motor unit using the same procedure as Fuglevand et al., 1993. During each simulation, a proportional-integral-derivative controller adjusted the level of excitatory drive to minimise the error between a predefined target of force and the force generated by the active motor units.

Figure 3A displays the raster plots of the active motor units during simulated trapezoidal isometric contractions with plateaus of force set at 10, 20, and 30% MVC. A sinusoidal isometric contraction ranging between 15 and 25% MVC at a frequency of 0.5 Hz was also simulated. We identified on average 10 ± 1 and 12 ± 2 motor units with surface and intramuscular arrays, respectively (Figure 3A). During the offline decomposition, the rate of agreement between the identified discharge times and the ground truth, that is, the simulated discharge times, reached 100.0 ± 0.0% for intramuscular EMG signals and 99.2 ± 1.8% for surface EMG signals (Figure 3B). The offline estimation of motor unit filters was therefore highly accurate, independently of the level of force or the pattern of the isometric contraction.

Figure 3. Validation of the algorithm with synthetic electromyographic (EMG) signals.

Figure 3.

Surface and intramuscular EMG signals were generated using an anatomical model with 150 motor units. (A) Raster plots of the active motor units during simulated trapezoidal contractions performed at 10, 20, and 30% of the maximal force (maximal voluntary contraction [MVC]), and during a sinusoidal contraction with the force varying between 15 and 25% MVC at a rate of 0.5 Hz. The spike trains in red, blue, or green were respectively identified from intramuscular, surface, or both EMG signals. (B) The identified discharge times were compared to the ground truth, that is, the simulated discharge times, using the rate of agreement. Each dot is a motor unit, and the line is the median. (C) The motor unit filters identified from the reference contraction (i.e. trapezoidal contraction at 20% MVC) were then applied in real-time on the incoming EMG signals simulated during the sinusoidal contraction. The rates of agreement are displayed for each motor unit; the line is the median. (D) The motor unit filters identified at 20% MVC were applied in real-time on signals simulated during contractions at 10 and 30% MVC. Rates of agreement, sensitivity (sens.), false negative rates (FNR.), and precision (prec.) are displayed for each motor unit. The lower precision for motor units identified in real time at 30% MVC can be explained by the presence of a merged motor unit, as highlighted on this example. The red dots represent the discharge times of this merged motor unit while the green dots represent the discharge times of the targeted motor unit.

Motor unit filters estimated during a baseline contraction at 20% MVC were then applied in real time on signals simulated during a contraction with a different pattern (sinusoidal; Figure 3C). The rates of agreement between the online decomposition and the ground truth reached 96.3 ± 4.6% and 98.4 ± 2.3% for surface and intramuscular EMG signals, respectively. Finally, we tested whether the accuracy of the online decomposition changed when the level of force decreased or increased by 10% MVC when compared to the calibration performed at 20% MVC (Figure 3D). The rate of agreement remained high when applying the motor unit filters on signals recorded at 10% MVC: 99.8 ± 0.2% (surface EMG) and 99.5 ± 0.3% (intramuscular EMG). It is worth noting that only 3 out of 10 motor units identified from surface EMG at 20% MVC were active at 10% MVC, while 8 out of 12 motor units identified from intramuscular EMG were active at 10% MVC. This shows how the decomposition of EMG signals tends to identify the last recruited motor units, which often innervate a larger number of fibres than the early recruited motor units (Henneman, 1957). On the contrary, the application of motor unit filters on signals simulated at 30% MVC led to a decrease in the rate of agreement, with values of 88.6 ± 14.0% (surface EMG) and 80.3 ± 19.2% (intramuscular EMG). This decrease in accuracy did not impact all the motor units, with five motor units keeping a rate of agreement above 95% in both signals. For the other motor units, we observed a decrease in precision, which estimates the ratio of true discharge times over the total number of identified discharge times. This was caused by the recruitment of two motor units sharing a similar space within the muscle, which resulted in a merge in the same pulse train (Figure 3D).

Application of motor unit filters in experimental data

We then asked eight participants (four males and four females) to perform trapezoidal isometric contractions with plateaus of force set at 10 and 20% MVC during which surface EMG signals were recorded from the TA with 256 electrodes separated by 4 mm. The aim of this experiment was to confirm the results of the simulation; specifically, to test the accuracy of the online decomposition when the level of force was below, equal to, or above the level of force produced during the baseline contraction used to estimate the motor unit filters (Figure 4). We assessed the accuracy of the motor unit spike trains identified in real time using their manually edited version as reference. A total of 144 motor units were identified at both 10 and 20% MVC. When the test signals were recorded at the same level of force as the baseline contraction, we obtained rates of agreement of 95.6 ± 6.8% (10% MVC) and 93.9 ± 5.9% (20% MVC). The sensitivity reached 95.9 ± 6.7% (10% MVC) and 94.4 ± 5.6% (20% MVC), and the precision reached 99.6 ± 1.3% (10% MVC) and 99.4 ± 1.9% (20% MVC).

Figure 4. Reapplication of motor unit filters on electromyographic (EMG) signals recorded at varying contraction intensities.

Figure 4.

Surface EMG signals were recorded during isometric contractions at 10 and 20% maximal voluntary contraction (MVC). We compared the motor unit spike trains identified in real time with their manually edited version. The contraction intensity of the test contraction was either equal to (20% => 20% in A; dark red & 10% => 10% in B; light red), below (20% => 10% in A; light red), or above (10%=>20% in B; dark red) the level of the baseline contraction. We calculated the rate of agreement (ROA), the sensitivity (Sens.), the false negative rate (FNR.), and the precision (Prec.) for each motor unit. Each dot is an individual motor unit, each box represents the 25th and 75th percentiles of the distribution of values, and each line is the median. The lower precision in (B) was caused by the presence of a merged motor unit in the motor unit pulse train. The red dots represent the discharge times of this merged motor units while the green dots represent the discharge times of the targeted motor unit.

When the filters identified at 20% MVC were applied on signals recorded at a lower level of force (10% MVC), the rates of agreement decreased to 87.9 ± 16.2%. The sensitivity also decreased to 88.0 ± 16.2%, but the precision remained high (99.4 ± 4.3). Thus, the decrease in accuracy was mostly caused by missed discharge times rather than the false identification of artefacts or spikes from other motor units. When the filters identified at 10% MVC were applied to signals recorded at a higher level of force, the rates of agreement decreased to 83.3 ± 13.5%. The sensitivity decreased to 90.7 ± 8.1%, and the precision also decreased to 90.9 ± 12.6%. This result confirms what was observed with synthetic EMG, that is, motor units recruited between 10 and 20% MVC can substantially disrupt the accuracy of the decomposition in real time, as highlighted in Figure 4 (lower panel). Importantly, this situation does not happen for all the motor units, as suggested by the distribution of the values in Figure 4.

Accuracy of the online decomposition in different muscles

Twenty-one male participants completed additional experiments to test the accuracy of the online decomposition in different muscles (vastus lateralis [VL] and medialis [VM], gastrocnemius lateralis [GL] and medialis [GM], and tibialis anterior [TA]). They all performed isometric contractions at 20 and 40% MVC while EMG signals were recorded with either grids of 64 surface electrodes (VL, VM, GL, GM, TA) or an intramuscular array of 16 electrodes (TA).

At 20% MVC, 94 (VL; eight participants), 21 (VM; eight participants), 14 (GL; eight participants), 56 (GM; eight participants), 68 (TA grid; five participants), and 9 motor units (TA intra; one participant) motor units were identified. At 40% MVC, 76 (VL), 21 (VM), 19 (GL), and 25 (GM) motor units were identified. For the sake of clarity, we only report in this section the rates of agreement for each intensity and muscle. Values of sensitivity, precision, and rates of false negatives are reported in Figure 5. The highest rate of agreement was observed for the TA (93.6 ± 9.2% with the grid and 97.3 ± 5.2% with the intramuscular array). Those values were lower for the vastii (VL: 82.1 ± 19.7%; VM: 75.3 ± 18.5%) and gastrocnemii muscles (GL: 88.1 ± 7.8%; GM: 81.0 ± 17.7). When considering the contractions performed at 40% MVC, the rate of agreement was 84.0 ± 15.6% for VL, 75.2 ± 20.6% for VM, 82.5 ± 8.1% for GL, and 87.9 ± 8.7% for GM (Figure 5).

Figure 5. Accuracy of the online electromyographic (EMG) decomposition.

Figure 5.

We compared the motor unit spike trains identified in real time with their manually edited version. We calculated the rate of agreement, the sensitivity, the false negative rate, and the precision for each motor unit. Each dot is an individual motor unit, each box represents the 25th and 75th percentiles of the distribution of values, each bar represents the 5th and 95th percentiles of the distribution of values, and each line is the median. VL: vastus lateralis, VM: vastus medialis, GL: gastrocnemius lateralis, GM: gastrocnemius medialis, TAg: tibialis anterior recorded with a high-density grid of electrodes, and TAi: tibialis anterior recorded with an intramuscular array of electrodes.

Accuracy of the real-time biofeedback

Because the accuracy of the raster plot feedback is directly related to the accuracy of the estimation of the discharge times reported in the previous sections, here we only focus on the accuracy of the smoothed firing rates. It can either be displayed in a quadrant, with a cursor moving within a two-dimensional space according to the firing rates of two motor units, or with one cursor for a given identified motor units moving in the vertical direction and following a scrolling path.

At 20% MVC, the root mean squared error (RMSE) between the firing rate estimated in real time and its edited version was consistently below two pulses per second for all the motor units (Figure 6). The lowest RMSE was observed with the TA muscle (0.64 ± 0.77 pps and 0.44 ± 0.43 pps with grids and intramuscular arrays of electrodes). RMSE was 1.4 ± 1.5 pps for VL, 1.8 ± 1.5 pps for VM, 1.7 ± 1.1 pps for GL, and 1.1 ± 1.1 pps for GM. At 40% MVC, the RMSE reached 1.1 ± 1.2 pps for VL, 1.8 ± 1.1 pps for VM, 0.8 ± 0.5 pps for GL, and 0.6 ± 0.4 pps for GM. Overall, these RMSE provides strong evidence that the biofeedback accurately reflects the motor unit firing activity. It is highlighted by the two examples displayed in Figure 6B, with a raw smoothed firing rate with an RMSE at 0.83 pps, and in Figure 6C, with firing rates displayed in a quadrant with an average RMSE of 1.75 pps. Videos of the different forms of feedback are available in the GitHub.

Figure 6. Accuracy of the visual feedback based on the motor unit smoothed firing rates.

Figure 6.

The online electromyographic (EMG) decomposition was provided to the participants in the form of different visual feedback. We estimated the accuracy of the feedback by calculating the root mean squared error (RMSE) between the smoothed firing rates estimated from the motor unit spike trains identified in real time and from their manually edited version at 20% maximal voluntary contraction (MVC) (A) and 40% MVC (B). Each dot is an individual motor unit, each box represents the 25th and 75th percentiles of the distribution of values, each bar represents the 5th and 95th percentiles of the distribution of values, and each line is the median. VL: vastus lateralis, VM: vastus medialis, GL: gastrocnemius lateralis, GM: gastrocnemius medialis, TAg: tibialis anterior recorded with a high-density grid of surface electrodes, and TAi: tibialis anterior recorded with an intramuscular array of electrodes. (C) Smoothed firing rate of a motor unit provided in real time (Real time, red) vs. its manually edited version (Reference, grey). (D) Quadrant plot provided in real time (Real time, red) vs. its manually edited version (Reference, grey). Each dot represents the position of the cursor during one window of 125 ms.

Discussion

Assumptions of the algorithm

There are processing assumptions for the blind-source separation algorithm to accurately identify motor unit discharge times from multichannel EMG signals. Among them, the most important is the uniqueness of the distribution of motor unit action potentials across electrodes (that defines the separation vector) among all the other active motor units within the recording volume (Caillet et al., 2023; Farina et al., 2008a). When this condition is not met, merged motor units appear in the motor unit pulse train, causing an increase in false positives (Figures 3 and 4) One way to satisfy this condition is to increase the selectivity of the electrodes to record the discharge activity of only a few motor units from a small volume of muscle (LeFever and De Luca, 1982). For example, Figure 1A shows motor unit action potentials detected only over 3–4 electrode sites along the array of intramuscular electrodes, while a motor unit action potential can be observed across many more electrodes with grids of surface electrodes. Therefore, the likelihood of having spatially overlapping motor unit action potentials – and thus merged motor units – is lower, which explains why the rate of agreement of motor units identified from intramuscular arrays of electrodes is much higher than grids of surface electrodes (Muceli et al., 2015; Muceli et al., 2022). A second way to increase the percentage of discriminable motor units among all the active motor units in the recording volume is to increase the spatial sampling of their activity using multiple electrodes (Farina et al., 2016; Caillet et al., 2023; Farina and Holobar, 2016; Farina et al., 2008a). This has led to the growth of EMG recording systems with dense grids of surface electrodes (Farina et al., 2016), which compensate for the lack of specificity of motor unit action potential profiles that are recorded when using a pair of traditional bipolar EMG electrodes (Lindstrom and Magnusson, 1977).

Another necessary condition for EMG decomposition using the blind-source separation algorithm is the consistency of the motor unit filters across time. An obvious reason inducing changes in motor unit filters would be the displacement of the electrodes relatively to the source. Such drifts also exist with intracortical arrays and can be corrected with appropriate methods that track waveforms across electrodes (Steinmetz et al., 2021). However, the geometry of the muscle tissue is much more variable than that of the cortical tissue, especially during movements. For example, muscle bellies become bulkier while shortening (Herbert et al., 2019), increasing the distance between the surface electrodes and the deep sources. In addition, the pennation angle of muscle fibres can change with contraction intensity (Fukunaga et al., 1997), modifying the direction of the propagation of motor unit action potentials along the fibres relatively to the position of the electrodes. All these factors impact the recorded motor unit action potential profiles across electrodes, which in turn will reduce the capacity to discriminate the same motor unit from the EMG signal (Oliveira and Negro, 2021; Farina et al., 2004; Glaser et al., 2017). For these reasons, we recommend applying our approach during isometric contractions with a stable level of force, as even large changes in force during isometric contractions can impact the orientation of the muscle fibres relatively to the skin within muscles (Ito et al., 1998).

Usage of the software

The first step of the algorithm consists of identifying motor unit separation vectors (motor unit filters) from EMG signals with fastICA (Negro et al., 2016; Barsakcioglu et al., 2021; Chen and Zhou, 2016). Classically, metrics such as the Pulse to Noise ratio (Holobar et al., 2014) or the silhouette value (Negro et al., 2016) are used to assess the reliability of the identified motor units by estimating the distance between the spikes and the noise. Here, we purposely reported all the motor units identified from offline decomposition in Figure 2 to illustrate the importance of manual editing, but a threshold should be used to automatically remove inaccurate spike trains (i.e. 0.9 in Negro et al., 2016). It is noteworthy that such approach must always be associated with extensive manual editing to remove the discharge times incorrectly selected and to add missing spikes (Del Vecchio et al., 2020; Hug et al., 2021). This necessary step precedes the update of the motor unit filter with all the detected spikes (Holobar et al., 2010), leading to an increase in the silhouette value and a decrease in the coefficient of variation of the interspike intervals (Figure 2B). Alternatively, one could speed up the processing flow by setting a higher threshold for the silhouette value. This would decrease the burden of manual editing at the cost of decreasing the number of identified motor units. However, it is important to note that using more stringent criteria does not preclude the manual editing, even for motor units with a high silhouette value (see motor units 1 and 2 with missed spikes in Figure 1B).

The second step of the algorithm consists of identifying motor units discharge times in real time by projecting extended segments of EMG signals on separation vectors (motor unit filters) to estimate motor unit pulse trains (Figure 1B; Barsakcioglu et al., 2021; Chen et al., 2020). This method was effective at identifying motor unit discharge times, with rates of agreement >0.75, regardless of the contraction intensity and muscle (Figure 5). It is noteworthy that the performance was particularly high for the recordings made with an intramuscular array of electrodes (rate of agreement of 0.97 ± 0.05, Figure 5). As mentioned above, the better performance of blind-source separation on multichannel intramuscular EMG has already been reported with offline analyses (Muceli et al., 2015; Muceli et al., 2022; Chen et al., 2019). This is explained by the higher spatial selectivity of the electrodes (LeFever and De Luca, 1982), the larger bandwidth of the signal (Lindstrom and Magnusson, 1977), and the higher robustness of the motor unit filter as the signal is less affected by the geometric changes of the volume conductor. In contrast, precision and rates of agreements were lower for motor units identified over the vastii and gastrocnemii muscles when compared to the TA muscle (Figure 5). Even though the reason for this between-muscle difference is unclear, it is possible that the specific activation level of the vastii and gastrocnemii muscles varied more than that of TA between the baseline and test contractions because of muscle redundancy leading to multiple coordination strategies possible to perform knee flexion or plantarflexion. For example, a decrease in activation would decrease the height of the peaks of the estimated sources, potentially classified in the noise class during the online decomposition (Chen et al., 2020). Conversely, an increase in activation may activate motor units spatially close to those observed during the baseline contraction, corrupting their pulse train with merged sources (Holobar and Farina, 2014; Farina and Holobar, 2016). This explanation is in line with the lower rate of agreement observed when participants tracked a force target higher than the level of the baseline contraction (Figures 3 and 4). One way to overcome these challenges would be to dynamically update the motor unit filters and the centroids of the ‘spikes’ and ‘noise’ classes (Chen et al., 2020; Yeung et al., 2024; Mendez Guerra et al., 2024). While appealing, this approach is also computationally demanding (Chen et al., 2020; Yeung et al., 2024; Mendez Guerra et al., 2024). We propose to update the motor unit filters and the centroids of the ‘spikes’ and ‘noise’ classes during the resting periods. In addition, it is recommended that the operator displays the motor unit pulse trains and identified discharge times between contractions to check for decomposition accuracy across the session.

Inter-individual differences in motor unit yields

An important consideration regarding the implementation of offline or real-time surface EMG decomposition is the difference between individuals, with an overall lower yield in number of identified motor units in females (here: 9 ± 12) than in males (here: 30 ± 13). Typically, the number of identified motor units from surface EMG is twice as low in females than males (Del Vecchio et al., 2020; Lulic-Kuryllo and Inglis, 2022; Taylor et al., 2022). The cause for this difference remains unclear. It may be related to variations in properties of the tissues separating the motor units from the recording electrodes, or to differences in the morphological and physiological properties of muscle fibres, as well as to the innervation ratios of motor units. These sex-related differences have so far only been supported by data extracted from animal experiments (Mierzejewska-Krzyżowska et al., 2011). However, the recent developments of simulation frameworks capable of generating highly realistic EMG signals for anthropometrically diverse populations may help understanding the impact of sex-related differences in humans (Maksymenko et al., 2023). Specifically, these simulations can account for diverse anatomical (e.g. muscle volume and architecture, thickness of subcutaneous tissues) and physiological characteristics (e.g. innervation ratio, number of motor units, fibre cross-sectional area, fibre conduction velocity, contribution of rate coding vs. spatial recruitment). Generating such dataset could help identifying the primary factors affecting EMG decomposition performance, ultimately enabling the refinement of algorithms and/or surface electrode design.

Summary

Overall, the main purpose of our software is to display to the participant a real-time visual feedback based on the activity of individual motor units or populations of motor units. The RMSE of the smoothed discharge rates was constantly below two pulses per second, with values as low as 0.44 ± 0.43 pps for the TA muscle recorded with intramuscular electrode arrays. Thus, the movement of the cursors accurately represented the variations in motor unit firing activity to the participant. In this study we have presented results of control of smoothed firing rates over a relatively large smoothing window, but the duration of the smoothing filter can be chosen by the user according to the needs and applications. Operators could use the provided software to interact with a virtual environment, such as typing on a keyboard with a cursor moved by modulating motor unit firing rates (Formento et al., 2021). In the field of motor control, neuroscientists may train participants to selectively activate individual motor units (Bräcklein et al., 2022), testing the concept of rigid versus flexible motor control (Formento et al., 2021; Bräcklein et al., 2022; Marshall et al., 2022), or movement augmentation (Eden et al., 2022). Generally, we hope that this open-source software will open perspectives for neuroscientists to design experimental paradigms that takes advantage of online EMG decomposition to study the neural control of movements at the motor neuron level.

Materials and methods

Simulation of EMG signals

We generated synthetic EMG signals using an anatomical model of a cylindrical muscle volume with parallel fibres surrounded by subcutaneous tissues and skin (Farina et al., 2008a; Konstantin et al., 2020). The muscle radius was 10 mm, and the thicknesses of the subcutaneous and skin layers were 4 mm and 1 mm, respectively. The centres of 150 motor unit territories were randomly and evenly distributed across the muscle cross-section. The number of fibres innervated by each motor neuron followed an exponential distribution, ranging from 66 to 3321 (Enoka and Fuglevand, 2001). The fibres of the same motor unit were positioned around the centre of the motor unit within areas of 0.8–78.5 mm². The fibre density in the muscle reached 400 fibres/mm². The motor unit action potentials were detected in the model by either a grid of 64 circular surface electrodes with a diameter of 1 mm arranged in 5 columns and 13 rows (inter-electrode distance: 4 mm) or 16 circular intramuscular electrodes arranged in a single array (inter-electrode distance: 1 mm). The grid was centred over the muscle in the transverse direction. The intramuscular electrode array was centred with respect to the grid and inserted at an angle of 30° along the longitudinal direction of the volume toward the centre of the muscle.

Four profiles of force were generated, with either trapezoidal patterns reaching 10, 20, or 30% of the maximal force, or a sinusoidal pattern with the force varying between 15 and 25% MVC at a rate of 0.5 Hz. Each discharge time elicited single-fibre electrical potentials, summed together within each motor unit. The profile of each motor unit action potential changed between electrodes according to the morphology of the fibres and the distance of the fibres relative to the electrode. Ultimately, the synthetic EMG signal represented the sum of all motor unit action potentials and Gaussian noise.

Electromyographic recordings

The accuracy and capabilities of the online EMG decomposition algorithm was tested on a series of experimental data collected with either surface or intramuscular arrays of electrodes from five different muscles.

Surface EMG signals were recorded from the gastrocnemius medialis and lateralis (GM and GL; triceps surae protocol) or the vastus medialis and lateralis (VM and VL; quadriceps protocol) with two-dimensional adhesive grids of 64 electrodes (13 × 5 electrodes with one electrode absent on a corner, gold-coated, interelectrode distance: 8 mm; GR08MM1305, OT Bioelettronica). Surface EMG signals were recorded from the tibialis anterior with four two-dimensional adhesive grids of 64 electrodes (13 × 5 electrodes with one electrode absent on a corner, gold-coated, interelectrode distance: 4 mm; GR04MM1305, OT Bioelettronica). Before the placement of the grids, the skin was shaved and cleaned with an abrasive gel (Nuprep, Weaver and Company, USA). Each adhesive grid was held on the skin using a disposable adhesive foam layer. The cavities within the adhesive layer were filled with conductive paste (SpesMedica, Italy) to facilitate the skin-electrode contact. A 10-cm-wide elastic band was placed over the electrodes to ensure good contact between the electrodes and the skin throughout the experiment.

An intramuscular linear array of 16 electrodes on a thin-film (platinum-coated, interelectrode distance: 1 mm) was inserted into the tibialis anterior in one participant at an approximate angle of 30°. The insertion was guided with a portable ultrasound probe (Butterfly IQ+, Butterfly Network, USA).

A reference electrode was positioned over the tibia of the right limb (triceps surae protocol), over the patella of the right limb (quadriceps protocol), or over the medial malleolus (tibialis anterior protocol). A strap electrode dampened with water was placed around the ankle (ground electrode) for each data collection. The EMG signals were recorded in monopolar mode and digitized together with the torque signal at a sampling rate of 2048 Hz for the grids of surface electrodes and 10,240 Hz for the intramuscular array of electrodes (EMG-Quattrocento, 400 channel EMG amplifier; OT Bioelettronica).

Experimental procedure

A total of 29 individuals participated in the experiments (4 females/25 males; 28 ± 5 years old; 178 ± 6 cm; 73 ± 16 kg). None of the participants reported lower limb injury or pain in the 6 months prior to testing. Ethical committees approved the study (triceps surae and quadriceps protocols: CERNI – Nantes Université, n°04022022; tibialis anterior protocol: Imperial College London, no. 18IC4685). All participants provided their informed written consent before the beginning of the experiment.

The right side of the body was tested for all participants and for all protocols. For the triceps surae protocol, participants sat on a dynamometer (Biodex System 3 Pro, Biodex Medical, USA) with their hip flexed at 80°, 0° being the neutral position, and their right leg fully extended. Their ankle angle was set to 10° of plantarflexion, 0° being the foot perpendicular to the shank. For the quadriceps protocol, participants sat on the dynamometer with their hips flexed at 80° and the knee of their right leg flexed at 80°, 0° being the full extension. Inextensible straps were tightened during both tasks to immobilise the torso, pelvis, and thigh on the test side. For the tibialis anterior protocol, participants sat on a chair while their foot was fixed onto the pedal of a dynamometer (OT Bioelettronica) coupled with a load cell (CCT Transducer, Italy) and positioned at 30° in the plantarflexion direction (0° being the foot perpendicular to the shank). The foot was fixed to the pedal with inextensible straps positioned around the proximal phalanx, metatarsal, and cuneiform. Force signals were recorded using the same acquisition system as for the EMG recordings (EMG-Quattrocento; OT Bioelettronica).

All experiments began with a standardised warm up, which included five 3 s isometric plantar flexion or knee extension contractions at 50, 60, 70, and 80%, and three 3 s contractions at 90% of the participants’ subjective maximal torque. Then, after 2 min of rest, participants performed three MVCs for 3–4 s, with 60 s of rest in between. Peak MVC torque was considered as the maximal value obtained from a moving average window of 250 ms.

For the triceps surae and quadriceps protocols, participants performed three trapezoid isometric contractions at 40% of the MVC (referred to as baseline contractions) to identify motor unit filters offline. Each of these contractions involved a 5 s ramp-up, a 20 s plateau, and a 5 s ramp-down phase and was separated by 60 s of rest. The separation vectors were identified offline from these contractions and then applied in real time to estimate the firing activity of each identified motor unit during three additional trapezoid contractions (referred to as the online task). Each of these online tasks involved a 5 s ramp-up, a 30 s plateau, and a 5 s ramp-down phase and was separated by 60 s of rest. To test the effect of variations in contraction intensity between the online task and the baseline contraction used to identify the separation vectors, each plateau consisted of three successive 10 s targets at 35, 40, or 45% of the MVC performed in a random order. During these online tasks, feedback of motor unit discharge times and torque output was displayed in real time on a monitor to the participants.

To test the effect of the baseline contraction intensity on the accuracy of real-time identification of motor unit discharge activity; the procedure was repeated with a baseline intensity of 20% MVC. During the last three trapezoidal contractions, each plateau consisted of three successive 10 s targets at 15, 20, or 25% of the MVC performed in a random order.

For the tibialis anterior protocol with grids of surface electrodes, participants performed a trapezoid contraction at 10 and/or 20% of the MVC, involving a 10 s ramp up, a 60 s plateau, and a 10 s ramp-down phase (baseline contraction). The separation vectors were identified from this contraction and then applied in real time over a second identical contraction (online task). The same procedure was repeated for the tibialis anterior protocol with an intramuscular array of electrodes, with contractions involving a ramp up phase of 2 s, a plateau of 20 s, and a ramp-down phase of 2 s.

Data processing

Mathematical modelling of the recorded spike trains

The spike train of a motor neuron recorded over time t[0,T] can be described as the result of a convolution between a delta function (δ) representing the firing times (φ), and finite impulse responses (h) representing action potentials of duration L:l=0L1h(l)rδ(tϕrl). In practice, the nature of h and the duration L depend on the type of recordings. For electrophysiological measurements, h characterises the local electrical field generated by the spike and conducted through the surrounding tissues.

As the recorded volume of tissue comprises many active neurons, each recording can be considered as a convolutive mixture of multiple sources, and the previous equation can be expressed in the form of a matrix to also consider all the electrodes of an array: given s(k)=rδ(kφr);X(t)=l=0L1H(l)S(kl)+N(t), where X(t)=[x1(t),x2(t),...,xm(t)]T is a matrix of m electrophysiological signals, S(t)=[s1(t),s2(t),...,sn(t)]T is a matrix of n motor neurons’ spike trains, and H(l) is a m by n matrix containing the lth sample of action potentials from n neurons and m signals. In this situation, we can reformulate the model as an instantaneous mixture of an extended set of sources, that is, the motor neurons’ spike trains and their delayed versions. This allows us to simply write the previous equation as a multiplication of matrices, in which each source is delayed L times, L being the duration of the impulse response h. This model can be inverted for neural decoding with source-separation approaches.

Identification of separation vectors (motor unit filters) with blind-source separation

The monopolar EMG signals collected during the baseline contractions were extended with an extension factor of 1000m (Holobar and Zazula, 2007), where m is the number of channels free of any noise or artefact. The signals were then demeaned and whitened. A contrast function was iteratively applied to estimate a separation vector that maximised the level of sparseness of the motor unit pulse train (Figure 1B). This loop stopped when the variation of the separation vector between two successive iterations reaches a predefined lower bound. After the application of a peak detection algorithm, the motor unit pulse train contained high peaks (i.e. the spikes from the identified motor unit) and low peaks from other motor units and noise. High peaks were separated from low peaks and noise using k-mean classification with two classes (Figure 1B). The peaks from the class with the highest centroid were considered as spikes of the identified motor unit. A second algorithm refined the estimation of the discharge times by iteratively recalculating the separation vector and repeating the steps with peak detection and k-mean classification until the coefficient of variation of the interspike intervals was minimised. The accuracy of each estimated spike train was assessed by computing the silhouette (SIL) value between the two classes of peaks identified with k-mean classification (Negro et al., 2016). When the SIL exceeded a predetermined threshold, the motor unit filter was saved for the real-time decomposition, together with the centroids of the ‘spikes’ and ‘noise’ classes (Figure 1B).

Manual editing

There is a consensus among experts that automatic decomposition should be followed by visual inspection and manual editing (Martinez-Valdes et al., 2023). Manual editing involves the following steps: (1) removing spikes that result in erroneous firing rates (outliers), (2) adding discharge times that are clearly distinguishable from the noise, (3) recalculating the separation vector, (4) reapplying the separation vector on the EMG signals (either a selected window or the entire signal), and (5) repeating this procedure until no outliers are present and all clearly distinguishable spikes have been selected. Importantly, the manual editing of potentially missed or falsely identified discharge times should not be accepted before the application of the updated motor unit separation vector, thereby generating a new pulse train. Manual edits should be accepted only if the silhouette value improves following this operation or remains well above the pre-established threshold. A more extensive description of the manual editing of motor unit pulse trains can be found in Del Vecchio et al., 2020. Even though some of the aforementioned steps involve subjective decision-making, evidence suggests that manual editing after EMG decomposition with blind-source separation approaches remains highly reliable across operators (Hug et al., 2021). Specifically, the median rate of agreement calculated for 126 motor units over eight operators with various experience in manual editing was 99.6%. All raw and processed data have been made available on a public data repository so that they can be used for training new operators (http://doi.org/10.6084/m9.figshare.13695937).

Real-time identification of motor neuron activities

EMG signals were transmitted by packages of 256 data points for the surface grid recordings (125 ms with a sampling frequency of 2048 Hz) or 1280 data points for the intramuscular array recordings (125 ms with a sampling frequency of 10,240 Hz). The electrode mask determined from the baseline contractions was applied to remove the channels with noise or artefacts and the data was extended using the same extension factor as for the baseline contraction (see the section on EMG decomposition above). The matrix of separation vectors identified during the baseline contraction was applied over the extended EMG signal. Local peaks were identified for each motor unit using the MATLAB function ‘islocalmax’ with a minimal separation of 25 ms between peaks to limit the number of false positives (Figure 1C). These peaks were considered as spikes when their distance from the centroid of the ‘spike’ class was shorter than the distance from the centroid of the ‘noise’ class (Figure 1C). Both centroids were identified from the offline decomposition made on the baseline contraction.

We calculated the firing rate (i.e. spikes per second) of individual motor units as the sum of the spikes over a moving window of eight consecutive epochs of 125 ms. We chose this approach to facilitate the smoothness of the visual feedback, in contrast to the instantaneous firing rate, which is calculated as the instantaneous inversed interspike interval, which oscillates more due to the presence of synaptic noise. While this approach introduces a delay of 500 ms in the estimation of the firing rate, we identified in pilot testing that this also facilitates the control of motor unit firing activities by the participant. To further increase the smoothness of the online biofeedback, we added the option in the software to average individual firing rates using a moving window. For the data reported in this article, we selected a value of four consecutive values, corresponding to a window of 500 ms. Note that researchers who aim to minimise the delay of the visual feedback can disable this option, change its value, or use the real-time raster plots that displays the instantaneous discharge times of each motor unit.

Computational time

The computational time depends on the number of identified motor units during the baseline contraction, the number of peaks sorted during each epoch, and the number of EMG channels retained for the analysis. We considered the computational time for the decomposition as the time between the reception of the EMG signals by the computer and the estimation of the discharge times of all the identified motor units. We considered the computational time for the feedback as the time between the decomposition of the EMG signals and the update of the online feedback. The computational times were calculated on a laptop equipped with an Apple M1 Max chip and 64 GB of RAM.

On average, the time between the reception of an epoch of EMG signals and the identification of the spikes was 4.9 ± 3.0 ms for data collected with high-density grids of surface electrodes. To estimate the computational time per motor unit, we performed a linear regression between the number of identified motor units and the computational time per epoch using data from all the experiments made with high-density surface electrodes. The slope of the linear fit, that is, the computational time per motor unit, was 0.37 ms (Figure 7A). Across all the experiments, the maximal computational time was 13.1 ms for 26 identified motor units. Of note, when considering the experiment made with intramuscular arrays of electrodes, the computational time reached 32.0 ms for nine identified motor units. This was longer than observed for the same number of identified motor units using high-density surface electrodes (5.2 ms; Figure 7B) and was due to the greater sampling frequency used for the intramuscular recordings.

Figure 7. Computational time of the online electromyographic (EMG) decomposition.

Figure 7.

(A) We considered the computational time for the decomposition as the time between the reception of the EMG signals and the identification of the spikes for all the motor units. We computed the linear regression between the number of identified motor units and the computational time and considered the slope as the computational time per motor unit. Each dot represents one decomposition, and the colour scheme depends on the muscle. (B) As the sampling frequency differed between recordings with high-density grids and intramuscular arrays of electrodes, we compared the computational times for both techniques with the same number of identified motor units (i.e. 9). (C, D) After the decomposition, the motor unit discharge activity was translated into visual feedback, either in the form of a raster plot or the smoothed firing rates for all the identified motor units. As for the decomposition, we normalised the computational time per motor unit using a linear regression.

We then calculated the additional computational time to display visual feedback in the form of a raster plot or smoothed firing rates of all the identified motor units. On average, we observed computational times of 8.6 ± 5.7 ms and 11.2 ± 7.6 ms for raster plots and smoothed firing rates, respectively. The computational time per motor unit was 0.74 ms and 0.99 ms for raster plots and smoothed firing rates, respectively (Figure 7). Of note, the computational time for the quadrant plot made from the activity of two motor units reached 14.8 ± 0.0 ms on average. The standard deviation of computational times across windows reached 5.4 ± 4.0 ms (raster plot), 4.0 ± 3.2 ms (smoothed firing rate), and 2.8 ± 2.5 ms (quadrant). It is noteworthy that the computational times for experiments with grids of electrodes or intramuscular arrays of electrodes was similar regardless of the type of visual feedback (Figure 7). Overall, as the total computational time was constantly shorter than the duration of an epoch of EMG signals, the visual feedback was always updated during the recording of the next epoch of EMG signals. Therefore, the only delay was the incompressible recording time per epoch of signals, that is, 125 ms.

Accuracy of the real-time identification of motor unit firing activity

To assess the accuracy of the real-time identification of motor unit spike trains, we compared the motor unit spike trains identified in real time with those obtained after manual editing. The manual editing was performed offline as described above (Del Vecchio et al., 2020; Hug et al., 2021).

The accuracy of the real-time decomposition was assessed for each motor unit by computing the sensitivity [TP/(TP + FN)], the precision [TP/(TP + FP)], the false negative rate [FN/(TP + FN)], and the rate of agreement [TP/(TP + FN + FP)] between the manually edited spike train (offline) and the spike train identified in real time.

Here, TP (true positive) is the number of spikes identified in both the real time and edited spike trains, FP (false positive) is the number of spikes only identified in the real-time spike train and FN (false negative) is the number of spikes only identified in the edited spike train.

To assess the accuracy of the biofeedback provided by the software, we measured the RMSE between the path drawn by the smoothed firing rate of motor units estimated in real time and the path estimated from the manually edited motor unit spike trains.

Data availability

The entire data set (raw and processed data) codes and a user manual of the software are available at https://github.com/simonavrillon/I-Spin, copy archived at Avrillon, 2024.

Funding Statement

The funders had no role in study design, data collection and interpretation, or the decision to submit the work for publication.

Contributor Information

Simon Avrillon, Email: s.avrillon@imperial.ac.uk.

J Andrew Pruszynski, Western University, Canada.

Christian Büchel, University Medical Center Hamburg-Eppendorf, Germany.

Funding Information

This paper was supported by the following grants:

  • Agence Nationale de la Recherche ANR-15-IDEX-01 to François Hug.

  • European Research Council #810346 to Dario Farina.

  • Engineering and Physical Sciences Research Council EP/T020970 to Dario Farina.

  • Biotechnology and Biological Sciences Research Council BB/V00896X to Dario Farina.

Additional information

Competing interests

No competing interests declared.

inventor of a patent (Neural Interface. UK Patent application no. GB1813762.0. August23, 2018) and of a patent application (Neural interface. UK Patent application no.GB2014671.8. September 17, 2020), which are partly related to the methods and applicationsof this work. All other authors have no financial or other relationships that might lead to aconflict of interest.

Author contributions

Conceptualization, Data curation, Software, Formal analysis, Validation, Investigation, Methodology, Writing – original draft, Writing – review and editing.

Conceptualization, Resources, Supervision, Funding acquisition, Validation, Investigation, Methodology, Writing – original draft, Writing – review and editing.

Conceptualization, Supervision, Writing – original draft, Writing – review and editing.

Software, Validation, Methodology, Writing – review and editing.

Supervision, Writing – review and editing.

Resources, Writing – review and editing.

Conceptualization, Data curation, Software, Formal analysis, Supervision, Validation, Investigation, Methodology, Writing – original draft, Writing – review and editing.

Ethics

Ethical committees approved the study (triceps surae and quadriceps protocols: CERNI - Nantes Université, no. 04022022; tibialis anterior protocol: Imperial College London, no. 18IC4685). All participants provided their informed written consent before the beginning of the experiment.

Additional files

MDAR checklist

Data availability

All data recorded for this study are available on Figshare. Code and apps associated with this study are available on Github at https://github.com/simonavrillon/I-Spin (copy archived at Avrillon, 2024).

The following datasets were generated:

Avrillon S. 2024. TA - thin films. figshare.

Avrillon S. 2024. TA - grids. figshare.

Avrillon S. 2024. GL GM - grids. figshare.

Avrillon S. 2024. VL VM - grids. figshare.

References

  1. Avrillon S. I-spin. swh:1:rev:dfc9cfad9b5f078f245e64565d7bd15a3f66d116Software Heritage. 2024 https://archive.softwareheritage.org/swh:1:dir:212e825295aadf996806cf8373d0efe34b90297d;origin=https://github.com/simonavrillon/I-Spin;visit=swh:1:snp:30c23b8f78d223a62b1cb6e56a2210ba30578cdb;anchor=swh:1:rev:dfc9cfad9b5f078f245e64565d7bd15a3f66d116
  2. Avrillon S, Hug F, Baker SN, Gibbs C, Farina D. Tutorial on MUedit: An open-source software for identifying and analysing the discharge timing of motor units from electromyographic signals. Journal of Electromyography and Kinesiology. 2024;77:102886. doi: 10.1016/j.jelekin.2024.102886. [DOI] [PubMed] [Google Scholar]
  3. Barsakcioglu DY, Bracklein M, Holobar A, Farina D. Control of spinal motoneurons by feedback from a non-invasive real-time interface. IEEE Transactions on Bio-Medical Engineering. 2021;68:926–935. doi: 10.1109/TBME.2020.3001942. [DOI] [PubMed] [Google Scholar]
  4. Basmajian JV. Control and training of individual motor units. Science. 1963;141:440–441. doi: 10.1126/science.141.3579.440. [DOI] [PubMed] [Google Scholar]
  5. Bräcklein M, Barsakcioglu DY, Ibáñez J, Eden J, Burdet E, Mehring C, Farina D. The control and training of single motor units in isometric tasks are constrained by a common input signal. eLife. 2022;11:e72871. doi: 10.7554/eLife.72871. [DOI] [PMC free article] [PubMed] [Google Scholar]
  6. Buccino AP, Hurwitz CL, Garcia S, Magland J, Siegle JH, Hurwitz R, Hennig MH. SpikeInterface, a unified framework for spike sorting. eLife. 2020;9:e61834. doi: 10.7554/eLife.61834. [DOI] [PMC free article] [PubMed] [Google Scholar]
  7. Caillet AH, Avrillon S, Kundu A, Yu T, Phillips ATM, Modenese L, Farina D. Larger and denser: an optimal design for surface grids of emg electrodes to identify greater and more representative samples of motor units. eNeuro. 2023;10:ENEURO.0064-23.2023. doi: 10.1523/ENEURO.0064-23.2023. [DOI] [PMC free article] [PubMed] [Google Scholar]
  8. Chen M, Zhou P. A novel framework based on FastICA for high density surface EMG decomposition. IEEE Transactions on Neural Systems and Rehabilitation Engineering. 2016;24:117–127. doi: 10.1109/TNSRE.2015.2412038. [DOI] [PMC free article] [PubMed] [Google Scholar]
  9. Chen M, Zhang X, Zhou P. Automatic multichannel intramuscular electromyogram decomposition: progressive fastICA peel-off and performance validation. IEEE Transactions on Neural Systems and Rehabilitation Engineering. 2019;27:76–84. doi: 10.1109/TNSRE.2018.2882338. [DOI] [PMC free article] [PubMed] [Google Scholar]
  10. Chen C, Ma S, Sheng X, Farina D, Zhu X. Adaptive real-time identification of motor unit discharges from non-stationary high-density surface electromyographic signals. IEEE Transactions on Bio-Medical Engineering. 2020;67:3501–3509. doi: 10.1109/TBME.2020.2989311. [DOI] [PubMed] [Google Scholar]
  11. Chung B, Zia M, Thomas KA, Michaels JA, Jacob A, Pack A, Williams MJ, Nagapudi K, Teng LH, Arrambide E, Ouellette L, Oey N, Gibbs R, Anschutz P, Lu J, Wu Y, Kashefi M, Oya T, Kersten R, Mosberger AC, O’Connell S, Wang R, Marques H, Mendes AR, Lenschow C, Kondakath G, Kim JJ, Olson W, Quinn KN, Perkins P, Gatto G, Thanawalla A, Coltman S, Kim T, Smith T, Binder-Markey B, Zaback M, Thompson CK, Giszter S, Person A, Goulding M, Azim E, Thakor N, O’Connor D, Trimmer B, Lima SQ, Carey MR, Pandarinath C, Costa RM, Pruszynski JA, Bakir M, Sober SJ. Myomatrix arrays for high-definition muscle recording. bioRxiv. 2023 doi: 10.1101/2023.02.21.529200. [DOI] [PMC free article] [PubMed]
  12. Del Vecchio A, Holobar A, Falla D, Felici F, Enoka RM, Farina D. Tutorial: Analysis of motor unit discharge characteristics from high-density surface EMG signals. Journal of Electromyography and Kinesiology. 2020;53:102426. doi: 10.1016/j.jelekin.2020.102426. [DOI] [PubMed] [Google Scholar]
  13. Eden J, Bräcklein M, Ibáñez J, Barsakcioglu DY, Di Pino G, Farina D, Burdet E, Mehring C. Principles of human movement augmentation and the challenges in making it a reality. Nature Communications. 2022;13:1345. doi: 10.1038/s41467-022-28725-7. [DOI] [PMC free article] [PubMed] [Google Scholar]
  14. Enoka RM, Fuglevand AJ. Motor unit physiology: some unresolved issues. Muscle & Nerve. 2001;24:4–17. doi: 10.1002/1097-4598(200101)24:1<4::aid-mus13>3.0.co;2-f. [DOI] [PubMed] [Google Scholar]
  15. Farina D, Merletti R, Enoka RM. The extraction of neural strategies from the surface EMG. Journal of Applied Physiology. 2004;96:1486–1495. doi: 10.1152/japplphysiol.01070.2003. [DOI] [PubMed] [Google Scholar]
  16. Farina D, Negro F, Gazzoni M, Enoka RM. Detecting the unique representation of motor-unit action potentials in the surface electromyogram. Journal of Neurophysiology. 2008a;100:1223–1233. doi: 10.1152/jn.90219.2008. [DOI] [PMC free article] [PubMed] [Google Scholar]
  17. Farina D, Yoshida K, Stieglitz T, Koch KP. Multichannel thin-film electrode for intramuscular electromyographic recordings. Journal of Applied Physiology. 2008b;104:821–827. doi: 10.1152/japplphysiol.00788.2007. [DOI] [PubMed] [Google Scholar]
  18. Farina D, Holobar A. Characterization of human motor units from surface EMG decomposition. Proceedings of the IEEE. 2016;104:353–373. doi: 10.1109/JPROC.2015.2498665. [DOI] [Google Scholar]
  19. Farina D, Negro F, Muceli S, Enoka RM. Principles of motor unit physiology evolve with advances in technology. Physiology. 2016;31:83–94. doi: 10.1152/physiol.00040.2015. [DOI] [PubMed] [Google Scholar]
  20. Farina D, Vujaklija I, Brånemark R, Bull AMJ, Dietl H, Graimann B, Hargrove LJ, Hoffmann K-P, Huang HH, Ingvarsson T, Janusson HB, Kristjánsson K, Kuiken T, Micera S, Stieglitz T, Sturma A, Tyler D, Weir RFF, Aszmann OC. Toward higher-performance bionic limbs for wider clinical use. Nature Biomedical Engineering. 2023;7:473–485. doi: 10.1038/s41551-021-00732-x. [DOI] [PubMed] [Google Scholar]
  21. Formento E, Botros P, Carmena JM. Skilled independent control of individual motor units via a non-invasive neuromuscular-machine interface. Journal of Neural Engineering. 2021;18 doi: 10.1088/1741-2552/ac35ac. [DOI] [PubMed] [Google Scholar]
  22. Fuglevand AJ, Winter DA, Patla AE. Models of recruitment and rate coding organization in motor-unit pools. Journal of Neurophysiology. 1993;70:2470–2488. doi: 10.1152/jn.1993.70.6.2470. [DOI] [PubMed] [Google Scholar]
  23. Fukunaga T, Kawakami Y, Kuno S, Funato K, Fukashiro S. Muscle architecture and function in humans. Journal of Biomechanics. 1997;30:457–463. doi: 10.1016/s0021-9290(96)00171-6. [DOI] [PubMed] [Google Scholar]
  24. Glaser V, Farina D, Holobar A. Simulations of high-density surface electromyograms in dynamic muscle contractions. Annual International Conference of the IEEE Engineering in Medicine and Biology Society. IEEE Engineering in Medicine and Biology Society. Annual International Conference; 2017. pp. 3453–3456. [DOI] [PubMed] [Google Scholar]
  25. Glaser V, Holobar A. Motor unit identification from high-density surface electromyograms in repeated dynamic muscle contractions. IEEE Transactions on Neural Systems and Rehabilitation Engineering: A Publication of the IEEE Engineering in Medicine and Biology Society. 2019;27:66–75. doi: 10.1109/TNSRE.2018.2885283. [DOI] [PubMed] [Google Scholar]
  26. Henneman E. Relation between size of neurons and their susceptibility to discharge. Science. 1957;126:1345–1347. doi: 10.1126/science.126.3287.1345. [DOI] [PubMed] [Google Scholar]
  27. Herbert RD, Bolsterlee B, Gandevia SC. Passive changes in muscle length. Journal of Applied Physiology. 2019;126:1445–1453. doi: 10.1152/japplphysiol.00673.2018. [DOI] [PubMed] [Google Scholar]
  28. Holobar A, Zazula D. Multichannel blind source separation using convolution kernel compensation. IEEE Transactions on Signal Processing. 2007;55:4487–4496. doi: 10.1109/TSP.2007.896108. [DOI] [Google Scholar]
  29. Holobar A, Minetto MA, Botter A, Negro F, Farina D. Experimental analysis of accuracy in the identification of motor unit spike trains from high-density surface EMG. IEEE Transactions on Neural Systems and Rehabilitation Engineering. 2010;18:221–229. doi: 10.1109/TNSRE.2010.2041593. [DOI] [PubMed] [Google Scholar]
  30. Holobar A, Farina D. Blind source identification from the multichannel surface electromyogram. Physiological Measurement. 2014;35:R143–R165. doi: 10.1088/0967-3334/35/7/R143. [DOI] [PubMed] [Google Scholar]
  31. Holobar A, Minetto MA, Farina D. Accurate identification of motor unit discharge patterns from high-density surface EMG and validation with a novel signal-based performance metric. Journal of Neural Engineering. 2014;11:016008. doi: 10.1088/1741-2560/11/1/016008. [DOI] [PubMed] [Google Scholar]
  32. Hug F, Avrillon S, Del Vecchio A, Casolo A, Ibanez J, Nuccio S, Rossato J, Holobar A, Farina D. Analysis of motor unit spike trains estimated from high-density surface electromyography is highly reliable across operators. Journal of Electromyography and Kinesiology. 2021;58:102548. doi: 10.1016/j.jelekin.2021.102548. [DOI] [PubMed] [Google Scholar]
  33. Ito M, Kawakami Y, Ichinose Y, Fukashiro S, Fukunaga T. Nonisometric behavior of fascicles during isometric contractions of a human muscle. Journal of Applied Physiology. 1998;85:1230–1235. doi: 10.1152/jappl.1998.85.4.1230. [DOI] [PubMed] [Google Scholar]
  34. Konstantin A, Yu T, Le Carpentier E, Aoustin Y, Farina D. Simulation of motor unit action potential recordings from intramuscular multichannel scanning electrodes. IEEE Transactions on Bio-Medical Engineering. 2020;67:2005–2014. doi: 10.1109/TBME.2019.2953680. [DOI] [PubMed] [Google Scholar]
  35. LeFever RS, De Luca CJ. A procedure for decomposing the myoelectric signal into its constituent action potentials--Part I: Technique, theory, and implementation. IEEE Transactions on Bio-Medical Engineering. 1982;29:149–157. doi: 10.1109/tbme.1982.324881. [DOI] [PubMed] [Google Scholar]
  36. Lindstrom LH, Magnusson RI. Interpretation of myoelectric power spectra: A model and its applications. Proceedings of the IEEE. 1977;65:653–662. doi: 10.1109/PROC.1977.10544. [DOI] [Google Scholar]
  37. Lulic-Kuryllo T, Inglis JG. Sex differences in motor unit behaviour: A review. Journal of Electromyography and Kinesiology. 2022;66:102689. doi: 10.1016/j.jelekin.2022.102689. [DOI] [PubMed] [Google Scholar]
  38. Maksymenko K, Clarke AK, Mendez Guerra I, Deslauriers-Gauthier S, Farina D. A myoelectric digital twin for fast and realistic modelling in deep learning. Nature Communications. 2023;14:1600. doi: 10.1038/s41467-023-37238-w. [DOI] [PMC free article] [PubMed] [Google Scholar]
  39. Marshall NJ, Glaser JI, Trautmann EM, Amematsro EA, Perkins SM, Shadlen MN, Abbott LF, Cunningham JP, Churchland MM. Flexible neural control of motor units. Nature Neuroscience. 2022;25:1492–1504. doi: 10.1038/s41593-022-01165-8. [DOI] [PMC free article] [PubMed] [Google Scholar]
  40. Martinez-Valdes E, Enoka RM, Holobar A, McGill K, Farina D, Besomi M, Hug F, Falla D, Carson RG, Clancy EA, Disselhorst-Klug C, van Dieën JH, Tucker K, Gandevia S, Lowery M, Søgaard K, Besier T, Merletti R, Kiernan MC, Rothwell JC, Perreault E, Hodges PW. Consensus for experimental design in electromyography (CEDE) project: Single motor unit matrix. Journal of Electromyography and Kinesiology. 2023;68:102726. doi: 10.1016/j.jelekin.2022.102726. [DOI] [PubMed] [Google Scholar]
  41. McGill KC, Lateva ZC, Marateb HR. EMGLAB: an interactive EMG decomposition program. Journal of Neuroscience Methods. 2005;149:121–133. doi: 10.1016/j.jneumeth.2005.05.015. [DOI] [PubMed] [Google Scholar]
  42. Mendez Guerra I, Barsakcioglu DY, Farina D. Wearable neural interfaces: real-time identification of motor neuron discharges in dynamic motor tasks. bioRxiv. 2024 doi: 10.1101/2024.02.05.578874. [DOI]
  43. Mierzejewska-Krzyżowska B, Drzymała-Celichowska H, Celichowski J. Gender differences in the morphometric properties of muscle fibres and the innervation ratio of motor units in rat medial gastrocnemius muscle. Anatomia, Histologia, Embryologia. 2011;40:249–255. doi: 10.1111/j.1439-0264.2011.01066.x. [DOI] [PubMed] [Google Scholar]
  44. Muceli S, Poppendieck W, Negro F, Yoshida K, Hoffmann KP, Butler JE, Gandevia SC, Farina D. Accurate and representative decoding of the neural drive to muscles in humans with multi-channel intramuscular thin-film electrodes. The Journal of Physiology. 2015;593:3789–3804. doi: 10.1113/JP270902. [DOI] [PMC free article] [PubMed] [Google Scholar]
  45. Muceli S, Poppendieck W, Holobar A, Gandevia S, Liebetanz D, Farina D. Blind identification of the spinal cord output in humans with high-density electrode arrays implanted in muscles. Science Advances. 2022;8:eabo5040. doi: 10.1126/sciadv.abo5040. [DOI] [PMC free article] [PubMed] [Google Scholar]
  46. Negro F, Muceli S, Castronovo AM, Holobar A, Farina D. Multi-channel intramuscular and surface EMG decomposition by convolutive blind source separation. Journal of Neural Engineering. 2016;13:026027. doi: 10.1088/1741-2560/13/2/026027. [DOI] [PubMed] [Google Scholar]
  47. Oliveira AS, Negro F. Neural control of matched motor units during muscle shortening and lengthening at increasing velocities. Journal of Applied Physiology. 2021;130:1798–1813. doi: 10.1152/japplphysiol.00043.2021. [DOI] [PubMed] [Google Scholar]
  48. Oliveira DS, Ponfick M, Braun DI, Osswald M, Sierotowicz M, Chatterjee S, Weber D, Eskofier B, Castellini C, Farina D, Kinfe TM, Del Vecchio A. A direct spinal cord–computer interface enables the control of the paralysed hand in spinal cord injury. Brain. 2024;10:1093. doi: 10.1093/brain/awae088. [DOI] [PMC free article] [PubMed] [Google Scholar]
  49. Pachitariu M, Sridhar S, Stringer C. Solving the spike sorting problem with kilosort. bioRxiv. 2023 doi: 10.1101/2023.01.07.523036. [DOI]
  50. Rey HG, Pedreira C, Quian Quiroga R. Past, present and future of spike sorting techniques. Brain Research Bulletin. 2015;119:106–117. doi: 10.1016/j.brainresbull.2015.04.007. [DOI] [PMC free article] [PubMed] [Google Scholar]
  51. Rossato J, Avrillon S, Tucker K, Farina D, Hug F. The volitional control of individual motor units is constrained within low-dimensional neural manifolds by common inputs. The Journal of Neuroscience. 2024;44:e0702242024. doi: 10.1523/JNEUROSCI.0702-24.2024. [DOI] [PMC free article] [PubMed] [Google Scholar]
  52. Sherrington CS. Remarks on some aspects of reflex inhibition. Proceedings of the Royal Society of London. Series B, Containing Papers of a Biological Character. 1925;97:519–545. doi: 10.1098/rspb.1925.0017. [DOI] [Google Scholar]
  53. Steinmetz NA, Aydin C, Lebedeva A, Okun M, Pachitariu M, Bauza M, Beau M, Bhagat J, Böhm C, Broux M, Chen S, Colonell J, Gardner RJ, Karsh B, Kloosterman F, Kostadinov D, Mora-Lopez C, O’Callaghan J, Park J, Putzeys J, Sauerbrei B, van Daal RJJ, Vollan AZ, Wang S, Welkenhuysen M, Ye Z, Dudman JT, Dutta B, Hantman AW, Harris KD, Lee AK, Moser EI, O’Keefe J, Renart A, Svoboda K, Häusser M, Haesler S, Carandini M, Harris TD. Neuropixels 2.0: A miniaturized high-density probe for stable, long-term brain recordings. Science. 2021;372:eabf4588. doi: 10.1126/science.abf4588. [DOI] [PMC free article] [PubMed] [Google Scholar]
  54. Taylor CA, Kopicko BH, Negro F, Thompson CK. Sex differences in the detection of motor unit action potentials identified using high-density surface electromyography. Journal of Electromyography and Kinesiology. 2022;65:102675. doi: 10.1016/j.jelekin.2022.102675. [DOI] [PMC free article] [PubMed] [Google Scholar]
  55. Yeung D, Negro F, Vujaklija I. Adaptive HD-sEMG decomposition: towards robust real-time decoding of neural drive. Journal of Neural Engineering. 2024;21:ad33b0. doi: 10.1088/1741-2552/ad33b0. [DOI] [PubMed] [Google Scholar]
  56. Zheng Y, Hu X. Real-time isometric finger extension force estimation based on motor unit discharge information. Journal of Neural Engineering. 2019;16:066006. doi: 10.1088/1741-2552/ab2c55. [DOI] [PubMed] [Google Scholar]

eLife assessment

J Andrew Pruszynski 1

This article compiles existing algorithms into an open-source software package that enables real-time (and offline) motor unit decomposition from muscle activity collected via grids of surface electrodes and indwelling electrode arrays. The package is valuable given that many motor neuroscience labs are using such algorithms and that there exists a host of potential applications for such data. Validation of the software package is compelling, suggesting that it can be successfully applied across a range of muscles and tasks.

Reviewer #1 (Public review):

Anonymous

Many labs world-wide now use the blind source deconvolution technique to identify the firing patterns of multiple motor units simultaneously in human subjects. This technique has had a truly transformative effective on our understanding of the structure of motor output in both normal subjects and, increasingly, in persons with neurological disorders. The key advance presented here is that the software provides real time identification of these firing patterns.

The main strengths are the clarity of the presentation and the great potential that real-time decoding will provide. Figures are especially effective and statistical analyses are excellent.

Reviewer #3 (Public review):

Anonymous

In this manuscript, Rossato and colleagues present a method for real-time decoding of EMG into putative single motor units. Their manuscript details a variety of decision points in their code and data collection pipeline that lead to a final result of recording on the order of ~10 putative motor units per muscle in human males. Overall the manuscript is highly restricted in its potential utility but may be of interest to aficionados. For those outside the field of human or nonhuman primate EMG, these methods will be of limited interest.

Comment on revised version

The revised manuscript has thoroughly and responsively addressed the concerns and suggestions raised in the first review. I think the method will be of use to the field and fits well within the purview of eLife's publications on methods development.

eLife. 2024 Oct 2;12:RP88670. doi: 10.7554/eLife.88670.3.sa3

Author response

Julien Rossato 1, François Hug 2, Kylie Tucker 3, Ciara Gibbs 4, Lilian Lacourpaille 5, Dario Farina 6, Simon Avrillon 7

The following is the authors’ response to the original reviews.

eLife assessment

This manuscript compiles existing algorithms into an open-source software package that enables realtime motor unit decomposition from muscle activity collected via grids of surface electrodes and indwelling electrode arrays. The software package is valuable given that many motor neuroscience labs are using such algorithms and that there exist a host of potential real-time applications for such data. Validation of the software package is generally solid but incomplete in some important areas: the primary data is narrow in scope and only from male participants, and there is a lack of ground truth tests on synthetic data. The impact of the software package could be strengthened by making it less tied to specific electrode hardware and by expanding it to easily permit offline analysis.

We thank the reviewers and editors for their comments and suggestions after reading the initial version of our manuscript. In this second iteration, we have performed a validation of the algorithm using synthetic EMG signals. We have also added experimental data collected in female participants. Finally, the new version of I-Spin is compatible with the Open Ephys GUI that can interface with devices such as the Open Ephys and Intan acquisition boards. Another version has been developed for interfacing with the devices provided by the TMSi company (https://info.tmsi.com/blog/ispin-saga-real-timemotor-unit-decomposition-tool). We believe that such changes will make I-Spin more accessible for a broad range of experimental setups and research teams. Please find below the specific answers to the reviewers’ comments.

Reviewer #1 (Public Review):

Many labs worldwide now use the blind source deconvolution technique to identify the firing patterns of multiple motor units simultaneously in human subjects. This technique has had a truly transformative effect on our understanding of the structure of motor output in both normal subjects and, increasingly, in persons with neurological disorders. The key advance presented here is that the software provides real-time identification of these firing patterns. The main strengths are the clarity of the presentation and the great potential that real-time decoding will provide. Figures are especially effective and statistical analyses are excellent.

We thank the reviewer for this positive appreciation of our work.

The main limitation of the work is that only male subjects were included in the validation of the software. The reason given - that yield of number of motor units identified is generally larger in males than females - is reasonable in the sense that this is the first systematic test of this real-time approach. At a minimum, however, the authors should clearly commit to future work with female subjects and emphasize the importance of considering sex differences.

As emphasised by the reviewer, the number of identified motor units is typically higher in males than females when using surface EMG (Taylor et al., 2022), which is the current main limitation of the implementation of offline EMG decomposition technique in a broad and representative sample of research participants. These differences between biological sex are less present when using intramuscular EMG, as the signals are less affected by the filtering effect of the volume conductor separating the motor units from the recording electrodes. Besides the different yields expected between males and females, we do not expect differences in terms of the accuracy of the motor unit identification algorithm, which is the main outcome of this paper.

Nevertheless, we acknowledge the importance to understand the reasons for this difference, and the imperative to refine algorithms and/or surface electrode design to mitigate this major limitation with surface EMG.

To support this point, the discussion has been updated (P20; L480):

‘An important consideration regarding the implementation of offline or real-time surface EMG decomposition is the difference between individuals, with an overall lower yield in number of identified motor units in females (here: 9 ± 12) than in males (here: 30 ± 13). Typically, the number of identified motor units from surface EMG is twice as low in females than males (32, 49, 50). The cause for this difference remains unclear. It may be related to variations in properties of the tissues separating the motor units from the recording electrodes, or to differences in the morphological and physiological properties of muscle fibres, as well as to the innervation ratios of motor units. These sex-related differences have so far only been supported by data extracted from animal experiments (51). However, the recent developments of simulation frameworks capable of generating highly realistic EMG signals for anthropometrically diverse populations may help understanding the impact of sex-related differences in humans (52). Specifically, these simulations can account for diverse anatomical (e.g. muscle volume and architecture, thickness of subcutaneous tissues) and physiological characteristics (e.g. innervation ratio, number of motor units, fibre cross sectional area, fibre conduction velocity, contribution of rate coding vs. spatial recruitment). Generating such dataset could help identifying the primary factors affecting EMG decomposition performance, ultimately enabling the refinement of algorithms and/or surface electrode design.’

Finally, we have completed new experiments including males and females in this new iteration (P.12; L.295):

‘Application of motor unit filters in experimental data

We then asked eight participants (4 males and 4 females) to perform trapezoidal isometric contractions with plateaus of force set at 10% and 20% MVC during which surface EMG signals were recorded from the TA with 256 electrodes separated by 4 mm. The aim of this experiment was to confirm the results of the simulation; specifically, to test the accuracy of the online decomposition when the level of force was below, equal to, or above the level of force produced during the baseline contraction used to estimate the motor unit filters (Figure 4). We assessed the accuracy of the motor unit spike trains identified in real time using their manually edited version as reference. 144 motor units were identified at both 10 and 20% MVC. When the test signals were recorded at the same level of force as the baseline contraction, we obtained rates of agreement of 95.6 ± 6.8% (10% MVC) and 93.9 ± 5.9% (20% MVC). The sensitivity reached 95.9 ± 6.7% (10% MVC) and 94.4 ± 5.6% (20% MVC), and the precision reached 99.6 ± 1.3% (10% MVC) and 99.4 ± 1.9% (20% MVC).

When the filters identified at 20% MVC were applied on signals recorded at a lower level of force (10% MVC), the rates of agreement decreased to 87.9 ± 16.2%. The sensitivity also decreased to 88.0 ± 16.2%, but the precision remained high (99.4 ± 4.3). Thus, the decrease in accuracy was mostly caused by missed discharge times rather than the false identification of artifacts or spikes from other motor units. When the filters identified at 10% MVC were applied to signals recorded at a higher level of force, the rates of agreement decreased to 83.3 ± 13.5%. The sensitivity decreased to 90.7 ± 8.1%, and the precision also decreased to 90.9 ± 12.6%. This result confirms what was observed with synthetic EMG, that is motor units recruited between 10 and 20% MVC can substantially disrupt the accuracy of the decomposition in real-time, as highlighted in Figure 4 (lower panel). Importantly, this situation does not happen for all the motor units, as suggested by the distribution of the values in Figure 4.’

A second weakness is that the Introduction does a poor job of establishing the potential importance of the real-time approach.

The introduction has been modified to highlight the importance of identifying the spiking activity of motor units in real time. Specifically, the first paragraph has been rewritten to read (P3; L67):

‘The activity of motor neuron – in the form of spike trains – represents the neural code of movement to muscles. Decoding this firing activity in real-time during various behaviours can thus substantially enhance our understanding of movement control (2-5). Real-time decoding is also essential for interfacing with external devices (6) or virtual limbs (7) when activity is present at the periphery of the nervous system. For example, individuals with a spinal cord injury can control a virtual hand with the residual firing activity of the motor units in their forearm (7). Furthermore, sampling the activity of motor units receiving a substantial portion of independent synaptic inputs may pave the way for movement augmentation – specifically, extending a person’s movement repertoire through the increase of controllable degrees of freedom (8). In this way, Formento et al. (3) showed that individuals can intuitively learn to independently control motor units within the same muscle using visual cues. Having access to open-source tools that perform the real-time decoding of motor units would allow an increasing number of researchers to improve and expand the range of these applications’

Reviewer #2 (Public Review):

Rossato et al present I-spin live, a software package to perform real-time blind-source separation-based sorting of motor unit activity. The core contribution of this manuscript is the development and validation of a software package to perform motor unit sorting, apply the resulting motor unit filters in real-time during muscle contractions, and provide real-time visual feedback of the motor unit activity. I have a few concerns with the work as presented:

I found it challenging to specifically understand the technical contributions of this manuscript. The authors do not appear to be claiming anything novel algorithmically (with respect to spike sorting) or methodologically (with respect to manual editing of spikes before the use of the algorithms in real-time). My takeaway is that the key contributions are C1 development of an open-source implementation of the Negro algorithm, C2 validating it for real-time application (evaluating its sorting efficacy, and closed-loop performance, etc), and developing a software package to run in closed-loop with visual feedback. I will comment on each of these items separately below. It would be great if the authors could more explicitly lay out the key contributions of this manuscript in the text.

The main objective of this work was to provide an open-source implementation of the real-time identification of motor units together with a user interface that allow researchers to easily process the data and display the firing activity of motor unit in the form of several visual feedback. We have explicitly laid out these key contributions in the introduction: “Having access to open-source tools that perform the real-time decoding of motor units would allow an increasing number of researchers to improve and expand the range of these applications.’

Related to the above, much of the validation of the algorithms in this manuscript has a "trust me" feel. The authors note that the Negro et al. algorithm has already been validated, so very few details or presentations of primary data showing the algorithm's performance are shown. Similarly, the efficacy of the decomposition approach is evaluated using manual editing of the sorting output as a reference, which is a subjective process, and users would greatly benefit from explicit guidance. There are very few details of manual editing shown in this manuscript (I believe the authors reference the Hug et al. 2021 paper for these details), and little discussion of the core challenges and variability of that process, even though it seems to be a critical step in the proposed workflow. So this is very hard to evaluate and would be challenging for readers to replicate.

To address the reviewer’s comment, we added a validation step using synthetic EMG data (P.10; L.235).

‘Validation of the algorithm

We first validated the accuracy of the algorithm using synthetic EMG signals generated with an anatomical model entailing a cylindrical muscle volume with parallel fibres [see Farina et al. (29), Konstantin et al. (36) for a full description of the model]. In this model, subcutaneous and skin layers separate the muscle from a grid of 65 surface electrodes (5 columns, 13 rows), while an intramuscular array of electrodes is directly inserted in the muscle under the grid with an angle of 30 degrees. 150 motor units were distributed within the cross section of the muscle. Recruitment thresholds, firing rate/excitatory drive relations, and twitch parameters were assigned to each motor unit using the same procedure as Fuglevand et al. (37). During each simulation, a proportional-integral-derivative controller adjusted the level of excitatory drive to minimise the error between a predefined target of force and the force generated by the active motor units.

Figure 3A displays the raster plots of the active motor units during simulated trapezoidal isometric contractions with plateaus of force set at 10%, 20%, and 30% MVC. A sinusoidal isometric contraction ranging between 15 and 25% MVC at a frequency of 0.5 Hz was also simulated. We identified on average 10 ± 1 and 12 ± 2 motor units with surface and intramuscular arrays, respectively (Figure 3A). During the offline decomposition, the rate of agreement between the identified discharge times and the ground truth, that is, the simulated discharge times, reached 100.0 ± 0.0% for intramuscular EMG signals and 99.2 ± 1.8% for surface EMG signals (Figure 3B). The offline estimation of motor unit filters was therefore highly accurate, independently of the level of force or the pattern of the isometric contraction.

Motor unit filters estimated during a baseline contraction at 20% MVC were then applied in real-time on signals simulated during a contraction with a different pattern (sinusoidal; Figure 3C). The rates of agreement between the online decomposition and the ground truth reached 96.3 ± 4.6% and 98.4 ± 2.3% for surface and intramuscular EMG signals, respectively. Finally, we tested whether the accuracy of the online decomposition changed when the level of force decreased or increased by 10% MVC when compared to the calibration performed at 20% MVC (Figure 3D). The rate of agreement remained high when applying the motor unit filters on signals recorded at 10% MVC: 99.8 ± 0.2% (surface EMG) and 99.5 ± 0.3% (intramuscular EMG). It is worth noting that only 3 out of 10 motor units identified from surface EMG at 20% MVC were active at 10% MVC, while 8 out of 12 motor units identified from intramuscular EMG were active at 10 % MVC. This shows how the decomposition of EMG signals tends to identify the last recruited motor units, which often innervate a larger number of fibres than the early recruited motor units (38). On the contrary, the application of motor unit filters on signals simulated at 30% MVC led to a decrease in the rate of agreement, with values of 88.6 ± 14.0% (surface EMG) and

80.3 ± 19.2% (intramuscular EMG). This decrease in accuracy did not impact all the motor units, with 5 motor units keeping a rate of agreement above 95% in both signals. For the other motor units, we observed a decrease in precision, which estimates the ratio of true discharge times over the total number of identified discharge times. This was caused by the recruitment of two motor units sharing a similar space within the muscle, which resulted in a merge in the same pulse train (Figure 3D).’

In addition, we added a new paragraph in the Method section to describe the manual editing process (P.26; L.658).

‘There is a consensus among experts that automatic decomposition should be followed by visual inspection and manual editing (55). Manual editing involves the following steps: (i) removing spikes that result in erroneous firing rates (outliers), (ii) adding discharge times thar are clearly distinguishable from the noise, (iii) recalculating the separation vector, (iv) reapplying the separation vector on the EMG signals (either a selected window or the entire signal), and (v) repeating this procedure until no outliers are present and all clearly distinguishable spikes have been selected. Importantly, the manual editing of potentially missed or falsely identified discharge times should not be accepted before the application of the updated motor unit separation vector, thereby generating a new pulse train. Manual edits should be accepted only if the silhouette value improves following this operation or remains well above the preestablished threshold. A more extensive description of the manual editing of motor unit pulse trains can be found in (32). Even though some of the aforementioned steps involve subjective decision-making, evidence suggests that manual editing after EMG decomposition with blind source separation approaches remains highly reliable across operators (33). Specifically, the median rates of agreement calculated for 126 motor units over eight operators with various experience in manual editing was 99.6%. All raw and processed data have been made available on a public data repository so that they can be used for training new operators (10.6084/m9.figshare.13695937).’

I found the User Guide in the Github package to be easy to follow. Importantly, it seems heavily tied to the specific hardware (Quattrocento). I understand it may be difficult to make the full software package work with different hardware, but it seems important to at least make an offline analysis of recorded data possible for this package to be useful more broadly.

The software was updated to perform real-time decomposition with signals recorded from the Quattrocento and the Open Ephys GUI, which is compatible with Intan and Open Ephys acquisition boards. I-Spin has also been adapted by TMSi to perform real-time decomposition with their devices (https://info.tmsi.com/blog/ispin-saga-real-time-motor-unit-decomposition-tool).

Moreover, the manual editing panel of the software can now import any files from these devices and allow users to reformat data in mat files to perform offline analyses.

While this may be a powerful platform, it is also very possible that without more details and careful guidance for users on potential pitfalls, many non-experts in sorting could use this as a platform for somewhat sloppy science.

We fully agree with the reviewer that real-time EMG decomposition - with a different approach here than spike sorting - may yield unreliable results if not applied properly. As outlined in the introduction of our initial manuscript, assessing the accuracy and limitations of real-time decomposition was a primary motivation for this study. Specifically, we compared accuracy between contraction intensities, muscles, and electrode types (see Results section).

We also demonstrated that manual editing of the decomposition outputs should be done after the training phase to improve the motor unit filters, thereby improving the accuracy of real-time decomposition. We also outlined the importance to never blindly accept the result of the decomposition without visual inspection and manual editing. (P8; L214)

‘These results show how manual editing can improve the accuracy of spike detection from the motor unit pulse trains. Moreover, a SIL value around 0.9 can be used as a threshold to automatically remove the motor unit pulse trains with a poor quality a priori. Thus, these two steps were performed in the all the subsequent analyses. Importantly, it is worth noting that the motor unit pulse train must always be visually inspected after the session to check for errors of the automatic identification of discharge times.’

We have also included more detailed information about the manual editing process (see above).

The authors mention that data is included with the Github software package. I could not find any included data, or instructions on how to run the software offline on example data.

This link to the data on figshare was added in the GitHub.

Given the centrality of the real-time visual feedback to their system, the authors should show some examples of the actual display etc. so readers can understand what the system in action actually looks like (I believe there is no presentation of the actual system in the manuscript, just in the User Guide). Similarly, it would be helpful to have a schematic figure outlining the full workflow that a user goes through when using this system.

A figure of the workflow is present in the user manual. Additionally, we now display traces of visual feedback in figure 5 and we added videos of the software during each of the visual feedback in supplemental materials.

The authors note all data was collected with male subjects because more motor units can be decomposed from male subjects relative to females. But what is the long-term outlook for the field if studies avoid female subjects because their motor units may be harder to decompose? This should at least be discussed - it is an important challenge for the field to solve, and it is unacceptable if new methods just avoid this problem and are only tested on male subjects.

This point was rightly raised by each of the three reviewers. To solve this, we added data collected on four females, and discussed future developments to make the decomposition of surface EMG equally performant for everyone (P.20; L.480).

‘An important consideration regarding the implementation of offline or real-time surface EMG decomposition is the difference between individuals, with an overall lower yield in number of identified motor units in females (here: 9 ± 12) than in males (here: 30 ± 13). Typically, the number of identified motor units from surface EMG is twice as low in females than males (32, 49, 50). The cause for this difference remains unclear. It may be related to variations in properties of the tissues separating the motor units from the recording electrodes, or to differences in the morphological and physiological properties of muscle fibres, as well as to the innervation ratios of motor units. These sex-related differences have so far only been supported by data extracted from animal experiments (51). However, the recent developments of simulation frameworks capable of generating highly realistic EMG signals for anthropometrically diverse populations may help understanding the impact of sex-related differences in humans (52). Specifically, these simulations can account for diverse anatomical (e.g. muscle volume and architecture, thickness of subcutaneous tissues) and physiological characteristics (e.g. innervation ratio, number of motor units, fibre cross sectional area, fibre conduction velocity, contribution of rate coding vs. spatial recruitment). Generating such dataset could help identifying the primary factors affecting EMG decomposition performance, ultimately enabling the refinement of algorithms and/or surface electrode design.’

Specific comments on the core contributions of this paper:

C1. Development of an open-source implementation of the Negro algorithm

This seems an important contribution and useful for the community. There are very few figures showing any primary data, the efficacy of sorting, raw traces showing the waveforms that are identified, cluster shapes, etc. I realize the high-level algorithm has been outlined elsewhere, but the implementation in this package, and its efficacy, is a core component of the system and the claims being made in this paper. Much more presentation of data is needed to evaluate this.

It is worth noting that the approach used here is based on blind source separation, which is different than spike-sorting algorithms as it relies on the statistical properties of the spike trains (their sparseness) rather than the profiles of the action potentials. In short, we optimise separation vectors that are applied onto the whitened signal to generate a sparse motor unit pulse train. The discharge times are then directly estimated from the high peaks of this pulse train (Section 1 of the results; overview of the approach).

We are thus displaying motor unit pulse trains in three figures with the automatically detected discharge times, with cases of successful separation in figure 1 and merged motor units in the same pulse train in figures 3 and 4.

We also validated the algorithm with synthetic EMG to provide objective data on the accuracy of the algorithm. These results are shown in the section ‘Validation of the algorithm’ and displayed in figure 3.

Similarly, more information on the offline manual editing process (e.g. showing before/after examples with primary data) would be important to gain confidence in the method. The current paper shows application to both surface EMG and intramuscular EMG, but I could not find IM EMG examples in the Hug paper (apologies if I missed them). Surface and IM data are very, very different, so one would imagine the considerations when working with them should also be different.

In response to another comment from the reviewer, we have included more detailed information about the manual editing process (see above). As stated above, the decomposition approach used in our software differs from a spike sorting approach. Therefore, even though intramuscular and surface EMG signals are different, the decomposition and manual editing process is the same.

All descriptions of math/algorithms are presented in text, without any actual math, variable definitions, etc. This presentation makes it difficult to understand what is done. I would strongly recommend writing out equations and defining variables where possible.

More details on how the level of sparseness is controlled during optimization would be helpful.

And how this sparseness penalty is weighed against other optimization costs.

A mathematical description of the model has been added in the methods (P25; L620)

‘Mathematical modelling of the recorded spike trains.

The spike train of a motor neuron recorded over time 𝑡 ∈ [0, 𝑇] can be described as the result of a convolution between a delta function (d) representing the firing times (j), and finite impulse responses (h) representing action potentials of duration L: l=0L1h(l)rδ(tφrl). In practice, the nature of h and the duration L depend on the type of recordings. For electrophysiological measurements, h characterises the local electrical field generated by the spike and conducted through the surrounding tissues.

As the recorded volume of tissue comprises many active neurons, each recording can be considered as a convolutive mixture of multiple sources, and the previous equation can be expressed in the form of a matrix to also consider all the electrodes of an array: given rδ(kφr);X(t)=l=0L1H(l)S(kl)+N(t), where X(t)=[x1(t),x2(t),,xm(t)]T is a matrix of m electrophysiological signals, S(t)=[s1(t),s2(t),,sn(t)]T is a matrix of n motor neurons’ spike trains, and 𝐻(𝑙) is a m by n matrix containing the lth sample of action potentials from n neurons and m signals. In this situation, we can reformulate the model as an instantaneous mixture of an extended set of sources, that is, the motor neurons’ spike trains and their delayed versions. This allows us to simply write the previous equation as a multiplication of matrices, in which each source is delayed L times, L being the duration of the impulse response h. This model can be inverted for neural decoding with source-separation approaches.’

The rest of the decomposition approach was rewritten to make it clearer for the reader:

‘The monopolar EMG signals collected during the baseline contractions were extended with an extension factor of 1000/m (21), where m is the number of channels free of any noise or artifact. The signals were then demeaned and whitened. A contrast function was iteratively applied to estimate a separation vector that maximised the level of sparseness of the motor unit pulse train (Figure 1B). This loop stopped when the variation of the separation vector between two successive iterations reaches a predefined lower bound. After the application of a peak detection algorithm, the motor unit pulse train contained high peaks (i.e., the spikes from the identified motor unit) and low peaks from other motor units and noise. High peaks were separated from low peaks and noise using K-mean classification with two classes (Figure 1B). The peaks from the class with the highest centroid were considered as spikes of the identified motor unit. A second algorithm refined the estimation of the discharge times by iteratively recalculating the separation vector and repeating the steps with peak detection and K-mean classification until the coefficient of variation of the inter-spike intervals was minimised. The accuracy of each estimated spike train was assessed by computing the silhouette (SIL) value between the two classes of peaks identified with K-mean classification (24). When the SIL exceeded a predetermined threshold, the motor unit filter was saved for the real-time decomposition, together with the centroids of the ‘spikes’ and ‘noise’ classes (Figure 2A).’

Overall the paper is not very rigorous about the accuracy of motor unit identification. For example, the authors note that SIL of 0.9 is generally used for offline evaluation (why is this acceptable?), but it was lowered to 0.8 for particular muscles in this study. But overall, it is unclear how sorting accuracy/inaccuracy affects performance in the target applications of this work.

In the section mentioned by the reviewer, we aimed to show how this metric can help to automatically select motor units that are likely to have a higher accuracy of spike detections as the peaks of their pulse train are easily separable from the noise.

We reformulated the conclusion of this section to make it clearer (P8; L214):

‘These results show how manual editing can improve the accuracy of spike detection from the motor unit pulse trains. Moreover, a SIL value around 0.9 can be used as a threshold to automatically remove the motor unit pulse trains with a poor quality a priori. Thus, these two steps were performed in the all the subsequent analyses. Importantly, it is worth noting that the motor unit pulse train must always be visually inspected after the session to check for errors of the automatic identification of discharge times.’

C2. For real-time experiments, variability/jitter is important to characterize. Fig. 4 seems to be presenting mean computational times, etc, but no presentation of variability is shown. It would be helpful to depict data distributions somehow, rather than just mean values.

The variability in computational time was added to this section (P.28; L.730):

‘The standard deviation of computational times across windows reached 5.4 ± 4.0 ms (raster plot), 4.0 ± 3.2 ms (smoothed firing rate), and 2.8 ± 2.5 ms (quadrant)’

The computational time minimally varied between the successive windows, except when the labels of the x-axis were updated in real-time with scrolling feedback. It was overall always well below the duration of the window.

Author response image 1.

Author response image 1.

Computational time for each iteration of the algorithm in one participant. The top panels display the continuous computation time through the recording, while the bottom panels display the distribution of computational times. The dash line represents the duration of a window of EMG signals.

There is some description about the difference between units identified during baseline contractions, and how they might be misidentified during online contractions ("Accuracy of the real-time identification..."). This should be described in more detail.

We added an additional section in the results to clarify the concept of motor unit filters, and the reapplication of motor unit filters on signals in real-time. We highlighted how each motor unit must have a unique spatio-temporal signature to be accurately identified by our algorithms, in opposition to merged motor units sharing the same spatio-temporal features. This section shows how motor units accurately identified during baseline contractions can be misidentified during online contractions (P12; L295).

‘Application of motor unit filters in experimental data

We then asked eight participants (4 males and 4 females) to perform trapezoidal isometric contractions with plateaus of force set at 10% and 20% MVC during which surface EMG signals were recorded from the TA with 256 electrodes separated by 4 mm. The aim of this experiment was to confirm the results of the simulation; specifically, to test the accuracy of the online decomposition when the level of force was below, equal to, or above the level of force produced during the baseline contraction used to estimate the motor unit filters (Figure 4). We assessed the accuracy of the motor unit spike trains identified in real time using their manually edited version as reference. 144 motor units were identified at both 10 and 20% MVC. When the test signals were recorded at the same level of force as the baseline contraction, we obtained rates of agreement of 95.6 ± 6.8% (10% MVC) and 93.9 ± 5.9% (20% MVC). The sensitivity reached 95.9 ± 6.7% (10% MVC) and 94.4 ± 5.6% (20% MVC), and the precision reached 99.6 ± 1.3% (10% MVC) and 99.4 ± 1.9% (20% MVC).

When the filters identified at 20% MVC were applied on signals recorded at a lower level of force (10% MVC), the rates of agreement decreased to 87.9 ± 16.2%. The sensitivity also decreased to 88.0 ± 16.2%, but the precision remained high (99.4 ± 4.3). Thus, the decrease in accuracy was mostly caused by missed discharge times rather than the false identification of artifacts or spikes from other motor units.

When the filters identified at 10% MVC were applied to signals recorded at a higher level of force, the rates of agreement decreased to 83.3 ± 13.5%. The sensitivity decreased to 90.7 ± 8.1%, and the precision also decreased to 90.9 ± 12.6%. This result confirms what was observed with synthetic EMG, that is motor units recruited between 10 and 20% MVC can substantially disrupt the accuracy of the decomposition in real-time, as highlighted in Figure 4 (lower panel). Importantly, this situation does not happen for all the motor units, as suggested by the distribution of the values in Figure 4.’

Fig. 6: Given that a key challenge in sorting should be that collisions occur during large contractions, much more primary data should be presented/visualized to show how the accuracy of sorting changes during larger contractions in online experiments.

As indicated above, the decomposition approach implemented in our software is not based on spikesorting, so it does not require to separate overlapping profiles of action potentials (see Methods).

Fig.7: In presenting the accuracy of biofeedback, it is very hard to gain any intuition for performance by just looking at RMSE values. Showing the online decoded and edited trajectories would help readers understand the magnitude of errors.

We updated the figure to display examples of visual feedback before and after manual editing.

Reviewer #3 (Public Review):

In this manuscript, Rossato and colleagues present a method for real-time decoding of EMG into putative single motor units. Their manuscript details a variety of decision points in their code and data collection pipeline that led to a final result of recording on the order of ~10 putative motor units per muscle in human males. Overall, the manuscript is highly restricted in its potential utility but may be of interest to aficionados. For those outside the field of human or nonhuman primate EMG, these methods will be of limited interest.

We thank the reviewer for his/her throughout evaluation of our manuscript. We recognise that this tool/resource will immediately benefit groups working with humans or nonhuman primate models. However, the recent development of intramuscular thin films with various designs adapted to rodents and smaller animals could expand the range of future users (Chung et al., 2023, Elife). Nonetheless, decoding motor units in humans could be useful for many fields, e.g. in the domains of movement restoration and augmentation. The following paragraph has been added in the introduction section to highlight the importance of real-time decoding of motor unit activity (P3; L67):

‘The activity of motor neuron – in the form of spike trains – represents the neural code of movement to muscles. Decoding this firing activity in real-time during various behaviours can thus substantially enhance our understanding of movement control (2-5). Real-time decoding is also essential for interfacing with external devices (6) or virtual limbs (7) when activity is present at the periphery of the nervous system. For example, individuals with a spinal cord injury can control a virtual hand with the residual firing activity of the motor units in their forearm (7). Furthermore, sampling the activity of motor units receiving a substantial portion of independent synaptic inputs may pave the way for movement augmentation – specifically, extending a person’s movement repertoire through the increase of controllable degrees of freedom (8). In this way, Formento et al. (3) showed that individuals can intuitively learn to independently control motor units within the same muscle using visual cues. Having access to open-source tools that perform the real-time decoding of motor units would allow an increasing number of researchers to improve and expand the range of these applications.’

Notes

(1) Artificial data should be used with this method to provide ground truth performance evaluations. Without it, the study assumptions are unchallenged and could be seriously flawed.

A new section on the validation of the algorithm has been added. We verified the accuracy of the algorithm by comparing the series of identified discharge times with the ground truth, i.e., the simulated discharge times. (P10; L235)

‘Validation of the algorithm

We first validated the accuracy of the algorithm using synthetic EMG signals generated with an anatomical model entailing a cylindrical muscle volume with parallel fibres [see Farina et al. (29), Konstantin et al. (36) for a full description of the model]. In this model, subcutaneous and skin layers separate the muscle from a grid of 65 surface electrodes (5 columns, 13 rows), while an intramuscular array of electrodes is directly inserted in the muscle under the grid with an angle of 30 degrees. 150 motor units were distributed within the cross section of the muscle. Recruitment thresholds, firing rate/excitatory drive relations, and twitch parameters were assigned to each motor unit using the same procedure as Fuglevand et al. (37). During each simulation, a proportional-integral-derivative controller adjusted the level of excitatory drive to minimise the error between a predefined target of force and the force generated by the active motor units.

Figure 3A displays the raster plots of the active motor units during simulated trapezoidal isometric contractions with plateaus of force set at 10%, 20%, and 30% MVC. A sinusoidal isometric contraction ranging between 15 and 25% MVC at a frequency of 0.5 Hz was also simulated. We identified on average 10 ± 1 and 12 ± 2 motor units with surface and intramuscular arrays, respectively (Figure 3A). During the offline decomposition, the rate of agreement between the identified discharge times and the ground truth, that is, the simulated discharge times, reached 100.0 ± 0.0% for intramuscular EMG signals and 99.2 ± 1.8% for surface EMG signals (Figure 3B). The offline estimation of motor unit filters was therefore highly accurate, independently of the level of force or the pattern of the isometric contraction.

Motor unit filters estimated during a baseline contraction at 20% MVC were then applied in real-time on signals simulated during a contraction with a different pattern (sinusoidal; Figure 3C). The rates of agreement between the online decomposition and the ground truth reached 96.3 ± 4.6% and 98.4 ± 2.3% for surface and intramuscular EMG signals, respectively. Finally, we tested whether the accuracy of the online decomposition changed when the level of force decreased or increased by 10% MVC when compared to the calibration performed at 20% MVC (Figure 3D). The rate of agreement remained high when applying the motor unit filters on signals recorded at 10% MVC: 99.8 ± 0.2% (surface EMG) and 99.5 ± 0.3% (intramuscular EMG). It is worth noting that only 3 out of 10 motor units identified from surface EMG at 20% MVC were active at 10% MVC, while 8 out of 12 motor units identified from intramuscular EMG were active at 10 % MVC. This shows how the decomposition of EMG signals tends to identify the last recruited motor units, which often innervate a larger number of fibres than the early recruited motor units (38). On the contrary, the application of motor unit filters on signals simulated at 30% MVC led to a decrease in the rate of agreement, with values of 88.6 ± 14.0% (surface EMG) and 80.3 ± 19.2% (intramuscular EMG). This decrease in accuracy did not impact all the motor units, with 5 motor units keeping a rate of agreement above 95% in both signals. For the other motor units, we observed a decrease in precision, which estimates the ratio of true discharge times over the total number of identified discharge times. This was caused by the recruitment of two motor units sharing a similar space within the muscle, which resulted in a merge in the same pulse train (Figure 3D).’

(2) From the point of view of a motor control neuroscientist studying movement in animals other than humans or non-human primates, the title was misleadingly hopeful. The use case presented in this study requires human participants to perform isometric contractions, facilitating spatially redundant recordings across the muscle for the algorithm to work. It is unclear whether these methods will be of utility to use cases under more physiological conditions (ie. dynamic movement).

We modified the title to read: “I-Spin live: An open-source software based on blind-source separation for real-time decoding of motor unit activity in humans”.

(3) The text states that "EMG signals recorded with an array of electrodes can be considered and instantaneous mixture of the original motor unit spike trains and their delayed versions." While this may be a true statement, it is not a complete statement, since motor units at distal sites may be shared, not shared, or novel. It was not clear to me whether the diversity of these scenarios would affect the performance of the software or introduce artifacts. In other words, if at site 1 you can pick up the bulk signal of units 1,2,3,4; at site two you pick up the signals of units 2,3,4,5 and site three you pick up the signal of units 3,4,5,6, what does the algorithm assume is happening and what does it report and why?

This section has been rewritten to clarify this point. The EMG signal represents indeed the sum of the active motor units within the recorded muscle volume. Put in other words, it is possible that deep motor units or motor units with innervated fibres far away from the grid were not in this recorded muscle volume, and thus non-identifiable. Another necessary condition to ensure the identifiability of the motor unit is its unique spatio-temporal signature within the signal. It means that two motor units close to each other within the muscle volume will be merged by the model. This point was clarified in the results during the validation and the application of filters on experimental data.

(P5; L115)

‘An EMG signal represents the sum of trains of action potentials from all the active motor units within the recorded muscle volume (Figure 1A). During stationary conditions, e.g., isometric contractions, the train of motor unit action potentials can be modelled as the convolution of series of discrete delta functions, representing the discharge times, and motor unit action potentials that have a consistent shape across time. When EMG signals are recorded with an array of electrodes, the shape of the recorded potential of each motor unit differs across electrodes. This is due to (1) the varying conduction velocity of action potentials among the muscle fibres, and (2) the location/depth of the muscle fibres that belong to each motor unit relatively to the electrodes, which impact the low pass filtering effect of the tissue on the recorded potential. Increasing the number and density of recording electrodes increases the likelihood that each motor unit will have a unique motor unit action potential profile (shape), i.e., a temporal and spatial profile that differs from all the other active motor unit within the recorded volume (16, 29). The uniqueness of motor unit action potential profiles is necessary for the blind source separation to accurately estimate the motor unit discharge times. Conversely, the spike trains of two motor units with similar action potential profiles will be merged by the model.

Our software uses a fast independent component analysis (fastICA) to retrieve motor unit spike trains from the EMG signals. For this, it iteratively optimises a separation vector (i.e., the motor unit filter) for each motor unit [Figure 1B; (24-26)]. (24-26). The projection of the EMG signals on this separation vector generates a sparse motor unit pulse train, with most of its samples close to zero and a smaller number of samples significantly greater than zero (Figure 1B). The discharge times are estimated from this motor unit pulse train using a peak detection function and a k-mean classification with two classes to separate the high peaks (spikes) from the low peaks (noise and other motor units). During the decomposition in real-time, short segments of EMG signals are projected on the saved separation vectors, and the peaks are classified as discharge times if they are closer to the centroid of the class ‘spikes’ than to the centroid of the class ‘noise’ (Figure 1C). The algorithm used to identify motor units discharge activity is based on that proposed by Negro et al. (24) and Barsakcioglu et al. (26).’

(4) I could not fully appreciate the performance gap solved by the current methods. What was not achievable before that is now achievable? The 125 ms speed of deconvolution? What was achievable before? Intro text around ln 85 states that 'most of the current implementations of this approach rely on offline processing, which restricts its ability to be used..." but no reference is provided here about what the non 'most' of can achieve.

(8) The authors might try to add text to be more circumspect about the contributions of this method. I would recommend emphasizing the conceptual advances over the specifics of the performance of the algorithm since processor speed and implementation of the ideas in a faster environment (Matlab can be slow) will change those outcomes in a trivial way. Yet, much of the results section is very focused on these metrics.

The main contribution of this work submitted to the section ‘Tools and Resource’ of Elife is to provide a user interface that enables researchers to decompose EMG signals recorded with multichannel systems into motor unit activities, to perform this process in real-time, and to translate it into visual feedback. The user interface is fully open source and does not require coding experience. If necessary, the users can inspect the commented code and even modify it for their own experimental setup. The toolbox is now compatible with various acquisition boards, which can expand its use to novel surface and intramuscular arrays of electrodes.

(5) Relatedly, it would have been nice to see a proof of concept using real-time feedback for some kind of biofeedback signal. If that is the objective here, why not show us this? I found the actual readout metrics of performance rather esoteric. They may be of interest to very close experts so I will defer to them for input.

We agree with the reviewer. Videos were added to the supplemental materials to show the different forms of feedback, together with a case scenario where the participant try to separate the activity of two motor units from the same muscle.

(6) I was disappointed to see that only male participants are used because of some vague statement that 'it is widely known in the field' that more motor units can be resolved in males, without thorough referencing. It seems that the objective of the algorithm is the speed of analysis, not the number of units, which makes the elimination of female participants not justified.

The reviewer is right and that was corrected in the new version of the manuscript. We first performed additional experiments in both males and females focused on the accuracy of the approach, and further discussed the differences in yield between men and women in the discussion together with research perspectives to solve this issue.

Results (P12; L296):

‘We then asked eight participants (4 males and 4 females) to perform trapezoidal isometric contractions with plateaus of force set at 10% and 20% MVC during which surface EMG signals were recorded from the TA with 256 electrodes separated by 4 mm. The aim of this experiment was to confirm the results of the simulation; specifically, to test the accuracy of the online decomposition when the level of force was below, equal to, or above the level of force produced during the baseline contraction used to estimate the motor unit filters (Figure 4). We assessed the accuracy of the motor unit spike trains identified in real time using their manually edited version as reference. 144 motor units were identified at both 10 and 20% MVC. When the test signals were recorded at the same level of force as the baseline contraction, we obtained rates of agreement of 95.6 ± 6.8% (10% MVC) and 93.9 ± 5.9% (20% MVC). The sensitivity reached 95.9 ± 6.7% (10% MVC) and 94.4 ± 5.6% (20% MVC), and the precision reached 99.6 ± 1.3% (10% MVC) and 99.4 ± 1.9% (20% MVC).

When the filters identified at 20% MVC were applied on signals recorded at a lower level of force (10% MVC), the rates of agreement decreased to 87.9 ± 16.2%. The sensitivity also decreased to 88.0 ± 16.2%, but the precision remained high (99.4 ± 4.3). Thus, the decrease in accuracy was mostly caused by missed discharge times rather than the false identification of artifacts or spikes from other motor units. When the filters identified at 10% MVC were applied to signals recorded at a higher level of force, the rates of agreement decreased to 83.3 ± 13.5%. The sensitivity decreased to 90.7 ± 8.1%, and the precision also decreased to 90.9 ± 12.6%. This result confirms what was observed with synthetic EMG, that is motor units recruited between 10 and 20% MVC can substantially disrupt the accuracy of the decomposition in real-time, as highlighted in Figure 4 (lower panel). Importantly, this situation does not happen for all the motor units, as suggested by the distribution of the values in Figure 4.’

Discussion (P20; L480):

“An important consideration regarding the implementation of offline or real-time surface EMG decomposition is the difference between individuals, with an overall lower yield in number of identified motor units in females (here: 9 ± 12) than in males (here: 30 ± 13). Typically, the number of identified motor units from surface EMG is twice as low in females than males (32, 49, 50). The cause for this difference remains unclear. It may be related to variations in properties of the tissues separating the motor units from the recording electrodes, or to differences in the morphological and physiological properties of muscle fibres, as well as to the innervation ratios of motor units. These sex-related differences have so far only been supported by data extracted from animal experiments (51). However, the recent developments of simulation frameworks capable of generating highly realistic EMG signals for anthropometrically diverse populations may help understanding the impact of sex-related differences in humans (52). Specifically, these simulations can account for diverse anatomical (e.g. muscle volume and architecture, thickness of subcutaneous tissues) and physiological characteristics (e.g. innervation ratio, number of motor units, fibre cross sectional area, fibre conduction velocity, contribution of rate coding vs. spatial recruitment). Generating such dataset could help identifying the primary factors affecting EMG decomposition performance, ultimately enabling the refinement of algorithms and/or surface electrode design.”

(7) Human curation is often used in spike sorting, but the description of criteria used in this step or how the human curation choices are documented is missing.

To address the reviewer’s comment, we added a new paragraph in the Method section to describe the manual editing process: (P26; L657)

“There is a consensus among experts that automatic decomposition should be followed by visual inspection and manual editing (55). Manual editing involves the following steps: (i) removing spikes that result in erroneous firing rates (outliers), (ii) adding discharge times thar are clearly distinguishable from the noise, (iii) recalculating the separation vector, (iv) reapplying the separation vector on the EMG signals (either a selected window or the entire signal), and (v) repeating this procedure until no outliers are present and all clearly distinguishable spikes have been selected. Importantly, the manual editing of potentially missed or falsely identified discharge times should not be accepted before the application of the updated motor unit separation vector, thereby generating a new pulse train. Manual edits should be accepted only if the silhouette value improves following this operation or remains well above the preestablished threshold. A more extensive description of the manual editing of motor unit pulse trains can be found in (32). Even though some of the aforementioned steps involve subjective decision-making, evidence suggests that manual editing after EMG decomposition with blind source separation approaches remains highly reliable across operators (33). Specifically, the median rates of agreement calculated for 126 motor units over eight operators with various experience in manual editing was 99.6%. All raw and processed data have been made available on a public data repository so that they can be used for training new operators (10.6084/m9.figshare.13695937).”

Minor

Ln 115, "inversing" is not a word. "inverse" is not a verb

Changed as suggested

Ln 186, typo, bioadhesive

Changed as suggested

MVC should be defined on first use. It is currently defined on 3rd use or so.

The term rate is used in a variety of places without units. Eg line 465 but not limited to that

Changed as suggested

Recommendations for the authors:

Reviewer #1 (Recommendations For The Authors):

Two minor comments: Para 125: it is not clear what is meant by "spatial distribution" of recording electrodes.

‘Density’ was used instead of ‘spatial distribution’ to now read:

‘Increasing the number and density of recording electrodes increases the likelihood that each motor unit will have a unique motor unit action potential profile (shape), i.e., a temporal and spatial profile that differs from all the other active motor unit within the recorded volume (16, 29).’

Para 545: perhaps a bit more explanation about why low spatial overlap is better would be appropriate.

We added a section in the results showing how motor units with similar spatial signatures are merged by our model, leading to a lower precision. We therefore changed this sentence to now read:

‘Therefore, the likelihood of having spatially overlapping motor unit action potentials - and thus merged motor units - is lower, which explains why the rate of agreement of motor units identified from intramuscular arrays of electrodes is much higher than grids of surface electrodes (12, 13).’

Reviewer #2 (Recommendations For The Authors):

The authors mention that data is included with the Github software package. I could not find any included data, or instructions on how to run the software offline on example data. (Apologies if I missed this - it would be helpful to make it more prominent)

The link to the data on figshare was added in the GitHub, as well as data samples to run the algorithm offline and test manual editing.

Minor comments:

Not sure what is meant by "boundary capabilities of online decomposition"

This was removed to only discuss the accuracy of online decomposition.

CoV for ISIs is not formally defined or justified.

This was added to the caption of figure 2:

‘The CoV of ISI estimates the regularity of spiking for each motor unit, an expected behaviour during isometric contractions at consistent levels of force.’

Fig. 4: slope units should be ms/motor unit, perhaps?

Changed as suggested.

In some places, the manuscript uses "edition" to describe the editing process. I am not familiar with this usage, "editing" may be more common.

Editing is now used through the entire manuscript.

Reviewer #3 (Recommendations For The Authors):

I would recommend that the authors revise their manuscript to conform to eLife formatting guidelines, including moving the methods to the end of the manuscript. This change may entail substantial editing since many ideas are presented in order from the beginning of the methods. While this suggestion may seem superficial, the success of the new publishing model might benefit from general uniformity in manuscript style.

We changed and edited the draft to follow the classic format of Elife papers.

Associated Data

    This section collects any data citations, data availability statements, or supplementary materials included in this article.

    Data Citations

    1. Avrillon S. 2024. TA - thin films. figshare. [DOI]
    2. Avrillon S. 2024. TA - grids. figshare. [DOI]
    3. Avrillon S. 2024. GL GM - grids. figshare. [DOI]
    4. Avrillon S. 2024. VL VM - grids. figshare. [DOI]

    Supplementary Materials

    MDAR checklist

    Data Availability Statement

    The entire data set (raw and processed data) codes and a user manual of the software are available at https://github.com/simonavrillon/I-Spin, copy archived at Avrillon, 2024.

    All data recorded for this study are available on Figshare. Code and apps associated with this study are available on Github at https://github.com/simonavrillon/I-Spin (copy archived at Avrillon, 2024).

    The following datasets were generated:

    Avrillon S. 2024. TA - thin films. figshare.

    Avrillon S. 2024. TA - grids. figshare.

    Avrillon S. 2024. GL GM - grids. figshare.

    Avrillon S. 2024. VL VM - grids. figshare.


    Articles from eLife are provided here courtesy of eLife Sciences Publications, Ltd

    RESOURCES