Changeset 2116
- Timestamp:
- 08/10/10 17:18:06 (18 months ago)
- Location:
- trunk/brian
- Files:
-
- 6 modified
-
__init__.py (modified) (1 diff)
-
experimental/c_stdp.py (modified) (1 diff)
-
new_features.txt (modified) (1 diff)
-
stdp.py (modified) (1 diff)
-
tests/testutils/test_sparse.py (modified) (2 diffs)
-
utils/sparse_patch/0_7_1.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/brian/__init__.py
r2106 r2116 74 74 75 75 __version__ = '1.2.2dev' 76 __release_date__ = '2010-0 7-26'76 __release_date__ = '2010-08-10' 77 77 78 78 ### Define global preferences which are not defined anywhere else -
trunk/brian/experimental/c_stdp.py
r2105 r2116 59 59 vars_post = [var for var in vars if var in modified_variables(post)] 60 60 61 # additional dependencies on the set of equations are induced by the 62 # interactions in pre and post code 63 additional_deps = pre.split('\n')+post.split('\n') 61 # additional dependencies are used to ensure that if there are multiple 62 # pre/post separated equations they are grouped together as one 63 additional_deps = ['__pre_deps='+'+'.join(vars_pre), 64 '__post_deps='+'+'.join(vars_post)] 64 65 separated_equations = separate_equations(eqs_obj, additional_deps) 65 66 if not len(separated_equations) == 2: 67 print separated_equations 66 68 raise ValueError('Equations should separate into pre and postsynaptic variables.') 67 69 sep_pre, sep_post = separated_equations -
trunk/brian/new_features.txt
r2106 r2116 10 10 11 11 * Equations/aliases now work correctly in STDP (ticket #56) 12 * Bug in sparse matrices introduced in scipy 0.8.0 fixed 12 13 13 14 New features since 1.2.0 -
trunk/brian/stdp.py
r2105 r2116 221 221 vars_post = [var for var in vars if var in modified_variables(post)] 222 222 223 # Additional check TODO: modification of presynaptic variables should not depend on postsynaptic 224 # variables 225 226 # additional dependencies on the set of equations are induced by the 227 # interactions in pre and post code 228 additional_deps = pre.split('\n')+post.split('\n') 223 # additional dependencies are used to ensure that if there are multiple 224 # pre/post separated equations they are grouped together as one 225 additional_deps = ['__pre_deps='+'+'.join(vars_pre), 226 '__post_deps='+'+'.join(vars_post)] 229 227 separated_equations = separate_equations(eqs_obj, additional_deps) 230 228 if not len(separated_equations) == 2: -
trunk/brian/tests/testutils/test_sparse.py
r2020 r2116 1 1 from brian.connection import SparseMatrix 2 from numpy import zeros, array 2 3 from nose.tools import * 3 4 4 5 def test_sparse_matrix(): 5 6 x = SparseMatrix((10, 10)) 7 z = zeros((10, 10), dtype=int) 6 8 x[0, 4] = 3 7 9 x[1, :] = 5 … … 11 13 x[5, 2:4] = [1, 2] 12 14 x[6:8, 4:7] = 1 15 # same thing with z to compare 16 z[0, 4] = 3 17 z[1, :] = 5 18 z[2, []] = [] 19 z[3, [0]] = [6] 20 z[4, [0, 1]] = [7, 8] 21 z[5, 2:4] = [1, 2] 22 z[6:8, 4:7] = 1 23 # check the values are correct 24 y = array(x.todense(), dtype=int) 25 assert (y==z).all() 13 26 14 27 if __name__ == '__main__': -
trunk/brian/utils/sparse_patch/0_7_1.py
r2020 r2116 62 62 sparse.lil_matrix.__setitem__(self, index, [W] * len(xrange(*j.indices(self.shape[1])))) 63 63 elif isinstance(i, slice) and isinstance(j, slice) and isNumberType(W): 64 n = len(xrange(* j.indices(self.shape[0])))64 n = len(xrange(*i.indices(self.shape[0]))) 65 65 m = len(xrange(*j.indices(self.shape[1]))) 66 print index 67 print n, m 66 68 sparse.lil_matrix.__setitem__(self, index, W * numpy.ones((n, m))) 67 69 else:
