From 321553b63bd4229d964defc20ccfcd53b94a5ec8 Mon Sep 17 00:00:00 2001 From: Michael Deistler Date: Thu, 9 Nov 2023 10:38:11 +0100 Subject: [PATCH] All tests pass --- tests/neurax_identical/test_swc.py | 10 +++++++--- tests/neurax_vs_neuron/test_cell.py | 5 +++-- tests/neurax_vs_neuron/test_comp.py | 1 - tests/test_swc.py | 10 ++++++---- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/tests/neurax_identical/test_swc.py b/tests/neurax_identical/test_swc.py index 3d748735..5dd5d0d8 100644 --- a/tests/neurax_identical/test_swc.py +++ b/tests/neurax_identical/test_swc.py @@ -20,7 +20,9 @@ def test_swc_cell(): t_max = 5.0 # ms current = nx.step_current(0.5, 1.0, 0.2, dt, t_max) - cell = nx.read_swc("../morph.swc", nseg=2, max_branch_len=300.0) + dirname = os.path.dirname(__file__) + fname = os.path.join(dirname, "../morph.swc") + cell = nx.read_swc(fname, nseg=2, max_branch_len=300.0) cell.insert(HHChannel()) cell.branch(1).comp(0.0).record() cell.branch(1).comp(0.0).stimulate(current) @@ -54,8 +56,10 @@ def test_swc_net(): t_max = 5.0 # ms current = nx.step_current(0.5, 1.0, 0.2, dt, t_max) - cell1 = nx.read_swc("../morph.swc", nseg=2, max_branch_len=300.0) - cell2 = nx.read_swc("../morph.swc", nseg=2, max_branch_len=300.0) + dirname = os.path.dirname(__file__) + fname = os.path.join(dirname, "../morph.swc") + cell1 = nx.read_swc(fname, nseg=2, max_branch_len=300.0) + cell2 = nx.read_swc(fname, nseg=2, max_branch_len=300.0) connectivities = [ nx.Connectivity(GlutamateSynapse(), [nx.Connection(0, 0, 0.0, 1, 0, 0.0)]) diff --git a/tests/neurax_vs_neuron/test_cell.py b/tests/neurax_vs_neuron/test_cell.py index 4a865c13..ee421f77 100644 --- a/tests/neurax_vs_neuron/test_cell.py +++ b/tests/neurax_vs_neuron/test_cell.py @@ -35,7 +35,6 @@ def test_similarity(): def _run_neurax(i_delay, i_dur, i_amp, dt, t_max): - nseg_per_branch = 8 comp = nx.Compartment().initialize() branch = nx.Branch([comp for _ in range(nseg_per_branch)]).initialize() @@ -54,7 +53,9 @@ def _run_neurax(i_delay, i_dur, i_amp, dt, t_max): cell.set_states("n", 0.3644787002343737) cell.set_states("voltages", -62.0) - cell.branch(0).comp(0.0).stimulate(nx.step_current(i_delay, i_dur, i_amp, dt, t_max)) + cell.branch(0).comp(0.0).stimulate( + nx.step_current(i_delay, i_dur, i_amp, dt, t_max) + ) cell.branch(0).comp(0.0).record() cell.branch(1).comp(1.0).record() cell.branch(2).comp(1.0).record() diff --git a/tests/neurax_vs_neuron/test_comp.py b/tests/neurax_vs_neuron/test_comp.py index e963b667..e539d50e 100644 --- a/tests/neurax_vs_neuron/test_comp.py +++ b/tests/neurax_vs_neuron/test_comp.py @@ -35,7 +35,6 @@ def test_similarity(): def _run_neurax(i_delay, i_dur, i_amp, dt, t_max): - comp = nx.Compartment().initialize() comp.insert(HHChannel()) diff --git a/tests/test_swc.py b/tests/test_swc.py index 9765d464..0a50f6df 100644 --- a/tests/test_swc.py +++ b/tests/test_swc.py @@ -18,7 +18,8 @@ def test_swc_reader_lengths(): - fname = "morph.swc" + dirname = os.path.dirname(__file__) + fname = os.path.join(dirname, "morph.swc") _, pathlengths, _, _ = nx.utils.swc.swc_to_neurax(fname, max_branch_len=2000.0) pathlengths = np.asarray(pathlengths)[1:] @@ -56,7 +57,8 @@ def test_swc_radius(): range_16 = np.linspace(non_split / 2, 1 - non_split / 2, nseg) # Can not use full morphology because of branch sorting. - fname = "morph_250.swc" + dirname = os.path.dirname(__file__) + fname = os.path.join(dirname, "morph_250.swc") _, pathlen, radius_fns, _ = nx.utils.swc.swc_to_neurax( fname, max_branch_len=2000.0, sort=False @@ -100,8 +102,8 @@ def test_swc_voltages(): It tests whether, on average over time and recordings, the voltage is off by less than 1.5 mV. """ - - fname = "morph.swc" # n120 + dirname = os.path.dirname(__file__) + fname = os.path.join(dirname, "morph.swc") # n120 i_delay = 2.0 i_dur = 5.0