-
Notifications
You must be signed in to change notification settings - Fork 164
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
Tools for Generation of Hybrid recordings #2436
base: main
Are you sure you want to change the base?
Conversation
for more information, see https://pre-commit.ci
…rface into hybrid_raw_clustering
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
This PR depends on #2410 |
…e into hybrid_raw_clustering
…hybrid_raw_clustering
Added additional functionalities for hybrid generations:
Also extended the |
…e into hybrid_raw_clustering
@samuelgarcia @yger since I was working on it, I also added a Widen/Narrow option and scalebars for Screencast.from.14-05-2024.12.39.14.webmThis is ready to merge on my side! |
else: | ||
template_info = fetch_templates_info().iloc[template_df_or_indices] | ||
requested_datasets = np.unique(template_info["dataset"]).tolist() | ||
print(f"Fetching templates from {len(requested_datasets)} datasets") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a dreaded verbose option here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep! should be safe here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can add those things after the PR is merged as well : )
s3_path = f"s3://spikeinterface-template-database/{dataset}/" | ||
zarr_group = zarr.open_consolidated(s3_path, storage_options={"anon": True}) | ||
|
||
templates_object = Templates.from_zarr_group(zarr_group) | ||
|
||
return templates_object | ||
|
||
|
||
def fetch_templates_info() -> "pandas.DataFrame": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def fetch_templates_info() -> "pandas.DataFrame": | |
import functools | |
@functools.cache | |
def fetch_templates_info() -> "pandas.DataFrame": |
https://docs.python.org/3/library/functools.html#functools.cache
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, this will fail if people still use python 3.8 : /
We can use functools.lru_cache(maxsize=1)
instead if you want to support that but I would rather move forward to the bright future of python 3. 9 as minimal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes let's do that for the sorting analyzer release
|
||
|
||
def fetch_templates_from_database(dataset="test_templates.zarr") -> Templates: | ||
def fetch_template_dataset(dataset="test_templates.zarr") -> Templates: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def fetch_template_dataset(dataset="test_templates.zarr") -> Templates: | |
@functools.cache | |
def fetch_template_dataset(dataset="test_templates.zarr") -> Templates: |
import zarr | ||
import numpy as np | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import functools |
channel_locations = sorting_analyzer.get_channel_locations()[ | ||
sorting_analyzer.channel_ids_to_indices(channel_ids) | ||
] | ||
unit_colors = get_unit_colors(unit_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use get_some_colors
and revert signature
For the hybrid project, make a function that can get Templates from any recording. To be discussed, as some features to play/interact with Templates are currently only written for WaveformExtactor and might need to be duplicated