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

Add spike-train based lazy SortingGenerator #2227

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

h-mayorquin
Copy link
Collaborator

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

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
Collaborator

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
Collaborator 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
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
Collaborator Author

Choose a reason for hiding this comment

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

Added.

Copy link
Collaborator 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
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.

None yet

3 participants