Пример #1
0
from neuron import h, rxd
from neuron.units import mV, ms

h.load_file("stdrun.hoc")

soma = h.Section(name="soma")
soma.diam = soma.L = 10

# the geometry of the ecs doesn't matter in the constant case
ecs = rxd.Region([soma], name="ecs", nrn_region="o", geometry=rxd.Shell(1, 2))
cyt = rxd.Region([soma], name="cyt", nrn_region="i")
mem = rxd.Region([soma], name="mem", geometry=rxd.membrane())

cao = rxd.Parameter(ecs, charge=2)

ca = rxd.Species(
    [cyt],
    d=1,  # with single section and nseg=1 only affects extracellular
    name="ca",
    charge=2,
    initial=lambda node: 1e-3 if node.region == cyt else 0,
)

e = 1.60217662e-19
scale = 1e-14 / e

# rate constant is in terms of molecules/um2 ms
ca_pump = rxd.MultiCompartmentReaction(
    ca[cyt],
    cao[ecs],
    ca[cyt] * scale,
Пример #2
0
    def __init__(self, x, y, z, rec=False):
        self.x = x
        self.y = y
        self.z = z

        self.soma = h.Section(name="soma", cell=self)
        # add 3D points to locate the neuron in the ECS
        self.soma.pt3dadd(x, y, z + somaR, 2.0 * somaR)
        self.soma.pt3dadd(x, y, z - somaR, 2.0 * somaR)

        # Where? -- define the intracellular space and membrane
        self.cyt = rxd.Region(self.soma, name="cyt", nrn_region="i")
        self.mem = rxd.Region(self.soma, name="mem", geometry=rxd.membrane())
        cell = [self.cyt, self.mem]

        # Who? -- the relevant ions and gates
        self.k = rxd.Species(cell, name="k", d=2.62, charge=1, initial=125)
        self.na = rxd.Species(cell, name="na", d=1.78, charge=1, initial=10)
        self.n = rxd.State(cell, name="n", initial=0.25512)
        self.ki, self.nai = self.k[self.cyt], self.na[self.cyt]

        # What? -- gating variables and ion currents
        self.n_gate = rxd.Rate(self.n, phin * (ninf - self.n) / taun)

        # Nernst potentials
        ena = 1e3 * h.R * (h.celsius + 273.15) * log(
            nao / self.nai) / h.FARADAY
        ek = 1e3 * h.R * (h.celsius + 273.15) * log(ko / self.ki) / h.FARADAY

        # Persistent Na current
        self.nap_current = rxd.MultiCompartmentReaction(
            self.nai,
            nao,
            gnap * nap_minf * nap_hinf * (v - ena),
            mass_action=False,
            membrane=self.mem,
            membrane_flux=True,
        )
        # Na current
        self.na_current = rxd.MultiCompartmentReaction(
            self.nai,
            nao,
            gna * minf**3 * (1.0 - self.n) * (v - ena),
            mass_action=False,
            membrane=self.mem,
            membrane_flux=True,
        )
        # K current
        self.k_current = rxd.MultiCompartmentReaction(
            self.ki,
            ko,
            gk * self.n**4 * (v - ek),
            mass_action=False,
            membrane=self.mem,
            membrane_flux=True,
        )
        # K leak
        self.k_leak = rxd.MultiCompartmentReaction(
            self.ki,
            ko,
            gl * (v - ek),
            mass_action=False,
            membrane=self.mem,
            membrane_flux=True,
        )
        # passive leak
        self.soma.insert("pas")
        self.soma(0.5).pas.g = pas_gl
        self.soma(0.5).pas.e = pas_el

        if rec:  # record membrane potential (shown in figure 1C)
            self.somaV = h.Vector()
            self.somaV.record(self.soma(0.5)._ref_v, rec)
Пример #3
0
# ki = 125 ko = 2.9

# In[6]:


def concentration(i, o):
    return lambda nd: i if isinstance(nd, rxd.node.Node1D) else o


# In[7]:

# REGIONS------------------------------------------------------------------------------------------------------------------------

# intracellular/extracellular regions
cyt = rxd.Region(soma, name="cyt", nrn_region="i")
mem = rxd.Region(soma, name="cell_mem", geometry=rxd.membrane())
gcyt = rxd.Region(glia, name="cyt", nrn_region="i")
gmem = rxd.Region(glia, name="cell_mem", geometry=rxd.membrane())
dx = vo**(1.0 / 3.0)
ecs = rxd.Extracellular(-2 * dx,
                        -2 * dx,
                        -2 * dx,
                        2 * dx,
                        2 * dx,
                        2 * dx,
                        dx=dx)
# ecs = rxd.Extracellular(-100, -100, -100, 100, 100, 100, dx=33)
# SPECIES/PARAMETERS------------------------------------------------------------------------------------------------------------------------

# intracellular/extracellular species (Na+, K+, Cl-)
na = rxd.Species([cyt, mem, ecs],
Пример #4
0
import matplotlib.pyplot as plt
from neuron import h, rxd
from neuron.units import mV, ms
h.load_file('stdrun.hoc')

soma = h.Section(name='soma')
soma.diam = soma.L = 10

ecs = rxd.Extracellular(-20, -20, -20, 20, 20, 20, dx=10)
cyt = rxd.Region([soma], name='cyt', nrn_region='i')
mem = rxd.Region([soma], name='mem', geometry=rxd.membrane())

ca = rxd.Species([cyt, ecs],
                 d=1,  # with single section and nseg=1 only affects extracellular
                 name='ca',
                 charge=2,
                 initial=lambda node: 1e-3 if node.region==cyt else 0)

e = 1.60217662e-19
scale = 1e-14 / e

# rate constant is in terms of molecules/um2 ms
ca_pump = rxd.MultiCompartmentReaction(ca[cyt], ca[ecs], ca[cyt] * scale,
                                       custom_dynamics=True,
                                       membrane_flux=True,
                                       membrane=mem)

t = h.Vector().record(h._ref_t)
ca_vec = h.Vector().record(soma(0.5)._ref_cai)
ca_vec2 = h.Vector().record(ca[ecs].node_by_location(5, 0, 0)._ref_value)
v = h.Vector().record(soma(0.5)._ref_v)