2024-07-31 08:13:31 +00:00
|
|
|
from typing import Tuple, TYPE_CHECKING
|
|
|
|
from types import ModuleType
|
2024-07-29 23:28:48 +00:00
|
|
|
|
2024-07-29 23:22:29 +00:00
|
|
|
import numpy as np
|
2024-07-29 23:28:48 +00:00
|
|
|
import pytest
|
|
|
|
|
2024-07-31 08:13:31 +00:00
|
|
|
# FIXME: Make this just be the output of the provider by patching into import machinery
|
2024-07-29 23:28:48 +00:00
|
|
|
from nwb_linkml.models.pydantic.core.v2_7_0.namespace import (
|
|
|
|
ElectricalSeries,
|
2024-07-31 08:13:31 +00:00
|
|
|
ElectrodeGroup,
|
2024-07-29 23:28:48 +00:00
|
|
|
NWBFileGeneralExtracellularEphysElectrodes,
|
|
|
|
)
|
2024-07-29 23:22:29 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture()
|
2024-07-31 08:13:31 +00:00
|
|
|
def electrical_series() -> Tuple["ElectricalSeries", "NWBFileGeneralExtracellularEphysElectrodes"]:
|
2024-07-29 23:22:29 +00:00
|
|
|
"""
|
|
|
|
Demo electrical series with adjoining electrodes
|
|
|
|
"""
|
|
|
|
n_electrodes = 5
|
|
|
|
n_times = 100
|
2024-07-29 23:28:48 +00:00
|
|
|
data = np.arange(0, n_electrodes * n_times).reshape(n_times, n_electrodes)
|
2024-07-29 23:22:29 +00:00
|
|
|
timestamps = np.linspace(0, 1, n_times)
|
|
|
|
|
2024-07-31 08:13:31 +00:00
|
|
|
# electrode group is the physical description of the electrodes
|
|
|
|
electrode_group = ElectrodeGroup(
|
|
|
|
name="GroupA",
|
|
|
|
)
|
|
|
|
|
2024-07-29 23:22:29 +00:00
|
|
|
# make electrodes tables
|
|
|
|
electrodes = NWBFileGeneralExtracellularEphysElectrodes(
|
2024-07-29 23:28:48 +00:00
|
|
|
id=np.arange(0, n_electrodes),
|
|
|
|
x=np.arange(0, n_electrodes),
|
|
|
|
y=np.arange(n_electrodes, n_electrodes * 2),
|
2024-07-31 08:17:39 +00:00
|
|
|
group=[electrode_group] * n_electrodes,
|
2024-07-29 23:28:48 +00:00
|
|
|
)
|