Skip to content

Commit

Permalink
Most problems fixed (except: recording from subgroups, changing dt fo…
Browse files Browse the repository at this point in the history
…r spikequeue)
  • Loading branch information
Marcel Stimberg committed Sep 11, 2014
1 parent aa10d38 commit a796324
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
6 changes: 3 additions & 3 deletions brian2/groups/poissongroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ class PoissonGroup(Group, SpikeSource):
add_to_magic_network = True

@check_units(rates=Hz)
def __init__(self, N, rates, clock=None, name='poissongroup*',
codeobj_class=None):
def __init__(self, N, rates, dt=None, when='thresholds', order=0,
name='poissongroup*', codeobj_class=None):

Group.__init__(self, when=clock, name=name)
Group.__init__(self, dt=dt, when=when, order=order, name=name)

self.codeobj_class = codeobj_class

Expand Down
4 changes: 1 addition & 3 deletions brian2/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ def test_base():
x.contained_objects.append(y)
assert_equal(len(x.contained_objects), 1)
assert x.contained_objects[0] is y

assert x.clock is defaultclock


assert_equal(x.active, True)
assert_equal(y.active, True)
y.active = False
Expand Down
7 changes: 3 additions & 4 deletions brian2/tests/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def test_math_functions():
Test that math functions give the same result, regardless of whether used
directly or in generated Python or C++ code.
'''
default_dt = brian_prefs.core.default_dt
test_array = np.array([-1, -0.5, 0, 0.5, 1])

with catch_logs() as _: # Let's suppress warnings about illegal values
Expand Down Expand Up @@ -68,7 +69,7 @@ def test_math_functions():
G.variable = test_array
mon = StateMonitor(G, 'func', record=True)
net = Network(G, mon)
net.run(clock.dt)
net.run(default_dt)

assert_allclose(numpy_result, mon.func_.flatten(),
err_msg='Function %s did not return the correct values' % func.__name__)
Expand All @@ -84,16 +85,14 @@ def test_math_functions():

# Calculate the result in a somewhat complicated way by using a
# subexpression in a NeuronGroup
clock = Clock()
G = NeuronGroup(len(test_array),
'''func = variable {op} scalar : 1
variable : 1'''.format(op=operator),
clock=clock,
codeobj_class=codeobj_class)
G.variable = test_array
mon = StateMonitor(G, 'func', record=True)
net = Network(G, mon)
net.run(clock.dt)
net.run(default_dt)

assert_allclose(numpy_result, mon.func_.flatten(),
err_msg='Function %s did not return the correct values' % func.__name__)
Expand Down

0 comments on commit a796324

Please sign in to comment.