snnib.blender.network.Network¶
- class snnib.blender.network.Network(network_container: bpy.types.Object, template_neuron: bpy.types.Object, network_file: str = None)[source]¶
container representing a spiking neural network
- Attributes
network_container – container defining the boundaries of the SNNIB network inside [blender](https://www.blender.org/)
template_neuron – object serving as template for all neurons in the network
network_file – SNNIB compatible file representing a network output from a simulation
- Inferred Attributes
- axon_length
float
length of the axon root
axon only starts to branch out after that point
obtained from [blender](https://www.blender.org/) UI
- axon_objects
List[bpy.types.Object]
objects of all axons that are part of the network
- n_neurons
int
number of neurons contained in the network
obtained from [blender](https://www.blender.org/) UI
only relevant for randomly generated network
- neuron_objects
List[bpy.types.Object]
objects of all neurons that are part of the network
- p_synapses
float
probability of a synapse forming between any two neurons
obtained from [blender](https://www.blender.org/) UI
only relevant for randomly generated network
- p_spike
float
- probability of a neuron spiking at any time
i.e., on for every neuron for every frame p_spike a spike is emitted with probability p_spike
obtained from [blender](https://www.blender.org/) UI
only relevant for randomly generated network
- Rng
np.random.Generator
random number generator to use for network generation
- seed
int
random seed
obtained from [blender](https://www.blender.org/) UI
only relevant for randomly generated network
- Methods
_get_mean_outconnection() – returns mean direction of outgoing connections of some neuron
generate_network() – generates a random network
read_network() – loads a network from a file
setup_container() – sets up the network container
draw_neurons() – creates neurons and adds them to the scene
draw_synapses() – creates outgoing connections and ads them to the scene
- Dependencies
bpy
bmesh
json
logging
numpy
typing
- __init__(network_container: bpy.types.Object, template_neuron: bpy.types.Object, network_file: str = None)[source]¶
constructor
generates a random network if no network_file was found
otherwise reads the network from network_file
- Parameters
- network_container
bpy.types.Object
object representing the network container in the scene
- bounding box of network_container defines the region the network will occupy
neuron coordinates will be remapped to lie within the bounding box
- template_neuron
bpy.types.Object
- object representing a template to use for every neuron contained in the network
neurons in the network are instanced from template_neuron
you only need to modify template_neuron in order to procedurally apply the changes to all neurons in the network
- network_file
str, optional
file containing a save network to load into SNNIB
- the default is None
use random generation instead of reading from a file
Raises
Returns
Methods
__init__(network_container, template_neuron)constructor
draws neurons into the scene
draws synapses into the scene
generates random network based on user input
reads a network from self.network_file
sets up the network container
- draw_neurons()[source]¶
draws neurons into the scene
- will
instantiate neurons based on self.template_neuron
initialize axons (axon roots)
apply geo nodes inputs
adjust geo nodes mappings (to roughly match actual simulation)
Parameters
Raises
Returns
- draw_synapses()[source]¶
draws synapses into the scene
- will
add spline to respective axon object for every existing synapse
Parameters
Raises
Returns
- generate_network()[source]¶
generates random network based on user input
- will
generate random coordinates within `self.network_container`s bounding box
- generate random spiketrains for every neuron
for every frame there is a probability self.p_spike to emit a spike
- generate random connections between neurons
for every pair of neurons a connections exists with probability self.p_synapses
generate metadata corresponding to the render settings
Parameters
Raises
Returns