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 template generate_recording_from_template_database #2769

Merged
4 changes: 4 additions & 0 deletions src/spikeinterface/generation/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
generate_displacement_vector,
generate_drifting_recording,
)

from .template_database import (
fetch_templates_from_database,
)
12 changes: 12 additions & 0 deletions src/spikeinterface/generation/template_database.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from spikeinterface.core.template import Templates
import zarr


def fetch_templates_from_database(dataset="test_templates") -> Templates:

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
13 changes: 13 additions & 0 deletions src/spikeinterface/generation/tests/test_template_fetch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest
from spikeinterface.generation import fetch_templates_from_database
from spikeinterface.core.template import Templates


def test_basic_call():

templates = fetch_templates_from_database()

assert isinstance(templates, Templates)

assert templates.num_units == 100
assert templates.num_channels == 384
Loading