-
Notifications
You must be signed in to change notification settings - Fork 249
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
Incorrect channel IDs in SpikeGadgetsRecordingExtractor
#1215
Comments
@JuliaSprenger @samuelgarcia do you have time to look into this? I'm not familiar with SpikeGadgets. Unless @khl02007 knows exactly what should be changed ;) |
Sorry, I don't have any experience with this IO. @samuelgarcia Could you take over this one? |
Hi Kyu Julia and Alessio. |
Thanks to the recently released version of Trodes that gives the location of data from each channel within a packet, I think I finally understand what is going on here. As I mentioned previously, the issue is that the mapping between the voltage traces and the channel IDs is incorrect in the current version of
In other words, the order is chip-first, hwChan-second. Here, chip refers to the amplifier chip used to acquire data (usually part of the SpikeGadgets product) e.g. the 32-channel chip from Intan. For example, a 128-channel recording using these chips would have the data in the following hwChan order:
When I reordered the channels of a So to parse the data correctly, we need to know (1) how many channels there are and (2) how many channels there are per chip. Dividing (1) by (2) gives you the number of chips (assuming only one type of chip is used). Both (1) and (2) can be found by parsing the header of the rec file. Specifically, (1) can be found by parsing Now that we understand the issue better, I think we can fix it. I can't promise to do this very soon so others should feel free to take this up, but may get to this eventually. |
@rly
rec_sg = si.read_spikegadgets(file_path='FILENAME.rec', stream_id="trodes" )
rec_sg.set_channel_gains(0.195)
rec_sg.set_channel_offsets(0)
rec_binary = si.BinaryRecordingExtractor(file_paths='BINARY_FILENAME.dat',
sampling_frequency=30e3, num_chan=128, dtype='int16')
def produce_channel_ids(n_total_channels, n_channels_per_chip=32):
x = []
for k in range(n_channels_per_chip):
x.append([k+i*n_channels_per_chip for i in range(int(n_total_channels/n_channels_per_chip))])
return [item for sublist in x for item in sublist]
channel_ids32 = produce_channel_ids(rec_sg.get_num_channels())
rec_sg_fixed = rec_sg.channel_slice(channel_ids=rec_sg.get_channel_ids(),
renamed_channel_ids=channel_ids32)
|
Fixed by #1496 |
Describe the bug
originally here SpikeInterface/spikeinterface#1260
Recordings from SpikeGadgets hardware have two possible channel maps: HWChan (a channel map defined by the amplifier) and Trodes channel map (for displaying on Trodes, the data acquisition software for SpikeGadgets). The mapping between these are in the header of the file that contains the recording (in .rec format). The channel IDs one gets with get_channel_ids from a SpikeGadgetsRecordingExtractor is in the Trodes order (though the channel names are HWChan names), which is sensible. But the order of the traces is completely scrambled (neither Trodes nor HWChan).
To Reproduce
trodesexport
which converts data to binarytrodesexport
to convert the file to binary:recording_rec
andrecording_bin_ks
Expected behaviour
they should match (but they don't)
Environment:
latest version of Trodes and spikeinterface
The text was updated successfully, but these errors were encountered: