Skip to content

Commit

Permalink
Merge pull request #500 from appukuttan-shailesh/fix_499
Browse files Browse the repository at this point in the history
Fixes issue #499: updates sim.end() for Brian
  • Loading branch information
apdavison committed Jul 17, 2017
2 parents 3e6728f + 08acdb6 commit fe125c6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
1 change: 0 additions & 1 deletion pyNN/brian/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def end(compatible_output=True):
for (population, variables, filename) in simulator.state.write_on_end:
io = get_io(filename)
population.write_data(io, variables)
simulator.state.clear()
simulator.state.write_on_end = []
# should have common implementation of end()

Expand Down
21 changes: 20 additions & 1 deletion test/system/scenarios/test_recording.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,25 @@ def eval_num_cells(data):
assert_true (nspikes1 == -1)
assert_true (nspikes2 == -1)
assert_true (annot_bool)



@register()
def issue499(sim):
"""
Test to check that sim.end() does not erase the recorded data
"""
sim.setup(min_delay=1.0, timestep = 0.1)
cells = sim.Population(1, sim.IF_curr_exp())
dcsource = sim.DCSource(amplitude=0.5, start=20, stop=80)
cells[0].inject(dcsource)
cells.record('v')

sim.run(50.0)
sim.end()
vm = cells.get_data().segments[0].filter(name="v")[0]
v_dc = vm[:, 0]
assert_true (len(v_dc)!=0)


if __name__ == '__main__':
from pyNN.utility import get_simulator
Expand All @@ -370,3 +388,4 @@ def eval_num_cells(data):
test_sampling_interval(sim)
test_mix_procedural_and_oo(sim)
issue_449_490_491(sim)
issue499(sim)

0 comments on commit fe125c6

Please sign in to comment.