Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Harmonize spike train annotations #797

Merged
merged 1 commit into from
Apr 30, 2024

Conversation

apdavison
Copy link
Member

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.

@coveralls
Copy link

Coverage Status

coverage: 63.325% (+0.02%) from 63.307%
when pulling d5d6166 on apdavison:fix-channel-id
into 1fbf10a on NeuralEnsemble:master.

@apdavison apdavison added this to the 0.13.0 milestone Apr 30, 2024
@apdavison apdavison merged commit 5b6af57 into NeuralEnsemble:master Apr 30, 2024
7 checks passed
@apdavison apdavison deleted the fix-channel-id branch April 30, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants