From 686d7ee692d99a11e88b04c00fb6ddb9f66f6754 Mon Sep 17 00:00:00 2001 From: Alexander Temerev Date: Mon, 12 Feb 2024 14:44:55 +0100 Subject: [PATCH] Temp file as config in test_config_error --- neurodamus/connection.py | 4 +- tests/integration-e2e/test_connection.py | 20 ++--- .../v5_sonata/simulation_config_err.json | 84 ------------------- 3 files changed, 10 insertions(+), 98 deletions(-) delete mode 100644 tests/simulations/v5_sonata/simulation_config_err.json diff --git a/neurodamus/connection.py b/neurodamus/connection.py index 3016c994f..dda581197 100644 --- a/neurodamus/connection.py +++ b/neurodamus/connection.py @@ -6,7 +6,7 @@ import re from enum import Enum from .core import NeurodamusCore as Nd -from .core.configuration import GlobalConfig, SimConfig +from .core.configuration import GlobalConfig, SimConfig, ConfigurationError from .utils import compat from .utils.logging import log_all from .utils.pyutils import append_recarray @@ -560,7 +560,7 @@ def _update_conductance_ratio(self, syn_obj, is_inhibitory, value): def _configure(self, synapses, configuration): res = self.ConnUtils.executeConfigure(synapses, configuration) if res > 0: - raise ValueError(f"Errors found in configuration: {configuration}") + raise ConfigurationError(f"Errors found in configuration: {configuration}") def _configure_cell(self, cell): """ Internal helper to apply all the configuration statements on diff --git a/tests/integration-e2e/test_connection.py b/tests/integration-e2e/test_connection.py index 8f4fd4c14..a32ab5997 100644 --- a/tests/integration-e2e/test_connection.py +++ b/tests/integration-e2e/test_connection.py @@ -2,6 +2,8 @@ import os import pytest from pathlib import Path + +from neurodamus.core.configuration import ConfigurationError from neurodamus.io.synapse_reader import SynapseParameters from neurodamus.node import Node from tempfile import NamedTemporaryFile @@ -14,11 +16,10 @@ 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" + "name": "config_ERR", + "source": "nodesPopB", + "target": "nodesPopB", + "synapse_configure": "%s.dummy=1" } ]} @@ -53,15 +54,10 @@ def test_add_synapses(): @pytest.mark.slow def test_config_error(sonata_config_file_err): - with pytest.raises(ValueError): - n = Node(str(sonata_config_file_err)) + with pytest.raises(ConfigurationError): + n = Node(str(sonata_config_file_err.name)) n.load_targets() n.create_cells() n.create_synapses() - syn_manager = n.circuits.get_edge_manager("default", "default") - conn = list(syn_manager.get_connections(62798))[0] - new_params = SynapseParameters.create_array(1) - new_params[0].sgid = conn.sgid - conn.add_synapses(n._target_manager, new_params) for syn_manager in n._circuits.all_synapse_managers(): syn_manager.finalize(0, False) diff --git a/tests/simulations/v5_sonata/simulation_config_err.json b/tests/simulations/v5_sonata/simulation_config_err.json deleted file mode 100644 index 41fe5c3b2..000000000 --- a/tests/simulations/v5_sonata/simulation_config_err.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "version": 1, - "manifest": { - "$OUTPUT_DIR": "./", - "$INPUT_DIR": "./" - }, - "node_sets_file": "node_sets.json", - "node_set": "MiniColumn_703", - "target_simulator": "NEURON", - "run": { - "tstart": 0, - "tstop": 40, - "dt": 0.025, - "random_seed": 767740 - }, - "conditions": { - }, - "output": { - "output_dir": "output_sonata" - }, - "connection_overrides": [ - { - "name": "scheme_CaUse_ee", - "source": "Excitatory", - "target": "Excitatory", - "weight": 1.0, - "synapse_configure": "%s.dummy=1 cao_CR_GluSynapse = 1.2 %s.Use_d *= 0.158401372855 %s.Use_p *= 0.158401372855" - } - ], - "inputs": { - "spikeReplay": { - "module": "synapse_replay", - "input_type": "spikes", - "spike_file": "input.dat", - "delay": 0, - "duration": 30000, - "node_set": "Mosaic" - }, - "ThresholdExc": { - "module": "noise", - "input_type": "current_clamp", - "mean_percent": 100.457136089, - "variance": 0.001, - "delay": 0.0, - "duration": 30000, - "node_set": "Excitatory" - }, - "ThresholdInh": { - "module": "noise", - "input_type": "current_clamp", - "mean_percent": 100.457136089, - "variance": 0.001, - "delay": 0.0, - "duration": 30000, - "node_set": "Inhibitory" - }, - "hypamp_mosaic": { - "module": "hyperpolarizing", - "input_type": "current_clamp", - "delay": 0.0, - "duration": 30000, - "node_set": "Mosaic" - } - }, - "reports": { - "soma_report": { - "type": "compartment", - "cells": "Mosaic", - "variable_name": "v", - "dt": 0.1, - "start_time": 0.0, - "end_time": 40.0 - }, - "compartment_report": { - "type": "compartment", - "cells": "Mosaic", - "variable_name": "v", - "sections": "all", - "dt": 0.1, - "start_time": 0.0, - "end_time": 40.0 - } - } -}