catalystneuro / neuroconv

Create NWB files by converting and combining neural data in proprietary formats and adding essential metadata.
https://neuroconv.readthedocs.io
BSD 3-Clause "New" or "Revised" License
50 stars 21 forks source link

Electrode selection in Extracellular electrophysiology Recording #787

Open letiziasignorelli opened 6 months ago

letiziasignorelli commented 6 months ago

Hi,

I'm trying to convert electrophysiological data from Axona to NWB using the code from the Neuroconv Examples Gallery.

Currently in the lab we're using channels 17-32 for recording, so tetrodes 5-8. When I extract metadata from the .set file I can see that the correct groups are extracted. If I print metadata["Ecephys"]["ElectrodeGroup"] , I get:

[{'name': '8',
  'location': '',
  'device': 'Axona',
  'description': 'Group 8 electrodes.'},
 {'name': '5',
  'location': '',
  'device': 'Axona',
  'description': 'Group 5 electrodes.'},
 {'name': '6',
  'location': '',
  'device': 'Axona',
  'description': 'Group 6 electrodes.'},
 {'name': '7',
  'location': '',
  'device': 'Axona',
  'description': 'Group 7 electrodes.'}]

But then after running the conversion and plotting the extracted signals, I don't get the correct channels (I can see it's only noise in the output). If instead, I try to extract the first 32 channels (so tetrodes 1-8) I'm getting the correct signals in channels 17-32. I wonder if I'm selecting the groups correctly.

Thanks

CodyCBakerPhD commented 6 months ago

(i) What version of NeuroConv? Our last release (5 days ago) included some fixes to electrodes/group stuff

(ii) Can you share the plotting function together with the file producing undesirable output together with the source file and conversion code? Or any other minimal reproducible example. Really hard to tell what is going on otherwise

CodyCBakerPhD commented 5 months ago

@letiziasignorelli Thanks for the email - I guess I'm still not sure how you are creating the _all.nwb file

In general, it appears as if upstream control over Axona groups/streams is not exposed as my minimal attempt to get the RecordingExtractor results in only 16 channels (not 32) and only a single group (well, None implying only a single group anyway)

from spikeinterface.extractors import AxonaRecordingExtractor

recording = AxonaRecordingExtractor(file_path=".../2509202301.bin")

recording.channel_ids
> array(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15'], dtype='<U64')

recording.get_channel_groups()
> None

As such, could you open issues upstream at https://github.com/NeuralEnsemble/python-neo/issues and https://github.com/SpikeInterface/spikeinterface/issues and share that same data with them? The metadata you saw extracted from the .set files by NeuroConv is only used properly if the underlying readers actually have the same group structure

h-mayorquin commented 1 month ago

There is a PR open for this: https://github.com/NeuralEnsemble/python-neo/pull/1520/files