Skip to content

Commit

Permalink
All tests pass
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldeistler committed Nov 9, 2023
1 parent 9f7d191 commit 5b21e8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 7 additions & 3 deletions tests/neurax_identical/test_swc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)])
Expand Down
11 changes: 6 additions & 5 deletions tests/test_swc.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
jax.config.update("jax_platform_name", "cpu")

import os

os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"] = ".8"

import numpy as np
Expand All @@ -18,7 +17,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:]
Expand Down Expand Up @@ -56,7 +56,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
Expand Down Expand Up @@ -100,8 +101,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
Expand Down

0 comments on commit 5b21e8e

Please sign in to comment.