Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
atemerev committed Feb 12, 2024
1 parent 05d1ceb commit 97ac38a
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
6 changes: 3 additions & 3 deletions neurodamus/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ def _update_conductance_ratio(self, syn_obj, is_inhibitory, value):
else:
syn_obj.NMDA_ratio = value

def _configure_hoc(self, synapses, configuration):
def _configure(self, synapses, configuration):
res = self.ConnUtils.executeConfigure(synapses, configuration)
if res > 0:
raise ValueError(f"Errors found in configuration: {configuration}")
Expand All @@ -567,7 +567,7 @@ def _configure_cell(self, cell):
a given cell synapses
"""
for config in self._configurations:
self._configure_hoc(cell.CellRef.synlist, config)
self._configure(cell.CellRef.synlist, config)

def _configure_synapses(self):
""" Internal helper to apply all the configuration statements to
Expand All @@ -580,7 +580,7 @@ def configure_synapses(self, configuration):
""" Helper function to execute a configuration statement (hoc)
on all connection synapses.
"""
self._configure_hoc(self._synapses, configuration)
self._configure(self._synapses, configuration)

def restart_events(self):
"""Restart the artificial events, coming from Replay or Spont-Minis"""
Expand Down
30 changes: 26 additions & 4 deletions tests/integration-e2e/test_connection.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
import json
import os
import pytest
from pathlib import Path
from neurodamus.io.synapse_reader import SynapseParameters
from neurodamus.node import Node

from tempfile import NamedTemporaryFile

SIM_DIR = Path(__file__).parent.parent.absolute() / "simulations" / "v5_sonata"
CONFIG_FILE_MINI = SIM_DIR / "simulation_config_mini.json"
CONFIG_FILE_ERR = SIM_DIR / "simulation_config_err.json"


@pytest.fixture
def sonata_config_file_err(sonata_config):
extra_config = {"connection_overrides": [
{
"name": "scheme_CaUse_ee_ERR",
"source": "Excitatory",
"target": "Excitatory",
"weight": 1.0,
"synapse_configure": "%s.dummy=1 cao_CR_GluSynapse = 1.2 %s.Use_d *= 0.158401372855"
}
]}

sonata_config.update(extra_config)

with NamedTemporaryFile("w", suffix='.json', delete=False) as config_file:
json.dump(sonata_config, config_file)

yield config_file
os.unlink(config_file.name)


@pytest.mark.slow
Expand All @@ -30,9 +52,9 @@ def test_add_synapses():


@pytest.mark.slow
def test_hoc_config_error():
def test_config_error(sonata_config_file_err):
with pytest.raises(ValueError):
n = Node(str(CONFIG_FILE_ERR))
n = Node(str(sonata_config_file_err))
n.load_targets()
n.create_cells()
n.create_synapses()
Expand Down

0 comments on commit 97ac38a

Please sign in to comment.