AND
This section shows all the code relative to the AND block.
- class sPyBlocks.neural_and.MultipleNeuralAnd(n_components, n_inputs, sim, global_params, neuron_params, std_conn, build_type='classic')
This class allows to create multiple AND blocks of the same type.
- __init__(n_components, n_inputs, sim, global_params, neuron_params, std_conn, build_type='classic')
Constructor of the class.
- Parameters
n_components (int) – The number of blocks to create.
n_inputs (int) – The number of expected inputs of the blocks.
sim – The simulator package.
global_params (dict) – A dictionary of type str:int which must include the “min_delay” keyword. This keyword is likely to have the time period associated with it as a value.
neuron_params (dict) – A dictionary of type str:int containing the neuron parameters.
std_conn (sim.StaticSynapse) – The connection to be used for the construction of the blocks. Commonly, its weight is 1.0 and its delay is equal to the timestep. Using other values could change the behavior of the block.
build_type (str) – A string indicating the AND variant (“classic” or “fast”). “classic” by default.
- Raises
ValueError – If the build_type string is not “classic” or “fast”.
- connect_inhibition(input_population, conn=None, conn_all=True, rcp_type='inhibitory', ini_pop_indexes=None, end_pop_indexes=None, component_indexes=None)
Connects an input population to the neurons to be inhibited by the Constant Spike Source block.
- Parameters
input_population (sim.Population, sim.PopulationView, sim.Assembly, list) – A PyNN object or a list of PyNN objects containing the population to connect to the inhibited neurons.
conn (sim.StaticSynapse) – The connection to use. Internal inhibitory synapse by default, it is recommended NOT to use this parameter.
conn_all – Unused.
rcp_type (str) – A string indicating the receptor type of the connections (excitatory or inhibitory). “Inhibitory” by default, it is recommended NOT to use this parameter.
ini_pop_indexes (list) – A list of indices used to select objects from the input population.
end_pop_indexes – Unused.
component_indexes (list) – A list of indices used to select components from the list of components.
- Returns
The number of connections that have been created.
- Return type
int
- Raises
ValueError – If this functions is used with the classic AND variant.
- connect_inputs(input_population, conn=None, conn_all=True, rcp_type='excitatory', ini_pop_indexes=None, end_pop_indexes=None, component_indexes=None)
Connects an input population to the input neurons of the blocks.
- Parameters
input_population (sim.Population, sim.PopulationView, sim.Assembly, list) – A PyNN object or a list of PyNN objects containing the population to connect to the input neurons.
conn (sim.StaticSynapse) – The connection to use. std_conn (class parameter) by default.
conn_all – Unused.
rcp_type (str) – A string indicating the receptor type of the connections (excitatory or inhibitory). “Excitatory” by default.
ini_pop_indexes (list) – A list of indices used to select objects from the input population.
end_pop_indexes – Unused.
component_indexes (list) – A list of indices used to select components from the list of components.
- Returns
The number of connections that have been created.
- Return type
int
- connect_outputs(output_population, conn=None, conn_all=True, rcp_type='excitatory', ini_pop_indexes=None, end_pop_indexes=None, component_indexes=None)
Connects the output neurons of the blocks to an output population.
- Parameters
output_population (sim.Population, sim.PopulationView, sim.Assembly, list) – A PyNN object or a list of PyNN objects containing the population to connect the output neurons to.
conn (sim.StaticSynapse) – The connection to use. std_conn (class parameter) by default.
conn_all – Unused.
rcp_type (str) – A string indicating the receptor type of the connections (excitatory or inhibitory). “Excitatory” by default.
ini_pop_indexes (list) – Unused.
end_pop_indexes – A list of indices used to select objects from the output population.
component_indexes (list) – A list of indices used to select components from the list of components.
- Returns
The number of connections that have been created.
- Return type
int
- get_inhibited_neurons(flat=False)
Gets a list containing all the neurons inhibited by the Constant Spike Source block.
- Parameters
flat (bool) – A boolean value indicating whether or not to flatten the list. False by default.
- Returns
The list containing all the inhibited neurons of the blocks
- Return type
list
- get_input_neurons(flat=False)
Gets a list containing all the input neurons of the blocks.
- Parameters
flat (bool) – A boolean value indicating whether or not to flatten the list. False by default.
- Returns
The flattened or unflattened list containing all the input neurons of the blocks
- Return type
list
- get_output_neurons(flat=False)
Gets a list containing all the output neurons of the blocks.
- Parameters
flat (bool) – A boolean value indicating whether or not to flatten the list. False by default.
- Returns
The list containing all the output neurons of the blocks
- Return type
list
- class sPyBlocks.neural_and.NeuralAnd(n_inputs, sim, global_params, neuron_params, std_conn, build_type='classic')
This class defines the AND block. This block has two variants: classic and fast.
- __init__(n_inputs, sim, global_params, neuron_params, std_conn, build_type='classic')
Constructor of the class.
- Parameters
n_inputs (int) – The number of expected inputs of the block.
sim – The simulator package.
global_params (dict) – A dictionary of type str:int which must include the “min_delay” keyword. This keyword is likely to have the time period associated with it as a value.
neuron_params (dict) – A dictionary of type str:int containing the neuron parameters.
std_conn (sim.StaticSynapse) – The connection to be used for the construction of the block. Commonly, its weight is 1.0 and its delay is equal to the timestep. Using other values could change the behavior of the block.
build_type (str) – A string indicating the AND variant (“classic” or “fast”). “classic” by default.
- Raises
ValueError – If the build_type string is not “classic” or “fast”.
- connect_inhibition(input_population, conn=None, conn_all=True, rcp_type='inhibitory', ini_pop_indexes=None, end_pop_indexes=None)
Connects an input population to the neurons to be inhibited by the Constant Spike Source block.
- Parameters
input_population (sim.Population, sim.PopulationView, sim.Assembly, list) – A PyNN object or a list of PyNN objects containing the population to connect to the inhibited neurons.
conn (sim.StaticSynapse) – The connection to use. Internal inhibitory synapse by default, it is recommended NOT to use this parameter.
conn_all – Unused.
rcp_type (str) – A string indicating the receptor type of the connections (excitatory or inhibitory). “Inhibitory” by default, it is recommended NOT to use this parameter.
ini_pop_indexes (list) – A list of indices used to select objects from the input population.
end_pop_indexes – Unused.
- Returns
The number of connections that have been created.
- Return type
int
- Raises
ValueError – If this functions is used with the classic AND variant.
- connect_inputs(input_population, conn=None, conn_all=True, rcp_type='excitatory', ini_pop_indexes=None, end_pop_indexes=None)
Connects an input population to the input neurons of the block.
- Parameters
input_population (sim.Population, sim.PopulationView, sim.Assembly, list) – A PyNN object or a list of PyNN objects containing the population to connect to the input neurons.
conn (sim.StaticSynapse) – The connection to use. std_conn (class parameter) by default.
conn_all – Unused.
rcp_type (str) – A string indicating the receptor type of the connections (excitatory or inhibitory). “Excitatory” by default.
ini_pop_indexes (list) – A list of indices used to select objects from the input population.
end_pop_indexes – Unused.
- Returns
The number of connections that have been created.
- Return type
int
- connect_outputs(output_population, conn=None, conn_all=True, rcp_type='excitatory', ini_pop_indexes=None, end_pop_indexes=None)
Connects the output neurons of the block to an output population.
- Parameters
output_population (sim.Population, sim.PopulationView, sim.Assembly, list) – A PyNN object or a list of PyNN objects containing the population to connect the output neurons to.
conn (sim.StaticSynapse) – The connection to use. std_conn (class parameter) by default.
conn_all – Unused.
rcp_type (str) – A string indicating the receptor type of the connections (excitatory or inhibitory). “Excitatory” by default.
ini_pop_indexes (list) – Unused.
end_pop_indexes – A list of indices used to select objects from the output population.
- Returns
The number of connections that have been created.
- Return type
int
- get_inhibited_neuron(flat=False)
Gets a list containing all the neurons inhibited by the Constant Spike Source block.
- Parameters
flat (bool) – Unused.
- Returns
The list containing all the inhibited neurons of the block
- Return type
list
- get_input_neurons(flat=False)
Gets a list containing all the input neurons of the block.
- Parameters
flat (bool) – A boolean value indicating whether or not to flatten the list. False by default.
- Returns
The flattened or unflattened list containing all the input neurons of the block
- Return type
list
- get_output_neurons(flat=False)
Gets a list containing all the output neurons of the block.
- Parameters
flat (bool) – Unused.
- Returns
The list containing all the output neurons of the block
- Return type
list