Skip to content

Commit

Permalink
Merge pull request #2769 from h-mayorquin/add_template_generation_fun…
Browse files Browse the repository at this point in the history
…ction

Add template `generate_recording_from_template_database`
  • Loading branch information
alejoe91 authored May 1, 2024
2 parents 3c50b34 + 0af5db1 commit d79773d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
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

0 comments on commit d79773d

Please sign in to comment.