Skip to content

Commit 7eec5d4

Browse files
author
adam
committed
Update to fix issues in review by @ramcdougal
1 parent cb5ec30 commit 7eec5d4

2 files changed

Lines changed: 22 additions & 20 deletions

File tree

share/lib/python/neuron/rxd/generalizedReaction.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,29 +379,31 @@ def intersection(los):
379379
] + [areas / volumes[di] / molecules_per_mM_um3 for di in dests_indices]
380380
# TODO: check for multicompartment reaction within the ECS
381381
elif sources_ecs and not dests_ecs:
382+
# only using the first dests_indices for scaling ECS sources
383+
# each dest must be in same location so give the same alpha
382384
self._mult = [
383385
-areas
384386
/ (
385387
numpy.prod(s()._extracellular()._dx)
386-
* s().alpha_by_location(xyz_by_index(di))
388+
* s().alpha_by_location(xyz_by_index(dests_indices[0]))
387389
)
388390
/ molecules_per_mM_um3
389391
for s in sources_ecs
390-
for di in dests_indices
391392
] + [areas / volumes[di] / molecules_per_mM_um3 for di in dests_indices]
392393
elif not sources_ecs and dests_ecs:
394+
# only using the first sources_indices for scaling ECS dests
395+
# each source must be in same location so give the same alpha
393396
self._mult = [
394397
-areas / volumes[si] / molecules_per_mM_um3
395398
for si in sources_indices
396399
] + [
397400
areas
398401
/ (
399402
numpy.prod(s()._extracellular()._dx)
400-
* s().alpha_by_location(xyz_by_index(si))
403+
* s().alpha_by_location(xyz_by_index(sources_indices[0]))
401404
)
402405
/ molecules_per_mM_um3
403406
for s in dests_ecs
404-
for si in sources_indices
405407
]
406408
elif self._trans_membrane:
407409
# An ecs <-> ecs reaction that use the membrane area and intracellular concentration in the rates

test/rxd/test_multicompartment_reactions.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ def test_mcr_multiple_dests(neuron_instance):
9696
the multiplier array for other reactions."""
9797
h, rxd, data, save_path = neuron_instance
9898

99-
dend = h.Section(name="dend")
100-
cyt = rxd.Region(h.allsec(), name="cyt", nrn_region="i")
101-
mem = rxd.Region(h.allsec(), name="cell_mem", geometry=rxd.membrane())
99+
dend = h.Section("dend")
100+
cyt = rxd.Region([dend], name="cyt", nrn_region="i")
101+
mem = rxd.Region([dend], name="cell_mem", geometry=rxd.membrane())
102102
ecs = rxd.Extracellular(-100, -100, -100, 100, 100, 100, dx=100)
103103

104104
a = rxd.Species(
@@ -110,13 +110,13 @@ def test_mcr_multiple_dests(neuron_instance):
110110
ecs_boundary_conditions=140.0,
111111
)
112112
# Extra species for the MCR with multiple ECS destinations
113-
x = rxd.Species([cyt, mem, ecs], name="x", charge=1, d=0, initial=1.0)
114-
y = rxd.Species([cyt, mem, ecs], name="y", charge=1, d=0, initial=2.0)
115-
z = rxd.Species([cyt, mem, ecs], name="z", charge=1, d=0, initial=3.0)
113+
x = rxd.Species([cyt, ecs], name="x", charge=1, d=0, initial=1.0)
114+
y = rxd.Species([cyt, ecs], name="y", charge=1, d=0, initial=2.0)
115+
z = rxd.Species([cyt, ecs], name="z", charge=1, d=0, initial=3.0)
116116

117117
mcr = rxd.MultiCompartmentReaction(
118-
x[cyt],
119-
y[ecs] + z[ecs],
118+
x[cyt] + y[cyt],
119+
y[ecs] + y[ecs] + z[ecs],
120120
10,
121121
mass_action=False,
122122
membrane=mem,
@@ -145,9 +145,9 @@ def test_mcr_multiple_sources(neuron_instance):
145145
multiplier array for other reactions."""
146146

147147
h, rxd, data, save_path = neuron_instance
148-
dend = h.Section(name="dend")
149-
cyt = rxd.Region(h.allsec(), name="cyt", nrn_region="i")
150-
mem = rxd.Region(h.allsec(), name="cell_mem", geometry=rxd.membrane())
148+
dend = h.Section("dend")
149+
cyt = rxd.Region([dend], name="cyt", nrn_region="i")
150+
mem = rxd.Region([dend], name="cell_mem", geometry=rxd.membrane())
151151
ecs = rxd.Extracellular(-100, -100, -100, 100, 100, 100, dx=100)
152152

153153
a = rxd.Species(
@@ -159,13 +159,13 @@ def test_mcr_multiple_sources(neuron_instance):
159159
ecs_boundary_conditions=140.0,
160160
)
161161
# Extra species for the MCR with multiple ECS sources
162-
x = rxd.Species([cyt, mem, ecs], name="x", charge=1, d=0, initial=1.0)
163-
y = rxd.Species([cyt, mem, ecs], name="y", charge=1, d=0, initial=2.0)
164-
z = rxd.Species([cyt, mem, ecs], name="z", charge=1, d=0, initial=3.0)
162+
x = rxd.Species([cyt, ecs], name="x", charge=1, d=0, initial=1.0)
163+
y = rxd.Species([cyt, ecs], name="y", charge=1, d=0, initial=2.0)
164+
z = rxd.Species([cyt, ecs], name="z", charge=1, d=0, initial=3.0)
165165

166166
mcr = rxd.MultiCompartmentReaction(
167-
x[cyt] + y[cyt],
168-
z[ecs],
167+
x[cyt] + y[cyt] + z[cyt],
168+
x[ecs] + y[ecs],
169169
10,
170170
mass_action=False,
171171
membrane=mem,

0 commit comments

Comments
 (0)