当前位置: 首页>>代码示例>>Python>>正文


Python Simulation.plotdt方法代码示例

本文整理汇总了Python中simulation.Simulation.plotdt方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.plotdt方法的具体用法?Python Simulation.plotdt怎么用?Python Simulation.plotdt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在simulation.Simulation的用法示例。


在下文中一共展示了Simulation.plotdt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_single_cell

# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import plotdt [as 别名]
    def test_single_cell(cls):
        """Simulates a single superficial pyramidal regular spiking
        cell and plots the Vm and [Ca2+]"""

        config.LOGGER.info("/**************************************************************************")
        config.LOGGER.info(" *")
        config.LOGGER.info(" * Simulating a single cell: %s" % (cls.__name__))
        config.LOGGER.info(" *")
        config.LOGGER.info(" **************************************************************************/")
        sim = Simulation(cls.__name__)
        sim.simdt = 5e-6
        sim.plotdt = 1e-4
        mycell = SupPyrRS(SupPyrRS.prototype, sim.model.path + "/SupPyrRS")
        config.LOGGER.info('Created cell: %s' % (mycell.path))
        vm_table = mycell.comp[mycell.presyn].insertRecorder('Vm_suppyrRS', 'Vm', sim.data)
        pulsegen = mycell.soma.insertPulseGen('pulsegen', sim.model, firstLevel=0.3e-9, firstDelay=100e-3, firstWidth=200e-3)
        sim.schedule()
        if mycell.has_cycle():
            config.LOGGER.warning("WARNING!! CYCLE PRESENT IN CICRUIT.")
        t1 = datetime.now()
        sim.run(500e-3)
        t2 = datetime.now()
        sim.dump_data('data')
        delta = t2 - t1
        config.BENCHMARK_LOGGER.info('simulation time: %g' % (delta.seconds + 1e-6 * delta.microseconds))
        if config.has_pylab:
            mus_vm = config.pylab.array(vm_table) * 1e3
            mus_t = linspace(0, sim.simtime*1e3, len(mus_vm))
            try:
                nrn_vm = config.pylab.loadtxt('../nrn/mydata/Vm_suppyrrs.plot')
                nrn_t = nrn_vm[:, 0]
                nrn_vm = nrn_vm[:, 1]
                # nrn_ca = config.pylab.loadtxt('../nrn/mydata/Ca_suppyrrs.plot')
                # nrn_ca = nrn_ca[:,1]
                config.pylab.plot(nrn_t, nrn_vm, 'y-', label='nrn vm')
            except IOError:
                pass
            data = config.pylab.zeros((len(mus_vm), 2))
            data[:, 0] = mus_t[:]
            data[:, 1] = mus_vm[:]
            
            config.pylab.plot(mus_t, mus_vm, 'g-.', label='mus vm')
            # if ca_table:
            #     ca_array = config.pylab.array(ca_table)
            #     config.pylab.plot(nrn_t, -nrn_ca, 'r-', label='nrn (-)ca')
            #     config.pylab.plot(mus_t, -ca_array, 'b-.', label='mus (-)ca')
            #     print config.pylab.amax(ca_table)
            config.pylab.legend()
            config.pylab.title('suppyrRS')
            config.pylab.show()
开发者ID:BhallaLab,项目名称:thalamocortical,代码行数:52,代码来源:suppyrRS.py

示例2: test_single_cell

# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import plotdt [as 别名]
    def test_single_cell(cls):
        """Simulates a single thalamocortical relay cell
        and plots the Vm and [Ca2+]"""

        config.LOGGER.info("/**************************************************************************")
        config.LOGGER.info(" *")
        config.LOGGER.info(" * Simulating a single cell: %s" % (cls.__name__))
        config.LOGGER.info(" *")
        config.LOGGER.info(" **************************************************************************/")
        sim = Simulation(cls.__name__)
        sim.simdt = 5e-6
        sim.plotdt = 0.5e-4
        mycell = TCR(TCR.prototype, sim.model.path + "/TCR")
        # for ii in range(1, mycell.num_comp):
        #     mycell.comp[ii].Em = -57e-3
        print 'Created cell:', mycell.path
        vm_table_presyn = mycell.comp[mycell.presyn].insertRecorder('Vm_TCR', 'Vm', sim.data)
        vm_table_soma = mycell.soma.insertRecorder('TCR_soma_Vm', 'Vm', sim.data)
        print 'Tables created:', vm_table_soma.path, vm_table_presyn.path
        stim_table = moose.Table('%s/stimulus' % (sim.data.path))
        stim_table.stepMode = 3
        pulsegen = mycell.soma.insertPulseGen('pulsegen', sim.model, firstLevel=-1e-9, firstDelay=100e-3, firstWidth=100e-3)
        pulsegen.secondDelay = 200e-3
        pulsegen.secondWidth = 100e-3
        pulsegen.secondLevel = 0.3e-9
        pulsegen.count = 3
        pulsegen.delay[2] = 1e9
        # pulsegen.count = 4
        # for ii in range(pulsegen.count):
        #     pulsegen.delay[ii] = 0.025
        #     pulsegen.level[ii] = 1e-9
        #     pulsegen.width[ii] = 100e-6
        # pulsegen.delay[0]= 3.0
        stim_table.connect('inputRequest', pulsegen, 'output')
    
        sim.schedule()
        if mycell.has_cycle():
            print "WARNING!! CYCLE PRESENT IN CICRUIT."
        t1 = datetime.now()
        sim.run(0.5)
        t2 = datetime.now()
        delta = t2 - t1
        print 'simulation time: ', delta.seconds + 1e-6 * delta.microseconds
        sim.dump_data('data')
开发者ID:BhallaLab,项目名称:thalamocortical,代码行数:46,代码来源:tcr.py

示例3: len

# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import plotdt [as 别名]
 stim = moose.PulseGen('%s/stimulus' % (sim.model.path))
 stim.delay[0] = 2.0
 stim.level[0] = 1e-9
 stim.width[0] = 10e-3
 stim.connect('outputSrc', precell.soma, 'injectMsg')
 datatables = []
 datatables.append(moose.Table('%s/preVm_%s_%s_%s' % (sim.data.path, chantype, pretype, posttype)))
 datatables[-1].connect('inputRequest', precell.soma, 'Vm')
 datatables.append(moose.Table('%s/postVm_%s_%s_%s' % (sim.data.path, chantype, pretype, posttype)))
 datatables[-1].connect('inputRequest', postcell.soma, 'Vm')
 datatables.append(moose.Table('%s/synIk_%s_%s_%s' % (sim.data.path, chantype, pretype, posttype)))
 datatables[-1].connect('inputRequest', syn, 'Ik')
 for tab in datatables:
     tab.stepMode = 3
 sim.simdt = 5e-6
 sim.plotdt = 1e-4 
 sim.schedule()    
 print 'plot_psp: scheduling done at', datetime.now().strftime('%Y%m%d_%H%M%S')
 sim.run(5.0)
 print 'plot_psp: simulation done at', datetime.now().strftime('%Y%m%d_%H%M%S')
 ts = np.linspace(0,simtime, len(datatables[-1]))
 datatables = [ts] + datatables
 np.savetxt('%s/data.txt' % (datadir), np.vstack(datatables).transpose())
 print '###### %s->%s->%s (%s): PSP max: %g' % (pretype, chantype, posttype, datatables[1].name, max(datatables[1]))
 print 'Saved data matrix with columns: time,', ','.join([t.name for t in datatables[1:]])
 for ii, tab in enumerate(datatables[1:]):
     plt.subplot(2, int((len(datatables) - 1)*0.5 + 0.5), ii+1)
     plt.plot(ts, np.asarray(tab))
     plt.title(tab.name)
     plt.savefig('%s/%s.pdf' % (datadir, tab.name))
     plt.close()
开发者ID:BhallaLab,项目名称:thalamocortical,代码行数:33,代码来源:plot_psp.py


注:本文中的simulation.Simulation.plotdt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。