neurai.nn.neuron.multi_compartment package#

Submodules#

class neurai.nn.neuron.multi_compartment.compartment.AMPA(size=1, V_rest=-70, gL=2.9, C=58.9, length=None, diameter=None, r_axial=None, g=1.0, w=1.0, t_rise=None, t_decay=None, scale_g=False, parent=<neurai.nn.module._Sentinel object>, name=None, frozen_params=None)#

Bases: Compartment

the AMPA synapse.

Parameters:
  • size (int) – the number of compartments, by default 1

  • V_rest (float) – the reset potential after spike, by default -70

  • gL (float) – the specific leakage conductance, by default 2.9

  • C (float) – the specific capacitance, by default 58.9

  • length (float) – the length of compartment, by default None

  • diameter (float) – the diameter of compartment, by default None

  • r_axial (float) – the axial resistance, by default None

  • g (float) – the synaptic conductance, by default 1

  • w (float) – the synaptic weight, by default 1

  • t_rise (float) – the rise time constant, by default None

  • t_decay (float) – the decay time constant, by default None

  • scale_g (float) – the option to add a normalization factor to scale the maximum conductance at 1 when synapses are modelled as a difference of exponentials (have both rise and decay kinetics), by default``False``

  • name (str, Optional) – Name of the module. If not provided, a name will be automatically generated.

  • parent (Union[Module, VarManager, _Sentinel, None], Optional) – The parent module, by default neurai.nn.module._Sentinel .

  • frozen_params (dict, Optional) – A dictionary of frozen parameters. If provided, the module will be initialized with these parameters and will not be updated during training.

class neurai.nn.neuron.multi_compartment.compartment.Compartment(size=1, V_rest=-70, gL=2.9, C=58.9, length=None, diameter=None, r_axial=None, parent=<neurai.nn.module._Sentinel object>, name=None, frozen_params=None)#

Bases: Module

This is a base class for multi compartment.

Parameters:
  • size (int) – the number of compartments, by default 1

  • V_rest (float) – the reset potential after spike, by default -70

  • gL (float) – the specific leakage conductance, by default 2.9

  • C (float) – the specific capacitance, by default 58.9

  • length (float) – the length of compartment, by default None

  • diameter (float) – the diameter of compartment, by default None

  • r_axial (float) – the axial resistance, by default None

  • name (str, Optional) – Name of the module. If not provided, a name will be automatically generated.

  • parent (Union[Module, VarManager, _Sentinel, None], Optional) – The parent module, by default neurai.nn.module._Sentinel .

  • frozen_params (dict, Optional) – A dictionary of frozen parameters. If provided, the module will be initialized with these parameters and will not be updated during training.

class neurai.nn.neuron.multi_compartment.compartment.ConnGen(pre, mc, parent=<neurai.nn.module._Sentinel object>, name=None, frozen_params=None)#

Bases: Module

Set the pre Generator. :type pre: Generator :param pre: the pre Generator :type pre: Generator :type mc: Compartment :param mc: the compartment. :type mc: Compartment :type name: Optional[str] :param name: Name of the module. If not provided, a name will be automatically generated. :type name: str, typing.Optional :type parent: Union[Type[Module], Type[VarManager], Type[_Sentinel], None] :param parent: The parent module, by default neurai.nn.module._Sentinel . :type parent: typing.Union[Module, VarManager, _Sentinel, None], typing.Optional :type frozen_params: Optional[dict] :param frozen_params: A dictionary of frozen parameters. If provided, the module will be

initialized with these parameters and will not be updated during training.

class neurai.nn.neuron.multi_compartment.compartment.LeakyIF(size=1, V_rest=-70, gL=2.9, C=58.9, length=None, diameter=None, r_axial=None, I_ext=0.0, parent=<neurai.nn.module._Sentinel object>, name=None, frozen_params=None)#

Bases: Compartment

Leaky integrate and fire model.

Parameters:
  • size (int) – the number of compartments, by default 1

  • V_rest (float) – the reset potential after spike, by default -70

  • gL (float) – the specific leakage conductance, by default 2.9

  • C (float) – the specific capacitance, by default 58.9

  • length (float) – the length of compartment, by default None

  • diameter (float) – the diameter of compartment, by default None

  • r_axial (float) – the axial resistance, by default None

  • I_ext (float) – the input current, by default 0.

  • name (str, Optional) – Name of the module. If not provided, a name will be automatically generated.

  • parent (Union[Module, VarManager, _Sentinel, None], Optional) – The parent module, by default neurai.nn.module._Sentinel .

  • frozen_params (dict, Optional) – A dictionary of frozen parameters. If provided, the module will be initialized with these parameters and will not be updated during training.

class neurai.nn.neuron.multi_compartment.compartment.MCConn(pre, post, g=None, parent=<neurai.nn.module._Sentinel object>, name=None, frozen_params=None)#

Bases: Module

Allows the connection (electrical coupling) of two compartments.

Parameters:
  • pre (Compartment) – the pre compartment

  • post (Compartment) – the post compartment

  • g (the coupling conductance.It can be set explicitly or calculated automatically (provided all necessary parameters exist).) –

  • name (str, Optional) – Name of the module. If not provided, a name will be automatically generated.

  • parent (Union[Module, VarManager, _Sentinel, None], Optional) – The parent module, by default neurai.nn.module._Sentinel .

  • frozen_params (dict, Optional) – A dictionary of frozen parameters. If provided, the module will be initialized with these parameters and will not be updated during training.

class neurai.nn.neuron.multi_compartment.compartment.MCConnSynapse(pre, post, parent=<neurai.nn.module._Sentinel object>, name=None, frozen_params=None)#

Bases: Module

Allows the connection of the synapses and the compartments.

Parameters:
  • pre (Compartment) – the pre compartment

  • post (Compartment) – the post compartment

  • name (str, Optional) – Name of the module. If not provided, a name will be automatically generated.

  • parent (Union[Module, VarManager, _Sentinel, None], Optional) – The parent module, by default neurai.nn.module._Sentinel .

  • frozen_params (dict, Optional) – A dictionary of frozen parameters. If provided, the module will be initialized with these parameters and will not be updated during training.

class neurai.nn.neuron.multi_compartment.compartment.MCSynapse(pre, post, conn, parent=<neurai.nn.module._Sentinel object>, name=None, frozen_params=None)#

Bases: Module

Allows the connection of the Generator and the synapses.

Parameters:
  • pre (Compartment) – the pre compartment

  • post (Compartment) – the post compartment

  • conn (jnp.ndarray) – the connection matrix

  • name (str, Optional) – Name of the module. If not provided, a name will be automatically generated.

  • parent (Union[Module, VarManager, _Sentinel, None], Optional) – The parent module, by default neurai.nn.module._Sentinel .

  • frozen_params (dict, Optional) – A dictionary of frozen parameters. If provided, the module will be initialized with these parameters and will not be updated during training.

class neurai.nn.neuron.multi_compartment.compartment.NMDA(size=1, V_rest=-70, gL=2.9, C=58.9, length=None, diameter=None, r_axial=None, g=1.0, w=1.0, Mg=1.0, gamma=0.0, alpha=0.062, beta=3.57, t_rise=None, t_decay=None, scale_g=False, parent=<neurai.nn.module._Sentinel object>, name=None, frozen_params=None)#

Bases: Compartment

the NMDA synapse.

Parameters:
  • size (int) – the number of compartments, by default 1

  • V_rest (float) – the reset potential after spike, by default -70

  • gL (float) – the specific leakage conductance, by default 2.9

  • C (float) – the specific capacitance, by default 58.9

  • length (float) – the length of compartment, by default None

  • diameter (float) – the diameter of compartment, by default None

  • r_axial (float) – the axial resistance, by default None

  • g (float) – the synaptic conductance, by default 1

  • w (float) – the synaptic weight, by default 1

  • Mg (float) – the Mg2+ block factor, by default 1

  • gamma (float) – the parameter that affects the shape of the activation function

  • alpha (float) – the time constant of the NMDA receptor

  • beta (float) – the time constant of the synaptic conductance decay

  • t_rise (float) – the rise time constant, by default None

  • t_decay (float) – the decay time constant, by default None

  • scale_g (float) – the option to add a normalization factor to scale the maximum conductance at 1 when synapses are modelled as a difference of exponentials (have both rise and decay kinetics), by default``False``

  • name (str, Optional) – Name of the module. If not provided, a name will be automatically generated.

  • parent (Union[Module, VarManager, _Sentinel, None], Optional) – The parent module, by default neurai.nn.module._Sentinel .

  • frozen_params (dict, Optional) – A dictionary of frozen parameters. If provided, the module will be initialized with these parameters and will not be updated during training.

class neurai.nn.neuron.multi_compartment.mc_neuron.MCNeuron(size=1, pid=0, V_th=1.0, V_reset=0.0, stdp_tau=20.0, tau_triplet=110.0, dendritic_delay=1, area_name=None, surrogate_grad_fn=<neurai.grads.surrogate_grad.Sigmoid object>, id=0, neuron_start_id=1, odemethod=SolverMethodODE.EULER, sdemethod=SolverMethodSDE.MISLTEAIN, parent=<neurai.nn.module._Sentinel object>, name=None, frozen_params=None)#

Bases: Neuron

Base class for multi compartment neuron model.

Parameters:
  • size (int, Optional) – The number of neurons in the population, by default 1.

  • odemethod (ODESolver, Optional) – The methods for solving ordinary differential equations, by default SolverMethodODE.EULER

  • sdemethod (ODESolver, Optional) – The methods for solving stochastic differential equations, by default SolverMethodSDE.MISLTEAIN

  • V_th (float, Optional) – Threshold of this neurons layer, by default 1.

  • V_reset (float, Optional) – Reset voltage of this neurons layer, If it is not None, the voltage will be reset to V_reset after firing a spikie. If set to None, the voltage will be subtracted by V_th after firing a spikie, by default 0.

  • stdp_tau (float, Optional) – Time window for stdp decay, by default 20.

  • tau_triplet (float, Optional) – Time constant of long presynaptic trace, by default 110.

  • dendritic_delay (Union[int, jax.numpy.ndarray, Initializer, Callable], Optional) – The dendritic delay length, by default 1

  • pid (int, Optional) – The process id of the neuron, used in multiple process simulations, by default 0.

  • area_name (str, Optional) – The name of the area to which the current neuron belongs. By default empty string.

  • name (str, Optional) – Name of the module. If not provided, a name will be automatically generated.

  • parent (Union[Module, VarManager, _Sentinel, None], Optional) – The parent module, by default neurai.nn.module._Sentinel .

  • frozen_params (dict, Optional) – A dictionary of frozen parameters. If provided, the module will be initialized with these parameters and will not be updated during training.

  • surrogate_grad_fn (Callable) –

  • id (int) –

  • neuron_start_id (int) –

Module contents#