Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions hnn_core/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,42 @@ def _run_hnn_core_fixture(
return dpls, net

return _run_hnn_core_fixture

@pytest.fixture
def default_params():
"""Load default parameters for the Jones 2009 model."""
hnn_core_root = op.dirname(hnn_core.__file__)
params_fname = op.join(hnn_core_root, "param", "default.json")
return read_params(params_fname)


@pytest.fixture
def network_default(default_params):
"""Default Jones 2009 network with drives."""
return jones_2009_model(default_params, add_drives_from_params=True)


@pytest.fixture
def network_no_drives(default_params):
"""Jones 2009 network without external drives."""
return jones_2009_model(default_params, add_drives_from_params=False)


@pytest.fixture
def network_small(default_params):
"""Small network (1x1 mesh) for faster tests."""
return jones_2009_model(
default_params,
add_drives_from_params=True,
mesh_shape=(1, 1),
)


@pytest.fixture
def network_3x3(default_params):
"""3x3 mesh network used for testing larger network configurations."""
return jones_2009_model(
default_params,
add_drives_from_params=True,
mesh_shape=(3, 3),
)
10 changes: 6 additions & 4 deletions hnn_core/tests/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from numpy.testing import assert_allclose
import pytest
import matplotlib.pyplot as plt
from pathlib import Path

import hnn_core
from hnn_core import (
Expand Down Expand Up @@ -1654,14 +1655,15 @@ def test_rename_cell_types(base_network):
net3.cell_response.plot_spikes_hist(show=False)

# Test the other main network we use for testing
net4 = hnn_core.hnn_io.read_network_configuration(
op.join(hnn_core_root, "tests", "assets", "jones2009_3x3_drives.json")
)
asset_path = Path(__file__).parent / "assets" / "jones2009_3x3_drives.json"

net4 = hnn_core.hnn_io.read_network_configuration(asset_path)

net4._rename_cell_types(cell_type_rename_mapping)
dpls4 = simulate_dipole(net4, tstop=10.0, n_trials=1)
plot_dipole(dpls4, show=False)
net4.cell_response.plot_spikes_raster(
show=False, cell_types=list(cell_type_rename_mapping.values())
show=False, cell_types=list(cell_type_rename_mapping.values())
)
net4.cell_response.plot_spikes_hist(show=False)

Expand Down