Description of problem
Hi, I want to use store() / restore() in brian2 to save the connectivity and reloaded in a different simulation, but I get an error when I try to run simulations with the restored connectivity.
If I don’t run a simulation and just store the connectivity and restore it after, then the restore function works well. But when I try to restore the connectivity while I also use run() to run a simulation I get the error below. I hope someone can help me with this. I can copy part of the code too if that is helpful to understand the problem.
I have been having problems with Cython that seemed to be solved now, I am not sure up to what point this error could also be related with Cython.
Error:
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/codegen/runtime/cython_rt/cython_rt.py”, line 160, in run_block
return compiled_code.main(self.namespace)
File “_cython_magic_ccb3d62751e600698487f83f290437ab.pyx”, line 57, in _cython_magic_ccb3d62751e600698487f83f290437ab.main
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/synapses/synapses.py”, line 347, in initialise_queue
raise TypeError(("Synapses object ‘%s’ does not do anything, since "
TypeError: Synapses object ‘C1’ does not do anything, since it has not created synapses with ‘connect’. Set its active attribute to False if you intend to do only do this for a subsequent run.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/core/network.py”, line 901, in before_run
obj.before_run(run_namespace)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/core/base.py”, line 279, in device_override_decorated_function
return func(*args, **kwds)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/synapses/synapses.py”, line 319, in before_run
super(SynapticPathway, self).before_run(run_namespace)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/groups/group.py”, line 1143, in before_run
super(CodeRunner, self).before_run(run_namespace)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/core/base.py”, line 169, in before_run
codeobj.before_run()
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/codegen/codeobject.py”, line 123, in before_run
return self.run_block(‘before_run’)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/codegen/runtime/cython_rt/cython_rt.py”, line 164, in run_block
raise BrianObjectException(message, self.owner) from exc
BrianObjectException: Error encountered with object named “C1_pre”.
Object was created here (most recent call only, full details in debug log):
File “/Users/saraibanez/Desktop/Brian_Hansel&Mato/Brian2/balancedRing_b2_new_copia_copia.py”, line 201, in run_sims
C1 = Synapses(networkE, networkE,
An exception occured during the execution of the before_run block of code object C1_pre_push_spikes.
(See above for original error message and traceback.)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File “/Users/saraibanez/Desktop/Brian_Hansel&Mato/Brian2/balancedRing_b2_new_copia_copia.py”, line 339, in
run_sims()
File “/Users/saraibanez/Desktop/Brian_Hansel&Mato/Brian2/balancedRing_b2_new_copia_copia.py”, line 296, in run_sims
run(stim_on,report=‘text’)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/units/fundamentalunits.py”, line 2430, in new_f
result = f(*args, **kwds)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/core/magic.py”, line 374, in run
return magic_network.run(duration, report=report, report_period=report_period,
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/core/magic.py”, line 232, in run
Network.run(self, duration, report=report, report_period=report_period,
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/core/base.py”, line 279, in device_override_decorated_function
return func(*args, **kwds)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/units/fundamentalunits.py”, line 2430, in new_f
result = f(*args, **kwds)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/core/network.py”, line 1012, in run
self.before_run(namespace)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/core/base.py”, line 279, in device_override_decorated_function
return func(*args, **kwds)
File “/Users/saraibanez/opt/anaconda3/envs/brian2_good/lib/python3.9/site-packages/brian2/core/network.py”, line 903, in before_run
raise BrianObjectException(“An error occurred when preparing an object.”, obj) from ex
BrianObjectException: Error encountered with object named “C1_pre”.
Object was created here (most recent call only, full details in debug log):
File “/Users/saraibanez/Desktop/Brian_Hansel&Mato/Brian2/balancedRing_b2_new_copia_copia.py”, line 201, in run_sims
C1 = Synapses(networkE, networkE,
An error occurred when preparing an object. (See above for original error message and traceback.)