Skip to content

Add spike-train based lazy SortingGenerator - #2227

Merged
alejoe91 merged 7 commits into
SpikeInterface:mainfrom
h-mayorquin:add_sorting_generator
Sep 25, 2024
Merged

alejoe91 merged 7 commits into
SpikeInterface:mainfrom
h-mayorquin:add_sorting_generator

Conversation

@h-mayorquin

@h-mayorquin h-mayorquin commented Nov 18, 2023 •

Copy link
Copy Markdown
Contributor

While discussing in #2175 and #2209 and the other PR that is now I realized that we don't have a way of tesing lazy recorders performance.

Currently, generate_sorting alredy pre-loads the data as a numpy array which means that we can't test how performancer or other IO operations would behave in different scenarios.

This PR aims to fix that by introduces a new sorter that generates spikes on the fly in a reproducible way. Plus, it behaves consistency across calls and by slicing across spikes.

The max memory it should use is the complete size of its longest spike train.

@h-mayorquin h-mayorquin added core Changes to core module testing Related to test routines labels Nov 18, 2023
@h-mayorquin
h-mayorquin marked this pull request as ready for review November 18, 2023 14:47
@h-mayorquin h-mayorquin self-assigned this Nov 18, 2023
refractory_period_ms: float | np.ndarray = 4.0, # in ms
seed: Optional[int] = None,
):
unit_ids = np.arange(num_units)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Will we have a docstring for this? For example you have durations as a list of 2 floats for 2 segments, so for future users it might be beneficial for them to know that the len(durations)==n_segments. And what are the implications of giving one firing rate vs an array of firing rates if I as a user try something like this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, we should. The duration thing is a very pervasive in a bunch of functions we should document it. Less pevasive but not exclusive to this one is the firing rates as an array or float.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@h-mayorquin can you add a docstring here? Maybe explaining the difference with the generate_sorting

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I also corrected a typo of refactory to refractory

@alejoe91 alejoe91 changed the title Add Lazy Sorting Generator Add spike-train based lazy SortingGenerator Jan 12, 2024
@h-mayorquin

Copy link
Copy Markdown
Contributor Author

Hey guys @alejoe91 @samuelgarcia . I want to do some performance testing and I would like to compare dictionary vs the numpy approach. What do we need to move this forward?

@alejoe91

alejoe91 commented Sep 9, 2024

Copy link
Copy Markdown
Member

@h-mayorquin this is ok to merge for me!! It would be great for perfomrmance testing :)

Comment thread src/spikeinterface/core/generate.py Resolved
@samuelgarcia

Copy link
Copy Markdown
Member

Thank you Ramon, every thing is perfect except a very small detail.
10 month before a merge is good perf. sorry.

@alejoe91
alejoe91 merged commit b2ea8c5 into SpikeInterface:main Sep 25, 2024
@h-mayorquin
h-mayorquin deleted the add_sorting_generator branch October 8, 2024 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Changes to core module testing Related to test routines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants