-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
set(NMODL_USECASE_DIRS leonhard) | ||
|
||
foreach(usecase ${NMODL_USECASE_DIRS}) | ||
add_test(NAME usecase_${usecase} | ||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_test.sh ${CMAKE_BINARY_DIR}/bin/nmodl | ||
${CMAKE_CURRENT_SOURCE_DIR}/${usecase}) | ||
endforeach() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
NEURON { | ||
SUFFIX leonhard | ||
} | ||
|
||
STATE { x } | ||
|
||
INITIAL { | ||
x = 42 | ||
} | ||
|
||
BREAKPOINT { | ||
SOLVE dX METHOD cnexp | ||
} | ||
|
||
DERIVATIVE dX { x' = -x } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import os | ||
|
||
print(f"{os.environ['NEURON_MODULE_OPTIONS'] = }") | ||
|
||
import numpy as np | ||
|
||
from neuron import h, gui | ||
from neuron.units import ms | ||
|
||
nseg = 1 | ||
|
||
s = h.Section() | ||
s.insert("leonhard") | ||
s.nseg = nseg | ||
|
||
x_hoc = h.Vector().record(s(0.5)._ref_x_leonhard) | ||
t_hoc = h.Vector().record(h._ref_t) | ||
|
||
h.stdinit() | ||
h.tstop = 5.0 * ms | ||
h.run() | ||
|
||
x = np.array(x_hoc.as_numpy()) | ||
t = np.array(t_hoc.as_numpy()) | ||
|
||
x0 = 42.0 | ||
x_exact = 42.0 * np.exp(-t) | ||
rel_err = np.abs(x - x_exact) / x_exact | ||
|
||
assert np.all(rel_err < 1e-12) | ||
print("leonhard: success") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#! /usr/bin/env bash | ||
set -e | ||
|
||
nmodl="$1" | ||
usecase_dir="$2" | ||
|
||
pushd "${usecase_dir}" | ||
|
||
rm -r x86_64 tmp || true | ||
|
||
nrnivmodl -nmodl "${nmodl}" | ||
x86_64/special simulate.py | ||
|
||
popd |