Skip to content

Conversation

@letiziasignorelli
Copy link

I'm proposing this PR to fix #1454

@zm711

Copy link
Contributor

@zm711 zm711 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty good to me. The failing test seems to be a ci issue and not related to this PR so I'll try to figure that out. Let me know what you think about the comments :)

cntr = (itetr * elec_per_tetrode) + ielec
ch_name = f"{itetr + 1}{letters[ielec]}"
cntr = (itetr * elec_per_tetrode) + ielec + first_channel
ch_name = "{}{}".format(itetr + active_tetrode_set[0], letters[ielec])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ch_name = "{}{}".format(itetr + active_tetrode_set[0], letters[ielec])
ch_name = f"{itetr + active_tetrode_set[0]}{letters[ielec]}"

we try to keep the codebase on f-strings since they are faster and easier to read :)

active_tetrodes.append(tetrode_id)
return active_tetrodes

def get_active_channels(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public or private? what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I advice to make things private by default and move away from it when you have a good reason to.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how I was leaning too. I don't see why the user would run this function.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree with making them private

chan = self._get_channel_from_tetrode(tetrode)
active_channels.append(chan)

return np.concatenate(active_channels)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the benefit of concat? I need to doublecheck what is chan is it a list of all channels from a tetrode. If that is the case I would call it channels or chans instead so we know it's plural.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, chan is a list of all channels from a tetrode, so I agree to call it channels or chans.

Since I was using this function only for the _get_analogsignal_chunk function and it needed the list of active channels as an array I returned directly active_channels as an array. But we can also do it in _get_analogsignal_chunk and keep this function consistent with get_active_tetrodes and return directly active_channels

@zm711
Copy link
Contributor

zm711 commented Aug 5, 2024

@alejoe91 do you know this datalad error? it only happened for one dataset on the 3.9 python vs the 3.11 python runs. It's completely unrelated to this PR, but if you recognize the issue then I won't spend time digging into it.

@zm711 zm711 added this to the 0.14.0 milestone Aug 5, 2024
@alejoe91
Copy link
Contributor

alejoe91 commented Aug 5, 2024

@zm711 maybe just a random failure, re-triggered to see what happens!

@zm711
Copy link
Contributor

zm711 commented Aug 5, 2024

I tried retriggering once, but yeah let's see if maybe it was just a timing issue.

EDIT; --Yep okay just a random ci failure. cool cool

@h-mayorquin
Copy link
Contributor

Gin data for this? : O

@zm711
Copy link
Contributor

zm711 commented Aug 23, 2024

Gin data for this? : O

You mean you want extra gin data? This was a bug in the original implementation just because we didn't know which channel was which. If you use the current gin data with the spikeinterface extractor you'll see that the channels are just 1-16 or 1-32 rather than being meaningful.

@h-mayorquin
Copy link
Contributor

Thanks. I did not realize we already had the gin data as I came from the neuroconv trail.

@zm711
Copy link
Contributor

zm711 commented Dec 2, 2024

@letiziasignorelli just wanted to see if you'd have bandwidth to work on this before the end of the year :) ? Otherwise I'll change the tag to future for now so that we just let you get back to it when you want....

@letiziasignorelli
Copy link
Author

@zm711 I replied to all comments, and from my side I was just waiting for approval :). Is there anything I should still work on/change?

@zm711
Copy link
Contributor

zm711 commented Dec 2, 2024

Did you forget to push the changes? I don't see any of the changes--(I see your comments, but not a commit where you have the changes). Once they are pushed here then the last thing is just resolving the conflict in the author doc :)

@letiziasignorelli
Copy link
Author

Okok you're right, I'll push the changes in the next few days. Thanks :)

elif isinstance(channel_indexes, slice):
channel_indexes_all = [i for i in range(bin_dict["num_channels"])]
channel_indexes = channel_indexes_all[channel_indexes]
channel_indexes = self._get_active_channels()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@h-mayorquin do you want to doublecheck this. I'm just re-reading and I'm thinking of the case of a channel slice so would love another pair of eyes on the logic here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused on why this function does not take any input, I would expect this to use the slice (channel_indexes) that it was passed?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@h-mayorquin it was this part of the code which you indicated your confusion and I too wasn't completely sure.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems OK to me. I re-read and it is just that they are getting it from the class attributes

@samuelgarcia
Copy link
Contributor

Hi @letiziasignorelli.
Thanks for this.
Sorry the ultra lon delay.
I will read it more carrfully, I am not sure to follow entirely the logic.
Give me another read.

@zm711
Copy link
Contributor

zm711 commented Jan 6, 2025

@samuelgarcia just so you know the background (although I really appreciate the extra read :))

In our original implementation we were just giving the channels arbitrary names like range(0,32) when in fact the channels have actual names depending on which tetrode they are (so it should be something like A1, A2, A3, A4, B1, B2, B3, B4 instead of 0,1,2,3,4,5,6,7,8.

But I'm just trying to make sure the slicing of channels when some aren't turned on will be correct.

@alejoe91 alejoe91 modified the milestones: 0.14.0, 0.15.0 Jan 17, 2025
@h-mayorquin
Copy link
Contributor

Maybe we should merge this? It's been six months.

@zm711
Copy link
Contributor

zm711 commented Jun 18, 2025

Let's ping Sam for tomorrow and if he doesn't respond then I can fix the merge conflict. You want to give this one more careful read to make sure you understand the slicing logic?

@h-mayorquin
Copy link
Contributor

I remember reading it back then. I can take a second look if you pint-point the specific part that you don't feel confident about.

@samuelgarcia
Copy link
Contributor

OK lets merge.

@zm711 zm711 merged commit 73b5151 into NeuralEnsemble:master Jun 19, 2025
5 checks passed
@zm711
Copy link
Contributor

zm711 commented Jun 19, 2025

Thanks @letiziasignorelli and sorry for the delay!

@zm711 zm711 modified the milestones: 0.15.0, 0.14.2 Jun 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Electrode selection in Axona raw recording

5 participants