- Timestamp:
- 11/18/11 17:41:12 (6 months ago)
- Location:
- branches/neo_output
- Files:
-
- 2 removed
- 7 modified
-
src/common/populations.py (modified) (2 diffs)
-
src/neuron/recording.py (modified) (2 diffs)
-
src/recording/__init__.py (modified) (3 diffs)
-
src/recording/files.py (deleted)
-
test/unittests/test_basepopulation.py (modified) (3 diffs)
-
test/unittests/test_files.py (deleted)
-
test/unittests/test_neuron.py (modified) (6 diffs)
-
test/unittests/test_population.py (modified) (2 diffs)
-
test/unittests/test_recording.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/neo_output/src/common/populations.py
r1006 r1008 517 517 @deprecated("get_data('v')") 518 518 def get_v(self, gather=True, compatible_output=True): 519 return self. recorders['v'].get(gather, compatible_output, self.record_filter)519 return self.get_data('v', gather) 520 520 521 521 @deprecated("write_data(file, ['gsyn_exc', 'gsyn_inh'])") … … 525 525 @deprecated("get_data(['gsyn_exc', 'gsyn_inh'])") 526 526 def get_gsyn(self, gather=True, compatible_output=True): 527 return self.get_data(['gsyn_exc', 'gsyn_inh'] ), gather527 return self.get_data(['gsyn_exc', 'gsyn_inh'], gather) 528 528 529 529 def get_spike_counts(self, gather=True): -
branches/neo_output/src/neuron/recording.py
r1006 r1008 88 88 89 89 def _native_record(self, variable, id): 90 match = recordable_pattern.match( self.variable)90 match = recordable_pattern.match(variable) 91 91 if match: 92 92 parts = match.groupdict() … … 126 126 def trim_spikes(spikes): 127 127 return spikes[spikes<=simulator.state.t+1e-9] 128 #import pdb; pdb.set_trace() 128 129 for variable in variables_to_include: 129 130 if variable == 'spikes': -
branches/neo_output/src/recording/__init__.py
r1006 r1008 149 149 150 150 def write(self, variables, file=None, gather=False, filter_ids=None): 151 """Write recorded data to file."""152 file= file or self.file151 """Write recorded data to a Neo IO""" 152 io = file or self.file 153 153 if gather==False and self._simulator.state.num_processes > 1: 154 file.name += '.%d' % self._simulator.state.mpi_rank154 io.filename += '.%d' % self._simulator.state.mpi_rank 155 155 logger.debug("Recorder is writing '%s' to file '%s' with gather=%s" % ( 156 variables, file.name, gather))156 variables, io.filename, gather)) 157 157 data = self.get(variables, gather, filter_ids) 158 158 if self._simulator.state.mpi_rank == 0 or gather == False: … … 163 163 @property 164 164 def metadata(self): 165 metadata = {} 166 if self.population is not None: 167 metadata.update({ 165 metadata = { 168 166 'size': self.population.size, 169 167 'first_index': 0, … … 172 170 'last_id': self.population.last_id, 173 171 'label': self.population.label, 174 } )172 } 175 173 metadata['dt'] = self._simulator.state.dt # note that this has to run on all nodes (at least for NEST) 176 174 return metadata -
branches/neo_output/test/unittests/test_basepopulation.py
r1000 r1008 320 320 assert not p.can_record('foo') 321 321 322 def test_ _record():323 p = MockPopulation() 324 p.recorder s = {'v': Mock()}325 p. _record('v')326 meth, args, kwargs = p.recorder s['v'].method_calls[0]327 id_arr,= args322 def test_record_with_single_variable(): 323 p = MockPopulation() 324 p.recorder = Mock() 325 p.record('v') 326 meth, args, kwargs = p.recorder.method_calls[0] 327 variables, id_arr = args 328 328 assert_equal(meth, 'record') 329 assert_equal(variables, 'v') 329 330 assert_arrays_equal(id_arr, p.all_cells) 330 331 331 def test__record_invalid_variable(): 332 p = MockPopulation() 333 assert_raises(errors.RecordingError, p._record, 'foo') 334 335 #def test__record_int(): 336 #p = MockPopulation() 337 #p.recorders = {'spikes': Mock()} 338 #p._record('spikes', 5) 339 #meth, args, kwargs = p.recorders['spikes'].method_calls[0] 340 #id_arr, = args 341 #assert_equal(meth, 'record') 342 #assert_equal(id_arr.size, 5) 343 344 #def test__record_with_RNG(): 345 #p = MockPopulation() 346 #p.recorders = {'v': Mock()} 347 #rng = Mock() 348 #rng.permutation = Mock(return_value=numpy.arange(p.size)) 349 #p._record('v', 5, rng) 350 #meth, args, kwargs = p.recorders['v'].method_calls[0] 351 #id_arr, = args 352 #assert_equal(meth, 'record') 353 #assert_equal(id_arr.size, 5) 354 #rng.permutation.assert_called_with(p.all_cells) 355 356 #def test__record_list(): 357 #record_list = ['curly', 'larry', 'moe'] # should really check that record_list contains IDs 358 #p = MockPopulation() 359 #p.recorders = {'v': Mock()} 360 #p._record('v', record_list) 361 #meth, args, kwargs = p.recorders['v'].method_calls[0] 362 #id_list, = args 363 #assert_equal(meth, 'record') 364 #assert_equal(id_list, record_list) 365 366 def test_invalid_record_from(): 367 p = MockPopulation() 368 assert_raises(Exception, p._record, 'v', 4.2) 369 370 def test_spike_recording(): 371 p = MockPopulation() 372 p._record = Mock() 373 p.record("arg1") 374 p._record.assert_called_with('spikes', "arg1") 332 def test_record_with_multiple_variables(): 333 p = MockPopulation() 334 p.recorder = Mock() 335 p.record(['v', 'gsyn_exc', 'spikes']) 336 meth, args, kwargs = p.recorder.method_calls[0] 337 variables, id_arr = args 338 assert_equal(meth, 'record') 339 assert_equal(variables, ['v', 'gsyn_exc', 'spikes']) 340 assert_arrays_equal(id_arr, p.all_cells) 375 341 376 342 def test_record_v(): 377 343 p = MockPopulation() 378 p. _record = Mock()344 p.record = Mock() 379 345 p.record_v("arg1") 380 p. _record.assert_called_with('v', "arg1")346 p.record.assert_called_with('v', "arg1") 381 347 382 348 def test_record_gsyn(): 383 349 p = MockPopulation() 384 p. _record = Mock()350 p.record = Mock() 385 351 p.record_gsyn("arg1") 386 p. _record.assert_called_with('gsyn', "arg1")352 p.record.assert_called_with(['gsyn_exc', 'gsyn_inh'], "arg1") 387 353 388 354 def test_printSpikes(): 389 355 p = MockPopulation() 390 p.recorder s = {'spikes': Mock()}391 p.record_filter = " arg4"392 p.printSpikes(" arg1", "arg2", "arg3")393 meth, args, kwargs = p.recorder s['spikes'].method_calls[0]356 p.recorder = Mock() 357 p.record_filter = "filter" 358 p.printSpikes("file", "gather", "compatible_output") 359 meth, args, kwargs = p.recorder.method_calls[0] 394 360 assert_equal(meth, 'write') 395 assert_equal(args, (" arg1", "arg2", "arg3", "arg4"))361 assert_equal(args, ("spikes", "file", "gather", "filter")) 396 362 397 363 def test_getSpikes(): 398 364 p = MockPopulation() 399 p.recorder s = {'spikes': Mock()}400 p.record_filter = " arg3"401 p.getSpikes(" arg1", "arg2")402 meth, args, kwargs = p.recorder s['spikes'].method_calls[0]365 p.recorder = Mock() 366 p.record_filter = "filter" 367 p.getSpikes("gather", "compatible_output") 368 meth, args, kwargs = p.recorder.method_calls[0] 403 369 assert_equal(meth, 'get') 404 assert_equal(args, (" arg1", "arg2", "arg3"))370 assert_equal(args, ("spikes", "gather", "filter")) 405 371 406 372 def test_print_v(): 407 373 p = MockPopulation() 408 p.recorder s = {'v': Mock()}409 p.record_filter = " arg4"410 p.print_v(" arg1", "arg2", "arg3")411 meth, args, kwargs = p.recorder s['v'].method_calls[0]374 p.recorder = Mock() 375 p.record_filter = "filter" 376 p.print_v("file", "gather", "compatible_output") 377 meth, args, kwargs = p.recorder.method_calls[0] 412 378 assert_equal(meth, 'write') 413 assert_equal(args, (" arg1", "arg2", "arg3", "arg4"))379 assert_equal(args, ("v", "file", "gather", "filter")) 414 380 415 381 def test_get_v(): 416 382 p = MockPopulation() 417 p.recorder s = {'v': Mock()}418 p.record_filter = " arg3"419 p.get_v(" arg1", "arg2")420 meth, args, kwargs = p.recorder s['v'].method_calls[0]383 p.recorder = Mock() 384 p.record_filter = "filter" 385 p.get_v("gather", "compatible_output") 386 meth, args, kwargs = p.recorder.method_calls[0] 421 387 assert_equal(meth, 'get') 422 assert_equal(args, (" arg1", "arg2", "arg3"))388 assert_equal(args, ("v", "gather", "filter")) 423 389 424 390 def test_print_gsyn(): 425 391 p = MockPopulation() 426 p.recorder s = {'gsyn': Mock()}427 p.record_filter = " arg4"428 p.print_gsyn(" arg1", "arg2", "arg3")429 meth, args, kwargs = p.recorder s['gsyn'].method_calls[0]392 p.recorder = Mock() 393 p.record_filter = "filter" 394 p.print_gsyn("file", "gather", "compatible_output") 395 meth, args, kwargs = p.recorder.method_calls[0] 430 396 assert_equal(meth, 'write') 431 assert_equal(args, ( "arg1", "arg2", "arg3", "arg4"))397 assert_equal(args, (["gsyn_exc", "gsyn_inh"], "file", "gather", "filter")) 432 398 433 399 def test_get_gsyn(): 434 400 p = MockPopulation() 435 p.recorder s = {'gsyn': Mock()}436 p.record_filter = " arg3"437 p.get_gsyn(" arg1", "arg2")438 meth, args, kwargs = p.recorder s['gsyn'].method_calls[0]401 p.recorder = Mock() 402 p.record_filter = "filter" 403 p.get_gsyn("gather", "compatible_output") 404 meth, args, kwargs = p.recorder.method_calls[0] 439 405 assert_equal(meth, 'get') 440 assert_equal(args, ( "arg1", "arg2", "arg3"))406 assert_equal(args, (["gsyn_exc", "gsyn_inh"], "gather", "filter")) 441 407 442 408 def test_get_spike_counts(): 443 409 p = MockPopulation() 444 p.recorder s = {'spikes': Mock()}445 p.get_spike_counts(" arg1")446 meth, args, kwargs = p.recorder s['spikes'].method_calls[0]410 p.recorder = Mock() 411 p.get_spike_counts("gather") 412 meth, args, kwargs = p.recorder.method_calls[0] 447 413 assert_equal(meth, 'count') 448 assert_equal(args, (" arg1", None))414 assert_equal(args, ("spikes", "gather", None)) 449 415 450 416 def test_meanSpikeCount(): … … 452 418 MockPopulation._simulator.state.mpi_rank = 0 453 419 p = MockPopulation() 454 p.recorder s = {'spikes': Mock()}455 p.recorder s['spikes'].count = Mock(return_value={0: 2, 1: 5})420 p.recorder = Mock() 421 p.recorder.count = Mock(return_value={0: 2, 1: 5}) 456 422 assert_equal(p.meanSpikeCount(), 3.5) 457 423 MockPopulation._simulator.state.mpi_rank = orig_rank … … 461 427 MockPopulation._simulator.state.mpi_rank = 1 462 428 p = MockPopulation() 463 p.recorder s = {'spikes': Mock()}464 p.recorder s['spikes'].count = Mock(return_value={0: 2, 1: 5})429 p.recorder = Mock() 430 p.recorder.count = Mock(return_value={0: 2, 1: 5}) 465 431 assert p.meanSpikeCount() is numpy.NaN 466 432 MockPopulation._simulator.state.mpi_rank = orig_rank -
branches/neo_output/test/unittests/test_neuron.py
r999 r1008 5 5 from nose.tools import assert_equal, assert_raises, assert_almost_equal 6 6 import numpy 7 from pyNN.utility import assert_arrays_equal 7 8 8 9 class MockCellClass(object): 9 recordable = ['v' ]10 recordable = ['v', 'spikes', 'gsyn_exc', 'gsyn_inh', 'spam'] 10 11 parameters = ['romans', 'judeans'] 11 12 injectable = True … … 29 30 self.judeans = judeans 30 31 self.foo_init = -99.9 32 self.traces = {} 31 33 32 34 class MockID(int): … … 40 42 celltype = MockCellClass() 41 43 local_cells = [MockID(44), MockID(33)] 44 label = "mock population" 45 def describe(self): 46 return "mock population" 42 47 43 48 # simulator … … 238 243 239 244 def setup(self): 240 if "foo" not in recording.Recorder.formats: 241 recording.Recorder.formats['foo'] = "bar" 242 self.rv = recording.Recorder('v') 243 self.rg = recording.Recorder('gsyn') 244 self.rs = recording.Recorder('spikes') 245 self.rf = recording.Recorder('foo') 245 p = MockPopulation() 246 self.rv = recording.Recorder(p) 247 self.rg = recording.Recorder(p) 248 self.rs = recording.Recorder(p) 249 self.rf = recording.Recorder(p) 246 250 self.cells = [MockID(22), MockID(29)] 247 251 248 252 def teardown(self): 249 recording.Recorder.formats.pop("foo")253 pass 250 254 251 255 def test__record(self): 252 self.rv._record( self.cells)253 self.rg._record( self.cells)254 self.rs._record( self.cells)256 self.rv._record('v', self.cells) 257 self.rg._record('gsyn_inh', self.cells) 258 self.rs._record('spikes', self.cells) 255 259 for cell in self.cells: 256 260 cell._cell.record.assert_called_with(1) … … 260 264 261 265 def test__get_v(self): 262 self.rv.recorded = self.cells266 self.rv.recorded['v'] = self.cells 263 267 self.cells[0]._cell.vtrace = numpy.arange(-65.0, -64.0, 0.1) 264 268 self.cells[1]._cell.vtrace = numpy.arange(-64.0, -65.0, -0.1) 265 269 self.cells[0]._cell.record_times = self.cells[1]._cell.record_times = numpy.arange(0.0, 1.0, 0.1) 266 vdata = self.rv._get(gather=False, compatible_output=True, filter=None) 267 assert_equal(vdata.shape, (20,3)) 270 vdata = self.rv._get(['v'], gather=False, filter_ids=None) 271 assert_equal(len(vdata.segments[0].analogsignals), 2) 272 assert_arrays_equal(numpy.array(vdata.segments[0].analogsignals[0]), self.cells[0]._cell.vtrace) 268 273 269 274 def test__get_spikes(self): 270 self.rs.recorded = self.cells275 self.rs.recorded['spikes'] = self.cells 271 276 self.cells[0]._cell.spike_times = numpy.arange(101.0, 111.0) 272 277 self.cells[1]._cell.spike_times = numpy.arange(13.0, 23.0) 273 278 simulator.state.t = 111.0 274 sdata = self.rs._get(gather=False, compatible_output=True, filter=None) 275 assert_equal(sdata.shape, (20,2)) 279 sdata = self.rs._get(['spikes'], gather=False, filter_ids=None) 280 assert_equal(len(sdata.segments[0].spiketrains), 2) 281 assert_arrays_equal(numpy.array(sdata.segments[0].spiketrains[0]), self.cells[0]._cell.spike_times) 276 282 277 283 def test__get_gsyn(self): 278 self.rg.recorded = self.cells284 self.rg.recorded['gsyn_inh'] = self.cells 279 285 for cell in self.cells: 280 286 cell._cell.gsyn_trace = {} … … 284 290 cell._cell.gsyn_trace['inhibitory_TM'] = numpy.arange(4.01, 4.0199, 0.001) 285 291 cell._cell.record_times = self.cells[1]._cell.record_times = numpy.arange(0.0, 1.0, 0.1) 286 gdata = self.rg._get( gather=False, compatible_output=True, filter=None)292 gdata = self.rg._get(['gsyn_inh'], gather=False, filter_ids=None) 287 293 assert_equal(gdata.shape, (20,4)) 288 294 289 295 def test__local_count(self): 290 self.rs.recorded = self.cells296 self.rs.recorded['spikes'] = self.cells 291 297 self.cells[0]._cell.spike_times = h.Vector(numpy.arange(101.0, 111.0)) 292 298 self.cells[1]._cell.spike_times = h.Vector(numpy.arange(13.0, 33.0)) 293 assert_equal(self.rs._local_count( filter=None), {22: 10, 29: 20})294 299 assert_equal(self.rs._local_count('spikes', filter_ids=None), {22: 10, 29: 20}) 300 -
branches/neo_output/test/unittests/test_population.py
r1000 r1008 1 from pyNN import errors, random, standardmodels, space 1 from pyNN import errors, random, standardmodels, space, recording 2 2 from pyNN.common import populations 3 3 from nose.tools import assert_equal, assert_raises … … 57 57 assert_equal(p.celltype.parameters, {'A': 20.0, 'B': -34.9}) 58 58 assert_equal(p.initial_values, {}) 59 assert isinstance(p.recorders, dict)60 59 p.initialize.assert_called_with('m', -1.23) 61 60 -
branches/neo_output/test/unittests/test_recording.py
r1000 r1008 1 from pyNN import recording 1 from pyNN import recording, errors 2 2 from nose.tools import assert_equal, assert_raises 3 3 from mock import Mock 4 4 import numpy 5 5 import os 6 from collections import defaultdict 6 7 from pyNN.utility import assert_arrays_equal 7 8 … … 10 11 mpi_comm = recording.mpi_comm 11 12 12 def setup():13 recording.Recorder._simulator = MockSimulator(mpi_rank=0)14 15 def teardown():16 del recording.Recorder._simulator17 13 18 14 #def test_rename_existing(): … … 44 40 last_id = first_id + size 45 41 label = "mock population" 42 celltype = Mock() 46 43 def __len__(self): 47 44 return self.size 48 45 def can_record(self, variable): 49 if variable in ["spikes", "v", "gsyn "]:46 if variable in ["spikes", "v", "gsyn_exc", "gsyn_inh", "spam"]: 50 47 return True 51 48 else: … … 53 50 def id_to_index(self, id): 54 51 return id 52 def describe(self): 53 return "mock population" 55 54 55 class MockNeoBlock(object): 56 def __init__(self): 57 self.name = None 58 self.description = None 59 self.segments = [Mock()] 60 def annotate(self, **annotations): 61 pass 56 62 57 63 def test_Recorder_create(): 58 r = recording.Recorder('spikes')59 assert_equal(r.variable, 'spikes')60 assert_equal(r.population, None)64 p = MockPopulation() 65 r = recording.Recorder(p) 66 assert_equal(r.population, p) 61 67 assert_equal(r.file, None) 62 assert_equal(r.recorded, set([]))68 assert_equal(r.recorded, defaultdict(set)) 63 69 64 70 def test_Recorder_invalid_variable(): 65 assert_raises(AssertionError, 66 recording.Recorder, 'foo', population=MockPopulation()) 71 p = MockPopulation() 72 r = recording.Recorder(p) 73 all_ids = (MockID(0, True), MockID(1, False), MockID(2, True), MockID(3, True), MockID(4, False)) 74 assert_raises(errors.RecordingError, 75 r.record, 'foo', all_ids) 67 76 68 77 class MockID(object): … … 72 81 73 82 def test_record(): 74 r = recording.Recorder('spikes') 83 p = MockPopulation() 84 r = recording.Recorder(p) 75 85 r._record = Mock() 76 assert_equal(r.recorded, set([]))86 assert_equal(r.recorded, defaultdict(set)) 77 87 78 88 all_ids = (MockID(0, True), MockID(1, False), MockID(2, True), MockID(3, True), MockID(4, False)) 79 89 first_ids = all_ids[0:3] 80 r.record( first_ids)81 assert_equal(r.recorded , set(id for id in first_ids if id.local))82 assert_equal(len(r.recorded ), 2)83 r._record.assert_called_with( r.recorded)90 r.record('spam', first_ids) 91 assert_equal(r.recorded['spam'], set(id for id in first_ids if id.local)) 92 assert_equal(len(r.recorded['spam']), 2) 93 r._record.assert_called_with('spam', r.recorded['spam']) 84 94 85 95 more_ids = all_ids[2:5] 86 r.record( more_ids)87 assert_equal(r.recorded , set(id for id in all_ids if id.local))88 assert_equal(len(r.recorded ), 3)89 r._record.assert_called_with( set(all_ids[3:4]))96 r.record('spam', more_ids) 97 assert_equal(r.recorded['spam'], set(id for id in all_ids if id.local)) 98 assert_equal(len(r.recorded['spam']), 3) 99 r._record.assert_called_with('spam', set(all_ids[3:4])) 90 100 91 101 def test_filter_recorded(): 92 r = recording.Recorder('spikes') 102 p = MockPopulation() 103 r = recording.Recorder(p) 93 104 r._record = Mock() 94 105 all_ids = (MockID(0, True), MockID(1, False), MockID(2, True), MockID(3, True), MockID(4, False)) 95 r.record(all_ids) 96 assert_equal(r.recorded, set(id for id in all_ids if id.local)) 106 r.record(['spikes', 'spam'], all_ids) 107 assert_equal(r.recorded['spikes'], set(id for id in all_ids if id.local)) 108 assert_equal(r.recorded['spam'], set(id for id in all_ids if id.local)) 97 109 98 110 filter = all_ids[::2] 99 filtered_ids = r.filter_recorded( filter)111 filtered_ids = r.filter_recorded('spam', filter) 100 112 assert_equal(filtered_ids, set(id for id in filter if id.local)) 101 113 102 assert_equal(r.filter_recorded( None), r.recorded)114 assert_equal(r.filter_recorded('spikes', None), r.recorded['spikes']) 103 115 104 def test_get__zero_offset(): 105 r = recording.Recorder('spikes') 106 fake_data = numpy.array([ 107 (3, 12.3), 108 (4, 14.5), 109 (7, 19.8) 110 ]) 116 def test_get(): 117 p = MockPopulation() 118 r = recording.Recorder(p) 119 r._simulator = MockSimulator(mpi_rank=0) 120 fake_data = MockNeoBlock() 111 121 r._get = Mock(return_value=fake_data) 112 assert_arrays_equal(r.get(), fake_data) 122 r.get('spikes') 123 assert_equal(fake_data.name, p.label) 124 assert_equal(fake_data.description, p.describe()) 113 125 114 126 … … 121 133 self.state = MockState(mpi_rank) 122 134 135 class MockNeoIO(object): 136 filename = "fake_file" 137 write = Mock() 138 123 139 def test_write__with_filename__compatible_output__gather__onroot(): 124 140 orig_metadata = recording.Recorder.metadata 125 141 recording.Recorder.metadata = {'a': 2, 'b':3} 126 r = recording.Recorder('spikes') 127 fake_data = numpy.array([ 128 (3, 12.3), 129 (4, 14.5), 130 (7, 19.8) 131 ]) 142 p = MockPopulation() 143 r = recording.Recorder(p) 144 r._simulator = MockSimulator(mpi_rank=0) 145 fake_data = MockNeoBlock() 132 146 r._get = Mock(return_value=fake_data) 133 r._make_compatible = Mock(return_value=fake_data) 134 r.write(file="tmp.spikes", gather=True, compatible_output=True) 135 136 os.remove("tmp.spikes") 147 output_io = MockNeoIO() 148 r.write("spikes", file=output_io, gather=True) 137 149 recording.Recorder.metadata = orig_metadata 150 output_io.write.assert_called_with(fake_data) 138 151 139 152 def test_metadata_property(): 140 r = recording.Recorder('spikes', population=None) 141 r._get = Mock(return_value=numpy.random.uniform(size=(6,2))) 153 p = MockPopulation() 154 r = recording.Recorder(population=p) 155 r._simulator = MockSimulator(mpi_rank=0) 142 156 assert_equal(r.metadata, 143 {'variable': 'spikes', 'dt': 0.123, 'n': 6}) 144 145 r = recording.Recorder('v', population=MockPopulation()) 146 r._get = Mock(return_value=numpy.random.uniform(size=(6,2))) 147 assert_equal(r.metadata, 148 {'first_id': 2454, 'label': 'mock population', 'n': 6, 149 'variable': 'v', 'dt': 0.123, 'last_id': 2465, 'size': 11, 157 {'first_id': 2454, 'label': 'mock population', 158 'dt': 0.123, 'last_id': 2465, 'size': 11, 150 159 'first_index': 0, 'last_index': 11}) 151 152 def test__make_compatible_spikes():153 r = recording.Recorder('spikes')154 input_data = numpy.array([[0, 12.3], [1, 45.2], [0, 46.3],155 [4, 49.4], [0, 78.3]])156 output_data = r._make_compatible(input_data) # time id157 assert_arrays_equal(input_data[:,(1,0)], output_data)158 160 159 def test__make_compatible_v():160 r = recording.Recorder('v')161 input_data = numpy.array([[0, 0.0, -65.0], [3, 0.0, -65.0],162 [0, 0.1, -64.3], [3, 0.1, -65.1],163 [0, 0.2, -63.7], [3, 0.2, -65.5]])164 output_data = r._make_compatible(input_data) # voltage id165 assert_arrays_equal(input_data[:,(2,0)], output_data)166 161 167 162 #def test_count__spikes_gather():
