You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Channel ids are mixed up when loading recording #3248
I have noticed a strange behavior with channel_ids that might be due to an update because I never noticed this in the past.
I am working with Neuralynx data and using si.extractors.read_neuralynx() function.
In the past I had the feeling that all the channel_ids were sorted, but now when I'm loading my data everything is mixed up (see example below).
Is this an expected behavior ? And if yes, is there a method to order the channels and channel ids in the recording object ? Maybe it has something to do with how Neo handle the ch_ids ? @samuelgarcia@zm711
Have you updated Neo at all? We have had some work on Neuralynx (mostly @samuelgarcia so I don't know if a change occurred during that work). Also @h-mayorquin changed how displaying this info works as you can see from the nice html display in your notebook. So I think we need to know version numbers of Neo and spikeinterface to figure this out.
Are you just doing a frame slice or did you do a channel slice before as well?
Also, I frame sliced the recording just before this yes but no channel slice. I have a folder with 2 stream ids and I loaded a single stream id by giving it as arg in read_neuralynx()
I create my own probegroup. In this particular recording I have 24 channel splitted in 3 probes of 8 channels each. All the channels have channel ids ranging from 128 to 151 and in reality the 8 first channels are belonging to the 1st probe in the group, then the 8 after and so on...
I set the device channel indices to values between 0 and 23 and change the contact ids to the channel names of the channel I would like to be assigned to each contact. SO, the dataframes looks okay :
The issue is that, with the mixed channel ids and channel names : each channel don't fall in the correct group I expected.
I would like to know if there is a way to reorder the channels inside the recording without messing up with internal processes.
So the idea is the contact_ids are numbers indicating which contact we are referring to on the probe itself. So it sounds like contacts 0-8 should be on probe 1, 9-15 on probe 2 and 16-23 on probe 3. Then the device_channel_indices should be numbers between 0-24 that rearrange the contact_ids such that they are linked to the correct channel_id. So because I don't know the device correct me if I'm wrong, but the mHaT2_4 is related to the channel_id of the recording equipment and not the actual probe itself right?
I think the confusion is you are trying to attach the channel_id to the probe identity when what you really need to do is set the device_channel_indices to do that operation instead. I'm wondering if the sorting of the channel_ids is weird because of that.
I don't think my recording equipment maps the probe. As far as I know, the only thing in the recording data are the ch_ids (the ones going from "128" to "151". Those ids were always ordered in ascending way and my contact names such as mHaT2_1, mHaT2_2 ... where following the ch_ids since each contact is linked to this specific id.
The thing is that before, the contact_names and ids where ordered in a way that each of my contacts where group by probe.
Here is a dataframe representing how I expect things to be ordered :
If I understand correctly what you said above, since the ch_ids are mixed up, I should find for each of my channel, the index where it's corresponding appear in ch_ids and then give this list to set_global_device_channel_indices()
I did that and it changed the group as you can see below :
The issue it that the probes and channel does not correspond to what I expected :
In the example above I sorted by channel names but you can see that the position does not correspond at all to the example I mentionned above.
So I'm a bit confused on how I should proceed, I feel like the mix of channel_ids is not expected and may not be due to my recording system as it was not like that a few weeks ago (at least never noticed and never had problem with it)
Activity
zm711 commentedon Jul 24, 2024
Have you updated Neo at all? We have had some work on Neuralynx (mostly @samuelgarcia so I don't know if a change occurred during that work). Also @h-mayorquin changed how displaying this info works as you can see from the nice html display in your notebook. So I think we need to know version numbers of Neo and spikeinterface to figure this out.
Are you just doing a frame slice or did you do a channel slice before as well?
Antho2422 commentedon Jul 24, 2024
Here are the versions I'm using
Also, I frame sliced the recording just before this yes but no channel slice. I have a folder with 2 stream ids and I loaded a single stream id by giving it as arg in
read_neuralynx()zm711 commentedon Jul 24, 2024
I think we will have to wait for @samuelgarcia to check this since I don't know neuralynx that well.
If you do
and then print that dataframe out what does it look like?
Antho2422 commentedon Jul 24, 2024
I create my own probegroup. In this particular recording I have 24 channel splitted in 3 probes of 8 channels each. All the channels have channel ids ranging from 128 to 151 and in reality the 8 first channels are belonging to the 1st probe in the group, then the 8 after and so on...
I set the device channel indices to values between 0 and 23 and change the contact ids to the channel names of the channel I would like to be assigned to each contact. SO, the dataframes looks okay :
The issue is that, with the mixed channel ids and channel names : each channel don't fall in the correct group I expected.
I would like to know if there is a way to reorder the channels inside the recording without messing up with internal processes.
zm711 commentedon Jul 24, 2024
Wait a tic.
So the idea is the contact_ids are numbers indicating which contact we are referring to on the probe itself. So it sounds like contacts 0-8 should be on probe 1, 9-15 on probe 2 and 16-23 on probe 3. Then the device_channel_indices should be numbers between 0-24 that rearrange the contact_ids such that they are linked to the correct channel_id. So because I don't know the device correct me if I'm wrong, but the
mHaT2_4is related to the channel_id of the recording equipment and not the actual probe itself right?I think the confusion is you are trying to attach the channel_id to the probe identity when what you really need to do is set the
device_channel_indicesto do that operation instead. I'm wondering if the sorting of the channel_ids is weird because of that.Antho2422 commentedon Jul 25, 2024
@zm711
I don't think my recording equipment maps the probe. As far as I know, the only thing in the recording data are the ch_ids (the ones going from "128" to "151". Those ids were always ordered in ascending way and my contact names such as
mHaT2_1,mHaT2_2... where following the ch_ids since each contact is linked to this specific id.The thing is that before, the contact_names and ids where ordered in a way that each of my contacts where group by probe.
Here is a dataframe representing how I expect things to be ordered :

If I understand correctly what you said above, since the ch_ids are mixed up, I should find for each of my channel, the index where it's corresponding appear in ch_ids and then give this list to
set_global_device_channel_indices()I did that and it changed the group as you can see below :

The issue it that the probes and channel does not correspond to what I expected :
In the example above I sorted by channel names but you can see that the position does not correspond at all to the example I mentionned above.
So I'm a bit confused on how I should proceed, I feel like the mix of channel_ids is not expected and may not be due to my recording system as it was not like that a few weeks ago (at least never noticed and never had problem with it)
Thank you 👍 ,
Cheers,
Anthony
samuelgarcia commentedon Jul 25, 2024
The problem is from NeuralEnsemble/python-neo#1440
We need to add back the sorted(os.listdir) which was important for channel ordering
zm711 commentedon Jul 29, 2024
Is this fixed @Antho2422 ? Can we close?
Antho2422 commentedon Jul 29, 2024
Yes ! It is fixed @zm711 ! Thank you
zm711 commentedon Jul 29, 2024
Great! Closing then :)