MotorNeuronPool#

class MotorNeuronPool(
recruitment_thresholds,
diameter_soma_min__mm=77.5,
diameter_soma_max__mm=82.5,
y_min__mm=18.0,
y_max__mm=36.0,
diameter_dend_min__mm=41.5,
diameter_dend_max__mm=62.5,
x_min__mm=-5500,
x_max__mm=-6789,
vt_min__mV=12.35,
vt_max__mV=20.9,
kf_cond_min__S_per_cm2=4,
kf_cond_max__S_per_cm2=0.5,
coefficient_of_variation=0.01,
)[source]#

Bases: object

Motor neuron pool with specified parameters for EMG simulation.

This class creates and manages a pool of motor neurons with physiologically realistic parameters. It supports spike train generation through NEURON backend integration and provides both current injection and cortical input stimulation modes.

Parameters:
  • recruitment_thresholds (numpy.ndarray) – Array of recruitment thresholds for the motor neurons (normalized 0-1)

  • diameter_soma_min__mm (float, default 77.5) – Minimum diameter of the soma in millimeters

  • diameter_soma_max__mm (float, default 82.5) – Maximum diameter of the soma in millimeters

  • y_min__mm (float, default 18.0) – Minimum y coordinate of the soma in millimeters

  • y_max__mm (float, default 36.0) – Maximum y coordinate of the soma in millimeters

  • diameter_dend_min__mm (float, default 41.5) – Minimum diameter of the dendrite in millimeters

  • diameter_dend_max__mm (float, default 62.5) – Maximum diameter of the dendrite in millimeters

  • x_min__mm (float, default -5500) – Minimum x coordinate of the dendrite in millimeters

  • x_max__mm (float, default -6789) – Maximum x coordinate of the dendrite in millimeters

  • vt_min__mV (float, default 12.35) – Minimum voltage threshold of the neuron in millivolts

  • vt_max__mV (float, default 20.9) – Maximum voltage threshold of the neuron in millivolts

  • kf_cond_min__S_per_cm2 (float, default 4) – Minimum conductance density of the potassium fast channel in S/cm²

  • kf_cond_max__S_per_cm2 (float, default 0.5) – Maximum conductance density of the potassium fast channel in S/cm²

  • coefficient_of_variation (float, default 0.01) – Coefficient of variation for parameter noise (0-1)

spike_trains#

Matrix of spike trains - available after generate_spike_trains()

Type:

SPIKE_TRAIN__MATRIX

active_neuron_indices#

Indices of active neurons per pool - available after generate_spike_trains()

Type:

list[numpy.ndarray]

data#

Neo segments with recorded data - available after generate_spike_trains()

Type:

list[neo.Segment]

mvc_current_threshold#

Minimum current for maximum voluntary contraction - computed on access

Type:

float

Examples

>>> pool = MotorNeuronPool(recruitment_thresholds=np.linspace(0, 1, 100))
>>> current_matrix = np.random.randn(5, 1000) * 50
>>> spike_trains, indices, data = pool.generate_spike_trains(current_matrix)
>>> print(f"Generated spike trains shape: {pool.spike_trains.shape}")

Methods

__init__

compute_mvc_current_threshold

Computes the minimum current threshold for maximum voluntary contraction using binary search optimization.

generate_spike_trains

Generate the spike trains for as many neuron pools as input currents there are

Attributes

active_neuron_indices

List of arrays containing indices of active neurons in each pool.

data

List of neo segments containing recorded data from simulation.

mvc_current_threshold

Property that returns the minimum current threshold for maximum voluntary contraction.

spike_trains

Matrix of spike trains for each pool and neuron.

generate_spike_trains(
input_current__matrix=None,
cortical_input__matrix=None,
timestep__ms=0.05,
noise_mean__nA=30,
noise_stdev__nA=30,
CST_number=400,
connection_prob=0.3,
what_to_record=[{'variables': ['v'], 'locations': ['dendrite', 'soma']}],
)[source]#

Generate the spike trains for as many neuron pools as input currents there are

Each motor neuron pools have each “neurons_per_pool” neurons. The input currents are injected into each pool, and the spike trains are recorded.

Parameters:
  • input_current__matrix (INPUT_CURRENT__MATRIX, optional) – Matrix of shape (n_pools, t_points) containing current values Each row represents the current for one pool

  • cortical_input__matrix (CORTICAL_INPUT__MATRIX, optional) – Matrix of shape (n_pools, t_points) containing cortical input values Each row represents the cortical input for one pool

  • timestep__ms (float) – Simulation timestep__ms in ms

  • noise_mean__nA (float) – Mean of the noise current in nA

  • noise_stdev__nA (float) – Standard deviation of the noise current in nA

  • CST_number (int) – Number of neurons in the cortical input population. Only used if cortical_input__matrix is provided. Default is 400.

  • connection_prob (float) – Probability of a connection between a cortical input neuron and a motor neuron. Only used if cortical_input__matrix is provided. Default is 0.3.

  • what_to_record (list[dict['variables', 'to_file', 'sampling_interval', 'locations'], Any]) –

    List of dictionaries specifying what to record.

    Each dictionary contains the following keys:
    • variables: list of strings specifying the variables to record

    • to_file: bool specifying whether to save the recorded data to a file

    • sampling_interval: int specifying the sampling interval in ms

    • locations: list of strings specifying the locations to record from

    See pyNN documentation for more details: https://pynn.readthedocs.io/en/stable/recording.html.

    Spike trains are recorded by default.

Returns:

  • spike_trains (SPIKE_TRAIN__MATRIX) – Matrix of shape (n_pools, neurons_per_pool, t_points) containing spike trains Each row represents the spike train for one pool Each column represents the spike train for one neuron Each element represents whether the neuron spiked at that time point

  • active_neuron_indices (list[numpy.ndarray]) – List of arrays of indices of the active neurons in each pool

  • data (list[neo.core.segment.Segment]) – List of neo segments containing the recorded data

Return type:

tuple[Annotated[ndarray[tuple[int, …], dtype[bool]], beartype.vale.Is[lambda x: x.ndim == 3]], list[ndarray], list[Segment]]

property spike_trains: ndim == 3]]#

Matrix of spike trains for each pool and neuron.

Returns:

Matrix of shape (n_pools, neurons_per_pool, t_points) containing spike trains

Return type:

SPIKE_TRAIN__MATRIX

Raises:

AttributeError – If spike trains have not been computed. Run generate_spike_trains() first.

property active_neuron_indices: list[ndarray]#

List of arrays containing indices of active neurons in each pool.

Returns:

List of arrays of indices of the active neurons in each pool

Return type:

list[numpy.ndarray]

Raises:

AttributeError – If active neuron indices have not been computed. Run generate_spike_trains() first.

property data: list[Segment]#

List of neo segments containing recorded data from simulation.

Returns:

List of neo segments containing the recorded data

Return type:

list[neo.core.segment.Segment]

Raises:

AttributeError – If data has not been computed. Run generate_spike_trains() first.

compute_mvc_current_threshold()[source]#

Computes the minimum current threshold for maximum voluntary contraction using binary search optimization.

Returns:

Minimum current threshold in nA needed to activate all neurons

Return type:

float

property mvc_current_threshold: float#

Property that returns the minimum current threshold for maximum voluntary contraction.

Returns:

Minimum current threshold in nA needed to activate all neurons

Return type:

float