Exemplo n.º 1
0
def run_single_channel(channelname, Gbar, simtime, simdt=testutils.SIMDT, plotdt=testutils.PLOTDT):
    testId = uuid.uuid4().int
    container = moose.Neutral('test%d' % (testId))
    model_container = moose.Neutral('%s/model' % (container.path))
    data_container = moose.Neutral('%s/data' % (container.path))
    params = testutils.setup_single_compartment(
        model_container, data_container,
        channelbase.prototypes[channelname],
        Gbar)
    vm_data = params['Vm']
    gk_data = params['Gk']
    ik_data = params['Ik']
    testutils.setup_clocks(simdt, plotdt)
    testutils.assign_clocks(model_container, data_container)
    moose.reinit()
    print 'Starting simulation', testId, 'for', simtime, 's'
    moose.start(simtime)
    print 'Finished simulation'
    vm_file = 'data/%s_Vm.dat' % (channelname)
    gk_file = 'data/%s_Gk.dat' % (channelname)
    ik_file = 'data/%s_Ik.dat' % (channelname)
    tseries = np.array(range(len(vm_data.vec))) * simdt
    print 'Vm:', len(vm_data.vec), 'Gk', len(gk_data.vec), 'Ik', len(ik_data.vec)
    data = np.c_[tseries, vm_data.vec]
    np.savetxt(vm_file, data)
    print 'Saved Vm in', vm_file
    print len(gk_data.vec), len(vm_data.vec)
    data = np.c_[tseries, gk_data.vec]
    np.savetxt(gk_file, data)
    print 'Saved Gk in', gk_file
    data = np.c_[tseries, ik_data.vec]
    np.savetxt(ik_file, data)
    print 'Saved Gk in', ik_file
    return params
def setup_cadep_channel(model_container, data_container, channel_proto, Gbar, ca_start, ca_stop):
    """Setup a test compartment with [Ca2+] dependent channel."""
    params = setup_single_compartment(model_container, data_container, channel_proto, Gbar)
    ca_table = moose.StimulusTable(model_container.path + '/CaStim')    
    ca_table.vec = np.linspace(ca_start, ca_stop, 1000)
    ca_table.doLoop = True
    ca_recorder = moose.Table(data_container.path + '/Ca')
    moose.connect(ca_table, 'output', ca_recorder, 'input')
    moose.connect(ca_table, 'output', params['channel'], 'concen')
    params['Ca'] = ca_recorder
    params['CaStim'] = ca_table
    testutils.setup_clocks(simdt, plotdt)
    testutils.assign_clocks(model_container, data_container)    
    moose.useClock(1, '%s,%s' % (ca_recorder.path, ca_table.path), 'process')
    return params
Exemplo n.º 3
0
def setup_cadep_channel(model_container, data_container, channel_proto, Gbar,
                        ca_start, ca_stop):
    """Setup a test compartment with [Ca2+] dependent channel."""
    params = setup_single_compartment(model_container, data_container,
                                      channel_proto, Gbar)
    ca_table = moose.StimulusTable(model_container.path + '/CaStim')
    ca_table.vector = np.linspace(ca_start, ca_stop, 1000)
    ca_table.doLoop = True
    ca_recorder = moose.Table(data_container.path + '/Ca')
    moose.connect(ca_table, 'output', ca_recorder, 'input')
    moose.connect(ca_table, 'output', params['channel'], 'concen')
    params['Ca'] = ca_recorder
    params['CaStim'] = ca_table
    testutils.setup_clocks(simdt, plotdt)
    testutils.assign_clocks(model_container, data_container)
    moose.useClock(1, '%s,%s' % (ca_recorder.path, ca_table.path), 'process')
    return params