-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into cornu/create_logger_class
- Loading branch information
Showing
7 changed files
with
272 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
: capump.mod plus a "reservoir" used to initialize cai to desired concentrations | ||
|
||
UNITS { | ||
(mM) = (milli/liter) | ||
(mA) = (milliamp) | ||
(um) = (micron) | ||
(mol) = (1) | ||
PI = (pi) (1) | ||
FARADAY = (faraday) (coulomb) | ||
} | ||
|
||
NEURON { | ||
SUFFIX capmpr | ||
USEION ca READ cao, cai WRITE cai, ica | ||
GLOBAL k1, k2, k3, k4 | ||
GLOBAL car, tau | ||
} | ||
|
||
STATE { | ||
pump (mol/cm2) | ||
pumpca (mol/cm2) | ||
cai (mM) | ||
} | ||
|
||
PARAMETER { | ||
car = 5e-5 (mM) : ca in reservoir, used to initialize cai to desired concentrations | ||
tau = 1e9 (ms) : rate of equilibration between cai and car | ||
|
||
k1 = 5e8 (/mM-s) | ||
k2 = .25e6 (/s) | ||
k3 = .5e3 (/s) | ||
k4 = 5e0 (/mM-s) | ||
|
||
pumpdens = 3e-14 (mol/cm2) | ||
} | ||
|
||
CONSTANT { | ||
volo = 1 (liter) | ||
} | ||
|
||
ASSIGNED { | ||
diam (um) | ||
cao (mM) | ||
|
||
ica (mA/cm2) | ||
ipump (mA/cm2) | ||
ipump_last (mA/cm2) | ||
voli (um3) | ||
area1 (um2) | ||
c1 (1+8 um5/ms) | ||
c2 (1-10 um2/ms) | ||
c3 (1-10 um2/ms) | ||
c4 (1+8 um5/ms) | ||
} | ||
|
||
BREAKPOINT { | ||
SOLVE pmp METHOD sparse | ||
ipump_last = ipump | ||
ica = ipump | ||
} | ||
|
||
KINETIC pmp { | ||
COMPARTMENT voli {cai} | ||
COMPARTMENT (1e10)*area1 {pump pumpca} | ||
COMPARTMENT volo*(1e15) {cao car} | ||
|
||
~ car <-> cai (1(um3)/tau,1(um3)/tau) | ||
~ cai + pump <-> pumpca (c1,c2) | ||
~ pumpca <-> pump + cao (c3,c4) | ||
|
||
: note that forward flux here is the outward flux | ||
ipump = (1e-4)*2*FARADAY*(f_flux - b_flux)/area1 | ||
|
||
: ipump_last vs ipump needed because of STEADYSTATE calculation | ||
~ cai << (-(ica - ipump_last)*area1/(2*FARADAY)*(1e4)) | ||
|
||
CONSERVE pump + pumpca = (1e10)*area1*pumpdens | ||
} | ||
|
||
INITIAL { | ||
:cylindrical coordinates; actually vol and area1/unit length | ||
voli = PI*(diam/2)^2 * 1(um) | ||
area1 = 2*PI*(diam/2) * 1(um) | ||
c1 = (1e7)*area1 * k1 | ||
c2 = (1e7)*area1 * k2 | ||
c3 = (1e7)*area1 * k3 | ||
c4 = (1e7)*area1 * k4 | ||
|
||
SOLVE pmp STEADYSTATE sparse | ||
} |
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
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,62 @@ | ||
from neuron import h | ||
from neuron.expect_hocerr import expect_err, set_quiet | ||
|
||
set_quiet(0) | ||
from math import isclose | ||
|
||
|
||
def test_nernst(): | ||
assert h.nernst(1, 1, 0) == 0.0 | ||
assert h.nernst(-1, 1, 1) == 1e6 | ||
assert h.nernst(1, -1, 1) == -1e6 | ||
|
||
s = h.Section() | ||
s.insert("hh") | ||
assert isclose(h.nernst("ena", sec=s), 63.55150321937486) | ||
assert isclose(h.nernst("ena", 0.5, sec=s), 63.55150321937486) | ||
assert isclose(h.nernst("nai", sec=s), 17.554820246530547) | ||
assert isclose(h.nernst("nao", sec=s), 79.7501757545304) | ||
expect_err('h.nernst("ina", sec=s)') | ||
|
||
del s | ||
locals() | ||
|
||
|
||
def test_ghk(): | ||
assert isclose(h.ghk(-10, 0.1, 10, 2), -2828.3285716150644) | ||
assert isclose(h.ghk(1e-6, 0.1, 10, 2), -1910.40949510667) | ||
|
||
|
||
def test_ion_style(): | ||
expect_err('h.ion_style("foo")') | ||
|
||
|
||
def test_second_order_cur(): | ||
s = h.Section() | ||
s.insert("hh") | ||
h.secondorder = 2 | ||
h.finitialize(-65) | ||
h.fadvance() | ||
assert isclose(s(0.5).ina, -0.001220053188847315) | ||
h.secondorder = 0 | ||
h.finitialize(-65) | ||
h.fadvance() | ||
assert isclose(s(0.5).ina, -0.0012200571764654333) | ||
|
||
|
||
def test_ion_charge(): | ||
assert h.ion_charge("na_ion") == 1 | ||
expect_err('h.ion_charge("na") == 1') | ||
|
||
|
||
def test_eion_cover(): | ||
test_nernst() | ||
test_ghk() | ||
test_ion_style() | ||
test_second_order_cur() | ||
test_ion_charge() | ||
|
||
|
||
if __name__ == "__main__": | ||
test_eion_cover() | ||
h.topology() |
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