devices.dynapse.DynapseNeuronsο
- class devices.dynapse.DynapseNeurons(input_nodes: rockpool.graph.graph_base.SetList[GraphNode], output_nodes: rockpool.graph.graph_base.SetList[GraphNode], name: str, computational_module: typing.Any, Idc: Union[IntVector, FloatVector] = <factory>, If_nmda: Union[IntVector, FloatVector] = <factory>, Igain_ahp: Union[IntVector, FloatVector] = <factory>, Igain_mem: Union[IntVector, FloatVector] = <factory>, Igain_syn: Union[IntVector, FloatVector] = <factory>, Ipulse_ahp: Union[IntVector, FloatVector] = <factory>, Ipulse: Union[IntVector, FloatVector] = <factory>, Iref: Union[IntVector, FloatVector] = <factory>, Ispkthr: Union[IntVector, FloatVector] = <factory>, Itau_ahp: Union[IntVector, FloatVector] = <factory>, Itau_mem: Union[IntVector, FloatVector] = <factory>, Itau_syn: Union[IntVector, FloatVector] = <factory>, Iw_ahp: Union[IntVector, FloatVector] = <factory>, Iscale: Optional[float] = None, dt: Optional[float] = None)[source]ο
Bases:
rockpool.graph.graph_modules.GenericNeurons
DynapseNeurons stores the core computational properties of a Dynap-SE network
Attributes overview
the scaling current
the time step for the forward-Euler ODE solver
Constant DC current injected to membrane in Amperes
NMDA gate soft cut-off current setting the NMDA gating voltage in Amperes
gain bias current of the spike frequency adaptation block in Amperes
gain bias current for neuron membrane in Amperes
gain bias current of synaptic gates (AMPA, GABA, NMDA, SHUNT) combined in Amperes
bias current setting the pulse width for spike frequency adaptation block
t_pulse_ahp
in Amperesbias current setting the pulse width for neuron membrane
t_pulse
in Amperesbias current setting the refractory period
t_ref
in Amperesspiking threshold current, neuron spikes if \(I_{mem} > I_{spkthr}\) in Amperes
Spike frequency adaptation leakage current setting the time constant
tau_ahp
in AmperesNeuron membrane leakage current setting the time constant
tau_mem
in AmperesAMPA, GABA, NMDA, SHUNT) synapses combined leakage current setting the time constant
tau_syn
in Amperesspike frequency adaptation weight current of the neurons of the core in Amperes
Methods overview
__init__
(input_nodes,Β output_nodes,Β name,Β ...)add_input
(node)Add a
GraphNode
as an input source to this module, and connect itadd_output
(node)Add a
GraphNode
as an output of this module, and connect itRemove all
GraphNode
s as inputs of this moduleRemove all
GraphNode
s as outputs of this modulecurrent_attrs lists all current paramters stored inside DynapseNeurons computational graph
get_full
()get_full creates a dictionary of parameteric current attributes with extended current values
merge
(graph_list)merge combines a list of computational
DynapseNeuron
objects into one.remove_input
(node)Remove a
GraphNode
as an input of this module, and disconnect itremove_output
(node)Remove a
GraphNode
as an output of this module, and disconnect it- Idc: Union[IntVector, FloatVector]ο
Constant DC current injected to membrane in Amperes
- If_nmda: Union[IntVector, FloatVector]ο
NMDA gate soft cut-off current setting the NMDA gating voltage in Amperes
- Igain_ahp: Union[IntVector, FloatVector]ο
gain bias current of the spike frequency adaptation block in Amperes
- Igain_mem: Union[IntVector, FloatVector]ο
gain bias current for neuron membrane in Amperes
- Igain_syn: Union[IntVector, FloatVector]ο
gain bias current of synaptic gates (AMPA, GABA, NMDA, SHUNT) combined in Amperes
- Ipulse: Union[IntVector, FloatVector]ο
bias current setting the pulse width for neuron membrane
t_pulse
in Amperes
- Ipulse_ahp: Union[IntVector, FloatVector]ο
bias current setting the pulse width for spike frequency adaptation block
t_pulse_ahp
in Amperes
- Iref: Union[IntVector, FloatVector]ο
bias current setting the refractory period
t_ref
in Amperes
- Iscale: Optional[float] = Noneο
the scaling current
- Ispkthr: Union[IntVector, FloatVector]ο
spiking threshold current, neuron spikes if \(I_{mem} > I_{spkthr}\) in Amperes
- Itau_ahp: Union[IntVector, FloatVector]ο
Spike frequency adaptation leakage current setting the time constant
tau_ahp
in Amperes
- Itau_mem: Union[IntVector, FloatVector]ο
Neuron membrane leakage current setting the time constant
tau_mem
in Amperes
- Itau_syn: Union[IntVector, FloatVector]ο
AMPA, GABA, NMDA, SHUNT) synapses combined leakage current setting the time constant
tau_syn
in Amperes
- Iw_ahp: Union[IntVector, FloatVector]ο
spike frequency adaptation weight current of the neurons of the core in Amperes
- __gain_current(Itau: Union[float, numpy.ndarray, torch.Tensor]) Union[float, numpy.ndarray, torch.Tensor] ο
__gain_current converts a gain ratio to a amplifier gain current using the leakage current provided
- Parameters
r (float) β the desired amplifier gain ratio
Itau (FloatVector) β the depended leakage current
- Returns
an amplifier gain current
- Return type
FloatVector
- __get_equal_shape() Tuple[int] ο
get_equal_shape makes sure that the all arguments have the same shape
- Raises
ValueError β Attribute shapes does not match!
- Returns
the equal shape of all the arguments
- Return type
Tuple[int]
- __init__(input_nodes: rockpool.graph.graph_base.SetList[GraphNode], output_nodes: rockpool.graph.graph_base.SetList[GraphNode], name: str, computational_module: typing.Any, Idc: Union[IntVector, FloatVector] = <factory>, If_nmda: Union[IntVector, FloatVector] = <factory>, Igain_ahp: Union[IntVector, FloatVector] = <factory>, Igain_mem: Union[IntVector, FloatVector] = <factory>, Igain_syn: Union[IntVector, FloatVector] = <factory>, Ipulse_ahp: Union[IntVector, FloatVector] = <factory>, Ipulse: Union[IntVector, FloatVector] = <factory>, Iref: Union[IntVector, FloatVector] = <factory>, Ispkthr: Union[IntVector, FloatVector] = <factory>, Itau_ahp: Union[IntVector, FloatVector] = <factory>, Itau_mem: Union[IntVector, FloatVector] = <factory>, Itau_syn: Union[IntVector, FloatVector] = <factory>, Iw_ahp: Union[IntVector, FloatVector] = <factory>, Iscale: Optional[float] = None, dt: Optional[float] = None) None ο
- __leakage_current(C: float) Union[float, numpy.ndarray, torch.Tensor] ο
__leakage_current uses default layout configuration and converts a time constant to a leakage current using the conversion method defined in
DynapSimTime
module- Parameters
tc (FloatVector) β the time constant in seconds
C (float) β the capacitance value in Farads
- Returns
the leakage current
- Return type
FloatVector
- __pulse_current(C: float) Union[float, numpy.ndarray, torch.Tensor] ο
__pulse_current uses default layout configuration and converts a pulse width to a pulse current using the conversion method defined in
DynapSimTime
module- Parameters
t_pw (FloatVector) β the pulse width in seconds
C (float) β the capacitance value in Farads
- Returns
a pulse current
- Return type
FloatVector
- __scale(scale: float) List[float] ο
__scale converts any FloatVector to list and scales
- Parameters
v (FloatVector) β the float vector of interest
scale (float) β the scaling factor
- Returns
a float list
- Return type
List[float]
- classmethod _convert_from(mod: rockpool.graph.graph_base.GraphModule, r_gain_mem: Union[float, numpy.ndarray, torch.Tensor] = 4, r_gain_syn: Union[float, numpy.ndarray, torch.Tensor] = 100, t_pulse: Union[float, numpy.ndarray, torch.Tensor] = 1e-05, t_ref: Union[float, numpy.ndarray, torch.Tensor] = 0.001, C_pulse: Union[float, numpy.ndarray, torch.Tensor] = 5e-13, C_ref: Union[float, numpy.ndarray, torch.Tensor] = 1.5e-12, C_mem: Union[float, numpy.ndarray, torch.Tensor] = 3e-12, C_syn: Union[float, numpy.ndarray, torch.Tensor] = 2.5e-11, Iscale: float = 1e-08) devices.dynapse.mapping.graph.DynapseNeurons [source]ο
_convert_from converts a graph module to DynapseNeuron structure. Uses default parameter
NOTE:
- LIF does not have equivalent computation for
AHP (After-Hyper-Polarization)
NMDA Voltage Depended Gating
Therefore : Itau_ahp, If_nmda, Igain_ahp, Ipulse_ahp, and, Iw_ahp currents are zero.
- Parameters
mod (GraphModule) β the reference graph module
r_gain_mem (FloatVector, optional) β neuron membrane gain ratio, defaults to default_gain_ratios[βr_gain_memβ]
r_gain_syn (FloatVector, optional) β synapse gain ratio, defaults to default_gain_ratios[βr_gain_ampaβ]
t_pulse (FloatVector, optional) β the spike pulse width for neuron membrane in seconds, defaults to default_time_constants[βt_pulseβ]
t_ref (FloatVector, optional) β refractory period of the neurons in seconds, defaults to default_time_constants[βt_refβ]
C_pulse (FloatVector, optional) β pulse-width creation sub-circuit capacitance in Farads, defaults to default_layout[βC_pulseβ]
C_ref (FloatVector, optional) β refractory period sub-circuit capacitance in Farads, defaults to default_layout[βC_refβ]
C_mem (FloatVector, optional) β neuron membrane capacitance in Farads, defaults to default_layout[βC_memβ]
C_syn (FloatVector, optional) β synaptic capacitance in Farads, defaults to default_layout[βC_synβ]
Iscale (float, optional) β the scaling current, defaults to default_weights[βIscaleβ]
- Raises
ValueError β graph module cannot be converted
- Returns
DynapseNeurons object instance
- Return type
- classmethod _factory(size_in: int, size_out: int, name: Optional[str] = None, computational_module: Optional[Any] = None, *args, **kwargs) rockpool.graph.graph_base.GraphModuleBase ο
Build a new
GraphModule
orGraphModule
subclass, with new input and outputGraphNode
s created automaticallyUse this factory method to construct a new
GraphModule
from scratch, which needs new input and outputGraphNode
s created automatically. This helper method will be inherited by newGraphModule
subclasses, and will act as factory methods also for your customGraphModule
subclass.- Parameters
size_in (int) β The number of input
GraphNode
s to create and attachsize_out (int) β The number of output
GraphNode
s to create and attachname (str, optional) β An arbitrary name to attach to this
GraphModule
, defaults to Nonecomputational_module (Optional[Module], optional) β A rockpool computational module that forms the βgeneratorβ of this graph module, defaults to None
- Returns
The newly constructed
GraphModule
orGraphModule
subclass- Return type
- add_input(node: rockpool.graph.graph_base.GraphNode) None ο
Add a
GraphNode
as an input source to this module, and connect itThe new node will be appended after the last current input node. The node will be connected with this
GraphModule
as a sink.- Parameters
node (GraphNode) β The node to add as an input source
- add_output(node: rockpool.graph.graph_base.GraphNode) None ο
Add a
GraphNode
as an output of this module, and connect itThe new node will be appended after the last current output node. The node will be connected with this
GraphModule
as a source.- Parameters
node (GraphNode) β The node to add as an output
- computational_module: Moduleο
The computational module that acts as the source for this graph module
- Type
- static current_attrs() List[str] [source]ο
current_attrs lists all current paramters stored inside DynapseNeurons computational graph
- Returns
a list of parametric curents
- Return type
List[str]
- dt: Optional[float] = Noneο
the time step for the forward-Euler ODE solver
- get_full() Dict[str, numpy.ndarray] [source]ο
get_full creates a dictionary of parameteric current attributes with extended current values
- Returns
the object dictionary with extended current arrays
- Return type
Dict[str, np.ndarray]
- input_nodes: SetList['GraphNode']ο
The input nodes attached to this module
- Type
SetList[GraphNode]
- classmethod merge(graph_list: List[devices.dynapse.mapping.graph.DynapseNeurons]) devices.dynapse.mapping.graph.DynapseNeurons [source]ο
merge combines a list of computational
DynapseNeuron
objects into one. The length of attributes are equal to the number of output nodes. Even though the submodules has single valued attributes, they are repeated as many times as the number of their output neurons.NOTE : Returned single object is neither connected to the input nor the outputs of the any of the modules given.
- Parameters
graph_list (List[DynapseNeurons]) β an ordered list of DynapseNeuron objects
- Returns
a single
DynapseNeuron
object with combined arrays of attributes- Return type
- name: strο
An arbitrary name attached to this specific
GraphModule
- Type
str
- output_nodes: SetList['GraphNode']ο
The output nodes attached to this module
- Type
SetList[GraphNode]
- remove_input(node: rockpool.graph.graph_base.GraphNode) None ο
Remove a
GraphNode
as an input of this module, and disconnect itThe node will be disconnected from this
GraphModule
as a sink, and will be removed from the module.- Parameters
node (GraphNode) β The node to remove. If this node exists as an input to the module, it will be removed.
- remove_output(node: rockpool.graph.graph_base.GraphNode) None ο
Remove a
GraphNode
as an output of this module, and disconnect itThe node will be disconnected from this
GraphModule
as a source, and will be removed from the module.- Parameters
node (GraphNode) β The node to remove. If this node exists as an output to the module, it will be removed.