Neuron

class fugu.simulators.SpikingNeuralNetwork.neuron.Neuron(name=None, spike=False)

Bases: ABC

Abstract Base Class for Neurons. This class defines the minimum set of properties of a Neuron.

Constructor for a Base Neuron class

Parameters:
  • name (any) – String, optional. Neuron name as a string. The default is None.

  • spike (bool) – Bool, optional. Spike state of the Neuron. The default is False.

Returns:

None

abstract update_state()

Update the time evolution of the neuron state

class fugu.simulators.SpikingNeuralNetwork.neuron.LIFNeuron(name=None, threshold=0.0, reset_voltage=0.0, leakage_constant=1.0, voltage=0.0, bias=0.0, p=1, scaling_factor=0.1, scaling=False, record=False)

Bases: Neuron

Leaky Integrate and Fire neuron class. LIFNeurons inherit from base Neuron class. LIFNeurons inetgrate the incoming signals (weighted sum of spikes from pre-synapses). The leak-rate detemines the time evolution of the menbrane Voltage. If the voltage exceeds a threshold, the neurons spikes (with probability p) and resets to its reset-voltage.

Constructor for LIFNeurons. Inherits from Neuron Base Class

Parameters:
  • name (any) – String, optional. String name of a neuron. The default is None.

  • threshold – Double, optional. Threshold value above while the neuron spikes. The default is 0.0.

  • reset_voltage – Double, optional. The voltage to which the neuron resets after spiking. The default is 0.0.

  • leakage_constant – Double, optional The rate at which the neuron voltage decays. The leakage with rate m is calculated as m*v. A rate of m=1 indicates no leak. For realistic models, 0<= m <=1. The default is 1.0.

  • voltage – Double, optional. Internal voltage of the neuron. The default is 0.0.

  • bias – Double, optional. Constant bias voltage value that is added at every timestep. The default is 0.0

  • p (double) – optional. Probability of spiking if voltage exceeds threshold. p=1 indicates a deterministic neuron. The default is 1.0.

  • scaling_factor (double) – optional. The factor by which the weights should be scaled down to. The default is 0.1

  • scaling (bool) – optional. Indicates if the weights of the neuron need to undergo synaptic scaling or not.

  • record (bool) – optional. Indicates if a neuron spike state should be sensed with probes. Default is False.

Returns:

none

static scale_weights(weight_arr, scale)

Scales the weights of the synapses by applying synaptic scaling based on the maximum weight value :param weight_arr: array of weights of presynaptic neurons :type weight_arr: np.ndarray :param scale: The factor by which the weights need to be scaled

Returns:

None

update_state()

Updates the time evolution of the states for one time step. The input signals are integrated and accumulates with the internal voltage. If the internal voltage exceeds the threshold, the neuron spikes and resets. Otherwise, the neruon leaks at a fixed rate down to its reset value. The neuron spikes with probability p if it exceeds the threshold.

Returns:

None

show_state()

Display the voltage and spike state of a neuron. :returns: none

show_params()

Display the parameters of a neuron (name, threshold, reset, leak)

Returns:

none

show_presynapses()

Display the synapses that feed into the neuron.

Returns:

none

get_presynapses()

Returns the presynaptic neurons that feed into the neuron.

Returns:

set of presynaptic neurons

Return type:

set

get_presynaptic_weights()

Returns the weights of the presynaptic neurons that feed into the neuron.

Returns:

list of weights of presynaptic neurons

Return type:

list

set_presynaptic_weights(weight_arr)

Set the weights of the presynaptic neurons that feed into the neuron.

Parameters:

weight_arr (np.ndarray) – array of weights of presynaptic neurons

Returns:

None

property scaling_factor
property threshold
property reset_voltage
property leakage_constant
property voltage
class fugu.simulators.SpikingNeuralNetwork.neuron.InputNeuron(name=None, threshold=0.1, voltage=0.0, frequency=100, bins=100, record=False, encoding=None)

Bases: Neuron

Input Neuron. Inherits from class Neuron. Input Neurons can read inputs and convert them to different encoding schemes.

Constructor for the new input neuron class

Parameters:
  • name – String, optional. Input neuron name. The default is None.

  • threshold – double, optional. Threshold value above which the neuron spikes. The default is 0.1.

  • voltage – double, optional. Membrane voltage. The default is 0.0.

  • frequency – double, optional. Frequency of the Poisson spikes from the input data. The default is 100.

  • bins – double, optional. Number of bins for the Poisson spikes. The default is 100.

  • record – bool, optional. Indicates if a neuron spike state should be sensed with probes. The default is False.

  • encoding – String, optional. The type of encoding on the input stream or value to be performed

Returns:

None

connect_to_input(in_stream)

Enables a neuron to read in an input stream of data.

Parameters:

in_stream – interable data streams of ints or floats. input data (any interable stream such as lists, arrays, etc.).

Raises:

TypeError – if in_stream is not iterable.

Returns:

None

show_iterable()

Display the iterable input data stream.

Returns:

None

update_state()

Updates the neuron states. The neuron spikes if the input value in the current iteration is above the threshold and resets.

Raises:

TypeError – if the input data is not int or float.

Returns:

None

property threshold
property voltage
class fugu.simulators.SpikingNeuralNetwork.neuron.Neuron(name=None, spike=False)

Bases: ABC

Abstract Base Class for Neurons. This class defines the minimum set of properties of a Neuron.

Constructor for a Base Neuron class

Parameters:
  • name (any) – String, optional. Neuron name as a string. The default is None.

  • spike (bool) – Bool, optional. Spike state of the Neuron. The default is False.

Returns:

None

abstract update_state()

Update the time evolution of the neuron state

class fugu.simulators.SpikingNeuralNetwork.neuron.LIFNeuron(name=None, threshold=0.0, reset_voltage=0.0, leakage_constant=1.0, voltage=0.0, bias=0.0, p=1, scaling_factor=0.1, scaling=False, record=False)

Bases: Neuron

Leaky Integrate and Fire neuron class. LIFNeurons inherit from base Neuron class. LIFNeurons inetgrate the incoming signals (weighted sum of spikes from pre-synapses). The leak-rate detemines the time evolution of the menbrane Voltage. If the voltage exceeds a threshold, the neurons spikes (with probability p) and resets to its reset-voltage.

Constructor for LIFNeurons. Inherits from Neuron Base Class

Parameters:
  • name (any) – String, optional. String name of a neuron. The default is None.

  • threshold – Double, optional. Threshold value above while the neuron spikes. The default is 0.0.

  • reset_voltage – Double, optional. The voltage to which the neuron resets after spiking. The default is 0.0.

  • leakage_constant – Double, optional The rate at which the neuron voltage decays. The leakage with rate m is calculated as m*v. A rate of m=1 indicates no leak. For realistic models, 0<= m <=1. The default is 1.0.

  • voltage – Double, optional. Internal voltage of the neuron. The default is 0.0.

  • bias – Double, optional. Constant bias voltage value that is added at every timestep. The default is 0.0

  • p (double) – optional. Probability of spiking if voltage exceeds threshold. p=1 indicates a deterministic neuron. The default is 1.0.

  • scaling_factor (double) – optional. The factor by which the weights should be scaled down to. The default is 0.1

  • scaling (bool) – optional. Indicates if the weights of the neuron need to undergo synaptic scaling or not.

  • record (bool) – optional. Indicates if a neuron spike state should be sensed with probes. Default is False.

Returns:

none

static scale_weights(weight_arr, scale)

Scales the weights of the synapses by applying synaptic scaling based on the maximum weight value :param weight_arr: array of weights of presynaptic neurons :type weight_arr: np.ndarray :param scale: The factor by which the weights need to be scaled

Returns:

None

update_state()

Updates the time evolution of the states for one time step. The input signals are integrated and accumulates with the internal voltage. If the internal voltage exceeds the threshold, the neuron spikes and resets. Otherwise, the neruon leaks at a fixed rate down to its reset value. The neuron spikes with probability p if it exceeds the threshold.

Returns:

None

show_state()

Display the voltage and spike state of a neuron. :returns: none

show_params()

Display the parameters of a neuron (name, threshold, reset, leak)

Returns:

none

show_presynapses()

Display the synapses that feed into the neuron.

Returns:

none

get_presynapses()

Returns the presynaptic neurons that feed into the neuron.

Returns:

set of presynaptic neurons

Return type:

set

get_presynaptic_weights()

Returns the weights of the presynaptic neurons that feed into the neuron.

Returns:

list of weights of presynaptic neurons

Return type:

list

set_presynaptic_weights(weight_arr)

Set the weights of the presynaptic neurons that feed into the neuron.

Parameters:

weight_arr (np.ndarray) – array of weights of presynaptic neurons

Returns:

None

property scaling_factor
property threshold
property reset_voltage
property leakage_constant
property voltage
class fugu.simulators.SpikingNeuralNetwork.neuron.InputNeuron(name=None, threshold=0.1, voltage=0.0, frequency=100, bins=100, record=False, encoding=None)

Bases: Neuron

Input Neuron. Inherits from class Neuron. Input Neurons can read inputs and convert them to different encoding schemes.

Constructor for the new input neuron class

Parameters:
  • name – String, optional. Input neuron name. The default is None.

  • threshold – double, optional. Threshold value above which the neuron spikes. The default is 0.1.

  • voltage – double, optional. Membrane voltage. The default is 0.0.

  • frequency – double, optional. Frequency of the Poisson spikes from the input data. The default is 100.

  • bins – double, optional. Number of bins for the Poisson spikes. The default is 100.

  • record – bool, optional. Indicates if a neuron spike state should be sensed with probes. The default is False.

  • encoding – String, optional. The type of encoding on the input stream or value to be performed

Returns:

None

connect_to_input(in_stream)

Enables a neuron to read in an input stream of data.

Parameters:

in_stream – interable data streams of ints or floats. input data (any interable stream such as lists, arrays, etc.).

Raises:

TypeError – if in_stream is not iterable.

Returns:

None

show_iterable()

Display the iterable input data stream.

Returns:

None

update_state()

Updates the neuron states. The neuron spikes if the input value in the current iteration is above the threshold and resets.

Raises:

TypeError – if the input data is not int or float.

Returns:

None

property threshold
property voltage