本文整理汇总了Python中simulation.Simulation.simdt方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.simdt方法的具体用法?Python Simulation.simdt怎么用?Python Simulation.simdt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.Simulation
的用法示例。
在下文中一共展示了Simulation.simdt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_single_cell
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import simdt [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()
示例2: test_single_cell
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import simdt [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')
示例3: len
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import simdt [as 别名]
syn.saturation = 1.0
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))