Пример #1
0
def addMMPump(dShell, pumpparams, Vmax, surface):
    shellName = ''
    for s in dShell.path.split('[0]'):
        shellName += s
    pump = moose.MMPump(shellName + '_' + pumpparams.Name)

    pump.Vmax = Vmax * surface
    pump.Kd = pumpparams.Kd

    moose.connect(pump, "PumpOut", dShell, "mmPump")
    return pump
Пример #2
0
def test_diffshell():
    lib = moose.Neutral('/library')
    for tick in range(0, 7):
        moose.setClock(tick, dt)
    moose.setClock(8, 0.005)  # set output clock
    model = moose.Neutral('/model')
    dend = moose.Compartment('/model/dend')
    pulse = moose.PulseGen('/model/pulse')
    data = moose.Neutral('/data')
    vmtab = moose.Table('/data/dend_Vm')
    gktab = moose.Table('/data/CaT_Gk')
    iktab = moose.Table('/data/CaT_Ik')

    dend.Cm = Cm
    dend.Rm = Rm
    dend.Em = Em
    dend.initVm = Vm_0
    dend.diameter = dend_diameter
    dend.length = dend_length

    pulse.delay[0] = 8.
    pulse.width[0] = 500e-3
    pulse.level[0] = inject
    pulse.delay[1] = 1e9

    chan = chan_proto.chan_proto('/library/CaL12', param_chan.Cal)
    m = moose.connect(pulse, 'output', dend, 'injectMsg')
    moose.connect(vmtab, 'requestOut', dend, 'getVm')
    chan = addOneChan('CaL12', gbar, dend)
    moose.connect(gktab, 'requestOut', chan, 'getGk')
    moose.connect(iktab, 'requestOut', chan, 'getIk')
    diftab = []
    buftab = []
    difs, difb = add_difshells_and_buffers(dend, difshell_no, difbuff_no)
    if pumps:
        pump = moose.MMPump('/model/dend/pump')
        pump.Vmax = kcat
        pump.Kd = km
        moose.connect(pump, "PumpOut", difs[0], "mmPump")
    if difs:
        moose.connect(chan, "IkOut", difs[0], "influx")
        moose.connect(difs[0], 'concentrationOut', chan, 'concen')

    for i, dif in enumerate(difs):
        res_dif = moose.Table('/data/' + difshell_name + str(i))
        diftab.append(res_dif)
        moose.connect(diftab[i], 'requestOut', dif, 'getC')
        if (difbuff_no):
            buftab.append([])
            for j, buf in enumerate(difb[i]):
                res_buf = moose.Table('/data/' + difshell_name + str(i) + '_' +
                                      difbuff_name + str(j))
                buftab[i].append(res_buf)
                moose.connect(buftab[i][j], 'requestOut', buf, 'getBBound')

    moose.reinit()
    if not gbar:
        for i, dif in enumerate(difs):
            if i == 0:
                dif.C = Ca_initial
            else:
                dif.C = 0
            for j, dbuf in enumerate(difb[i]):
                dbuf.bFree = dbuf.bTot

    moose.start(t_stop)
    t = np.linspace(0, t_stop, len(vmtab.vector))
    fname = 'moose_results_difshell_no_' + str(
        difshell_no) + '_difbuffer_no_' + str(difbuff_no) + '_pump_' + str(
            pumps) + '_gbar_' + str(gbar) + '.txt'
    header = 'time Vm Ik Gk'
    number = 4 + difshell_no * (difbuff_no + 1)
    res = np.zeros((len(t), number))
    res[:, 0] = t
    res[:, 1] = vmtab.vector
    res[:, 2] = iktab.vector
    res[:, 3] = gktab.vector

    for i in range(difshell_no):
        header += ' difshell_' + str(i)
        res[:, 4 + i * (difbuff_no + 1)] = diftab[i].vector
        if (difbuff_no):
            for j, buf in enumerate(buftab[i]):
                res[:, 4 + i * (difbuff_no + 1) + j + 1] = buf.vector
                header += ' difshell_' + str(i) + '_difbuff_' + str(j)
    np.savetxt(fname, res, header=header, comments='')
Пример #3
0
    pulse.delay[0] = 8.
    pulse.width[0] = 500e-3
    pulse.level[0] = inject
    pulse.delay[1] = 1e9

    chan = chan_proto.chan_proto('/library/CaL12',param_chan.Cal)
    m = moose.connect(pulse, 'output', dend, 'injectMsg')
    moose.connect(vmtab, 'requestOut', dend, 'getVm')
    chan = addOneChan('CaL12', gbar, dend)
    moose.connect(gktab, 'requestOut', chan, 'getGk')
    moose.connect(iktab, 'requestOut', chan, 'getIk')
    diftab = []
    buftab = []
    difs, difb = add_difshells_and_buffers(dend,difshell_no,difbuff_no)
    if pumps:
        pump = moose.MMPump('/model/dend/pump')
        pump.Vmax = kcat
        pump.Kd = km
        moose.connect(pump, "PumpOut", difs[0], "mmPump")
    if difs:
        moose.connect(chan, "IkOut", difs[0], "influx")
        moose.connect(difs[0], 'concentrationOut', chan, 'concen')

    for i, dif in enumerate(difs):
        res_dif = moose.Table('/data/' + difshell_name + str(i))
        diftab.append(res_dif)
        moose.connect(diftab[i], 'requestOut', dif, 'getC')
        if (difbuff_no):
            buftab.append([])
            for j, buf in enumerate(difb[i]):
                res_buf = moose.Table(