Hi,

I'm a bit late, but since this might help users who have similar workflows, I just wanted to signal that you can have a look at NNGT: nngt.readthedocs.io/ and https://github.com/Silmathoron/NNGT

And specifically how to interact with NEST: https://nngt.readthedocs.io/en/stable/user/tutorial.html#real-neuronal-culture-and-nest-interaction-the-network

This would enable you to create a network beforehand and save it to a file, then just load it and send it to NEST using network = nngt.load_from_file("the-file") and network.to_nest().

Note that this works only with static weights and will not capture any information about the evolution of weights or connections via STDP or structural plasticity.

(Disclaimer: I am the library's main developer)

Best,
Tanguy


On 05/08/2020 10:33, LOW, SOCK CHING wrote:
Hi everyone,

It seems like there is no straight-forward method of saving the network as a single object, so I think the simplest solution would be to save the relevant connection information and reconnect it accordingly when I reinitialise the network again. Since my network is pretty simple, this is not excessively demanding...the only real issue I've had is saving SLILiteral typed objects, but that's usually solved by turning it into a string.

Just in case someone else unfamiliar with nest finds themselves in this situation too, here are some details on the method to extract the information:
  • Ensure that the handles of all distinct populations of created neurons are stored in variables (e.g. pop1 = nest.Create("iaf_psc_alpha", 50) retains a list of node handles in pop1).
  • Using nest.GetConnections(args):
    • Without args; returns all connections
    • args = pop1; returns all connections coming from the specified nodes
    • args = pop1, pop2; returns connections between the two populations
  • Using nest.GetStatus(conn, keys="weight") to get the parameters of the connection.
  • Save the parameters, there are many numbers of ways e.g. pickle.dump(), numpy.save()
If you know the populations in the network, you can get the connections between them (in both directions) and obtain their parameters with GetStatus (available keys: ['delay', 'receptor', 'sizeof', 'source', 'synapse_model', 'target', 'weight']).

To recreate the network, I choose to first create all the same populations then reinstate the connections using nest.Connect(pop1, pop2, 'one_to_one', syn_spec), with syn_spec being {'delay': [d1, d2,...,dn], 'weight': [w1, w2,...,wn], etc.} reconstructed from the saved data.


Cheers,
Sock
--
Tanguy Fardet
Postdoctoral researcher, University of Tübingen, Max Planck Institute for Biological Cybernetics.

Website: http://www.msc.univ-paris-diderot.fr/~fardet

Member of Labos 1point5 (mastodon: @labos1point5, twitter: @labos1point5).
Member of the Max Planck Sustainability Network (twitter: sustainable_mpg)