if j % save_connections_interval == 0 and j > 0 and not test_mode:
save_connections(str(j))
save_tetha(str(j))
print ('save connections')
for connName in save_conns:
conn = connections[connName]
connListSparse = zip(conn.i, conn.j, conn.w)
np.save(data_path + 'weights/' + connName + ending, connListSparse)
Hi,
I think this could be due to the fact that the code pickles Brian attributes like synaptic variables directly. These are `VariableView` objects that allow some fancy things like string indexing and therefore need to keep a reference to their parent group. For storing, you most likely don't need all that. The easiest way to get the simple array information is to use e.g. `conn.i[:]` instead of `conn.i`. For variables with units, this will still store the unit information (i.e. a `Quantity` object), to get rid of this as well use a trailing underscore (`conn.i_[:]`).
Best,
Marcel
--
---
You received this message because you are subscribed to the Google Groups "Brian Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brian-developm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
() ./weights/XeAe.npyERROR Brian 2 encountered an unexpected error. If you think this is bug in Brian 2, please report this issue either to the mailing list at <http://groups.google.com/group/brian-development/>, or to the issue tracker at <https://github.com/brian-team/brian2/issues>. Please include this file with debug information in your report: /tmp/brian_debug_f6wl9fa8.log Additionally, you can also include a copy of the script that was run, available at: /tmp/brian_script_sam7uq__.py Thanks! [brian2]
Traceback (most recent call last):
File "Diehl&Cook_spiking_MNIST_Brian2.py", line 401, in <module>weightMatrix = get_matrix_from_file(weight_path + connName + ending + '.npy')File "Diehl&Cook_spiking_MNIST_Brian2.py", line 80, in get_matrix_from_filevalue_arr[np.int32(readout[:,0]), np.int32(readout[:,1])] = readout[:,2]IndexError: too many indices for array
(313600, 3) ./weights/filename.npyStarting simulation at t=0. s for a duration of 0.35 s
0.35 s (100%) simulated in < 1s
Starting simulation at t=0.5 s for a duration of 0.35 s
0.35 s (100%) simulated in < 1s
Starting simulation at t=1. s for a duration of 0.35 s
0.35 s (100%) simulated in < 1s
...
To unsubscribe from this group and stop receiving emails from it, send an email to brian-development+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
---
You received this message because you are subscribed to the Google Groups "Brian Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to brian-development+unsubscribe@googlegroups.com.
def save_connections(ending = ''):print 'save connections'for connName in save_conns:connMatrix = connections[connName][:]connListSparse = ([(i,j,connMatrix[i,j]) for i in xrange(connMatrix.shape[0]) for j in xrange(connMatrix.shape[1])])
np.save(data_path + 'weights/' + connName + ending, connListSparse)
def save_connections(ending = ''):
print ('save connections')for connName in save_conns:conn = connections[connName]
connListSparse = zip(conn.i[:], conn.j[:], conn.w[:])
np.save(data_path + 'weights/' + connName + ending, connListSparse)
Hi,