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 321553b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 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
5 changes: 3 additions & 2 deletions tests/neurax_vs_neuron/test_cell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
Expand Down
1 change: 0 additions & 1 deletion tests/neurax_vs_neuron/test_comp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())

Expand Down
10 changes: 6 additions & 4 deletions tests/test_swc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:]
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 321553b

Please sign in to comment.