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

Use strings as ids in generators #3588

Merged

Conversation

h-mayorquin
Copy link
Collaborator

@h-mayorquin h-mayorquin commented Dec 17, 2024

As discussed in the maintenance meeting of 2024/12/17.

So unless the change was very simple I decided to keep the tests as they were in most of the large integration tests. This is easier to change and is less likely to bring about conflicts when merging this. This was done by renaming the channels from the now default strings to integers.

@h-mayorquin h-mayorquin self-assigned this Dec 17, 2024
Copy link
Member

@alejoe91 alejoe91 left a comment

Choose a reason for hiding this comment

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

@h-mayorquin small comment to avoid using id as a var name

src/spikeinterface/core/generate.py Outdated Show resolved Hide resolved
src/spikeinterface/core/generate.py Outdated Show resolved Hide resolved
@@ -1177,7 +1179,8 @@ def __init__(
self.refractory_period_seconds = np.full(num_units, self.refractory_period_seconds, dtype="float64")

self.segment_seed = seed
self.units_seed = {unit_id: self.segment_seed + hash(unit_id) for unit_id in range(num_units)}
self.units_seed = {unit_id: abs(self.segment_seed + hash(unit_id)) for unit_id in unit_ids}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.units_seed = {unit_id: abs(self.segment_seed + hash(unit_id)) for unit_id in unit_ids}
self.units_seed = {unit_id: self.segment_seed + abs(hash(unit_id)) for unit_id in unit_ids}

@samuelgarcia
Copy link
Member

I am OK with this.

@alejoe91 alejoe91 added the generators Related to generator tools label Jan 7, 2025
@alejoe91 alejoe91 merged commit d38dbf4 into SpikeInterface:main Jan 7, 2025
15 checks passed
@h-mayorquin h-mayorquin deleted the use_strings_as_ids_in_generators branch January 7, 2025 15:47
@h-mayorquin
Copy link
Collaborator Author

Thanks for the review, guys.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generators Related to generator tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants