When moving to using the new SpikeTrainList object in Neo, the annotations weren't fully harmonized between the "create from tuple" and "create from list" pathways, which led to the following error when using pyNN.nest with MPI:
$ mpirun -np 2 `which python` small_network.py nest
Traceback (most recent call last):
File "/home/andrew/dev/PyNN/examples/small_network.py", line 88, in <module>
cells.write_data(filename, annotations={'script_name': __file__})
File "/home/andrew/dev/PyNN/pyNN/common/populations.py", line 502, in write_data
self.recorder.write(variables, io, gather, self._record_filter, clear=clear,
File "/home/andrew/dev/PyNN/pyNN/recording/__init__.py", line 469, in write
data = self.get(variables, gather, filter_ids, clear, annotations=annotations,
File "/home/andrew/dev/PyNN/pyNN/recording/__init__.py", line 440, in get
data = gather_blocks(data)
File "/home/andrew/dev/PyNN/pyNN/recording/__init__.py", line 107, in gather_blocks
ordered_spiketrains = sorted(
File "/home/andrew/dev/PyNN/pyNN/recording/__init__.py", line 108, in <lambda>
segment.spiketrains, key=lambda s: s.annotations['source_id'])
KeyError: 'source_id'
This PR changes the "source_id" annotation to "channel_id", which is auto-generated by Neo when creating SpikeTrainLists from a pair of arrays (id, times). It also ensures the "source_index" annotation is always present.
coverage: 63.325% (+0.02%) from 63.307%
when pulling d5d6166d72e71e59c9cb4edea735305ef25db524 on apdavison:fix-channel-id
into 1fbf10ae531f91985e76a43d4d6c68dd36999153 on NeuralEnsemble:master.
When moving to using the new SpikeTrainList object in Neo, the annotations weren't fully harmonized between the "create from tuple" and "create from list" pathways, which led to the following error when using pyNN.nest with MPI:
This PR changes the "source_id" annotation to "channel_id", which is auto-generated by Neo when creating SpikeTrainLists from a pair of arrays (id, times). It also ensures the "source_index" annotation is always present.