Generate simulated spikes

Hi,
I am very new to the Nengo and I am wondering how can I use the simulator to generate artificial neuronal spiking data from the neuronal network?

And can I put some signatures such that they represent different individuals (in real-world analogy, for example, different rats).
Thanks in advance.

Hello and welcome to the forum!
You can definitely use the simulator to generate spike data, though generally speaking you’ll need to provide inputs of some kind to a set of neurons in order to prompt them to spike, and the specific spiking patterns you observe will vary with these inputs. A good example that illustrates this idea can be found here: https://www.nengo.ai/nengo/examples/basic/many-neurons.html

If you’d like to represent different individuals, you could as a starting point treat each individual as separate ensemble as follows:

model = nengo.Network(label='Many Individuals')
with model:

    # ... add other code with inputs

    ind_a = nengo.Ensemble(n_neurons=100, dimensions=1)
    ind_b = nengo.Ensemble(n_neurons=100, dimensions=1)

    # ... add other code with connections

    ind_a_spikes = nengo.Probe(ind_a.neurons) 
    ind_b_spikes = nengo.Probe(ind_b.neurons)

A more complicated approach might involve implementing each individual using an entire subnetwork rather than a single ensemble. In this case, you could define a parameterized function that creates each subnetwork using certain arguments, and collect spiking data using probes as usual. For more info on defining and reusing networks, there’s some great info on this page: https://www.nengo.ai/nengo/examples/usage/network-design.html

Let me know if this captures what you’re hoping to do – If not, I can likely suggest other approaches.

Thanks a lot for the reply. This very helpful. Also can you shed some light on how to design the network manually, i.e., make the intrinsic/extrinsic links, make sparse network, etc.
The nengo.Ensemble has 100 neurons but how to mention custom network among them.
Thanks again

If you want to set up a framework where each individual is modelled as a network, you could do something like the following:

def ind_network(n_neurons, dimensions):
    with nengo.Network() as ind:
        ind.input = nengo.Node(size_in=dimensions)
        ind.ens_a = nengo.Ensemble(n_neurons, dimensions=dimensions)
        ind.ens_b = nengo.Ensemble(n_neurons, dimensions=dimensions)
        ind.ens_c = nengo.Ensemble(n_neurons, dimensions=dimensions)
        
        nengo.Connection(ind.input, ind.ens_a)
        nengo.Connection(ind.input, ind.ens_b)
        nengo.Connection(ind.ens_a, ind.ens_c)
        nengo.Connection(ind.ens_b, ind.ens_c)

    return ind

Calling this function will create a network with three ensembles, and you can connect to components of this network by defining connections between e.g. ind.input or ind.ens_c and other Nengo objects. You could also, for instance, call this function in a loop with different values for n_neurons to create a variety of different networks. Other arguments could be used to configure how, e.g., the internal ensembles are connected to one another.

If you want to manipulate sparsity you can set connection weights by using the transform= argument when creating Connection objects. At the extreme, if you set the transform to be an array of zeros, you will not pass any information over the connection, and the only spiking that occurs downstream will be due to the neuron biases.

That said, many of the design choices here will depend a lot on the functionality you want to implement, but hopefully this is enough to get you started.

Thanks @pblouw, that is what I needed for now.
Gaurav