Error in deepcopy

I have a question and kindly need your help, How i can run a new and separate instance of current simulator at a specific state ?
It should be noted that, I have examined the following methods, but i haven’t succeed !!

1. copy.deepcopy has been tested and i have got errors about not having a Signal or Probe in Dict

t = simcopy.trange()


sim0 = nengo.Simulator(model)

2. also Pickle save and load has been used

with open(’.\sim3.dat’, ‘wb’) as f:
pickle.dump(sim, f)

with open(’.\sim3.dat’, ‘rb’) as f:



Here is a simple script that reproduces error

Any help will be greatly appreciated!

It is possible to pickle a closed Simulator object and unpickle it later on. However, once a simulator is closed, it can’t be reopened to resume the simulation (for some information on this topic, the following documentation might be useful:

Depending on your use case, there are a couple of ways to simulate multiple copies of the same model. The most straightforward approach would involve setting a fixed seed to ensure deterministic behaviour across simulations. A more complicated approach would involve running a simulation to a current a given state, storing all of the state information, and then constructing a new network that uses this state information to initialize all of the e.g. neuron voltages, synaptic filters, etc. I wouldn’t recommend this unless there’s something specific you’re trying to do that isn’t handled by fixing the seed.

To demonstrate pickling and unpickling, the following script provides a short example:

import nengo
import numpy as np

with nengo.Network() as model:
    inp = nengo.Node(np.cos)
    ens = nengo.Ensemble(100, dimensions=1)
    nengo.Connection(inp, ens)
    probe = nengo.Probe(ens)

sim = nengo.Simulator(model)

with sim:

with open('sim.pkl', 'wb') as pfile:
    pickle.dump(sim, pfile)

with open('sim.pkl', 'rb') as pfile:
    sim_copy = pickle.load(pfile)

Anyway, I hope this is helpful, but let us know if you have any followup questions!