-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve usecases 'func_proc{,_pnt}'. (#1182)
Check that if there's multiple instances of the mechanisms the functions and procedures use the values for the correct instance.
- Loading branch information
Showing
5 changed files
with
36 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
from neuron import h | ||
|
||
nseg = 5 | ||
s = h.Section() | ||
s.nseg = nseg | ||
|
||
s.insert("test_func_proc") | ||
|
||
s(0.5).test_func_proc.set_x_42() | ||
coords = [(0.5 + k) * 1.0 / nseg for k in range(nseg)] | ||
values = [ 0.1 + k for k in range(nseg)] | ||
|
||
assert s(0.5).test_func_proc.x == 42 | ||
for x in coords: | ||
s(x).test_func_proc.set_x_42() | ||
assert s(x).test_func_proc.x == 42 | ||
|
||
s(0.5).test_func_proc.set_x_a(13.7) | ||
for x, value in zip(coords, values): | ||
s(x).test_func_proc.set_x_a(value) | ||
|
||
assert s(0.5).test_func_proc.x == 13.7 | ||
for x, value in zip(coords, values): | ||
assert s(x).test_func_proc.x == value | ||
|
||
assert s(0.5).test_func_proc.get_a_42(42) == 84 | ||
for x, value in zip(coords, values): | ||
assert s(x).test_func_proc.x_plus_a(100.0) == 100.0 + value |
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 |
---|---|---|
@@ -1,15 +1,27 @@ | ||
from neuron import h | ||
|
||
nseg = 5 | ||
s = h.Section() | ||
s.nseg = nseg | ||
|
||
pnt_proc = h.test_func_proc_pnt(s(0.5)) | ||
point_processes = [] | ||
for k in range(nseg): | ||
x = (0.5 + k) * 1.0 / nseg | ||
point_processes.append(h.test_func_proc_pnt(s(x))) | ||
|
||
pnt_proc.set_x_42() | ||
for k in range(nseg): | ||
point_processes[k].set_x_42() | ||
|
||
assert pnt_proc.x == 42 | ||
for k in range(nseg): | ||
assert point_processes[k].x == 42 | ||
|
||
pnt_proc.set_x_a(13.7) | ||
for k in range(nseg): | ||
value = 0.1 + k | ||
point_processes[k].set_x_a(value) | ||
|
||
assert pnt_proc.x == 13.7 | ||
for k in range(nseg): | ||
value = 0.1 + k | ||
assert point_processes[k].x == value | ||
assert point_processes[k].x_plus_a(1000.0) == 1000.0 + value | ||
|
||
assert pnt_proc.get_a_42(42) == 84 | ||
print([point_processes[k].x for k in range(nseg)]) |
Submodule references
updated
4 files
+5 −5 | func_proc/coreneuron/func_proc.cpp | |
+17 −14 | func_proc/neuron/func_proc.cpp | |
+5 −5 | func_proc_pnt/coreneuron/func_proc_pnt.cpp | |
+9 −9 | func_proc_pnt/neuron/func_proc_pnt.cpp |