snnib.blender.network¶
base class and function to create a SNNIB network
exposed (and called) via blender UI elements
controls the look of the generated network
Exceptions
- Classes
Network – container of the SNNIB network
- Functions
generate_template_neuron() – generates a template neuron and adds it to the scene
Other Objects
Functions
|
returns generated template neuron object |
|
|
|
Classes
|
container representing a spiking neural 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
- 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
- snnib.blender.network.generate_template_neuron(name: str) bpy.types.Object[source]¶
returns generated template neuron object
- will
- generate a template neuron
create a cube
convert to a sphere
add respective geometry nodes (as a single user copy)
add the object (with name name) to the scene
- Parameters
- name
str
name to use for the template neuron
Raises
- Returns
- neuron_obj
bpy.types.Object
generated neuron object