本文整理汇总了Python中simulation.Simulation.run方法的典型用法代码示例。如果您正苦于以下问题:Python Simulation.run方法的具体用法?Python Simulation.run怎么用?Python Simulation.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类simulation.Simulation
的用法示例。
在下文中一共展示了Simulation.run方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: square_toric_code_sim
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def square_toric_code_sim(size, error_rate, n_trials, filename):
"""
This function is square in more than one sense; it does everything
the most vanilla way possible, and it uses a square grid to define
the torus. You put in an integer size, an error rate and a number
of trials to execute, and it produces a pickled dict containing
the input to a simulation object in a file.
"""
sim_lattice = SquareLattice((size,size))
sim_dual_lattice = SquareLattice((size,size), is_dual=True)
sim_model = depolarizing_model(error_rate)
sim_code = toric_code(sim_lattice, sim_dual_lattice)
sim_decoder = mwpm_decoder(sim_lattice, sim_dual_lattice)
sim_log_ops = toric_log_ops((size,size))
sim_keys = ['lattice', 'dual_lattice', 'error_model', 'code',
'decoder', 'logical_operators', 'n_trials']
sim_values = [sim_lattice, sim_dual_lattice, sim_model, sim_code,
sim_decoder, sim_log_ops, n_trials]
sim_dict = dict(zip(sim_keys, sim_values))
sim = Simulation(**sim_dict)
sim.run()
sim.save(filename + '.sim')
示例2: sim_from_file
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def sim_from_file(filename):
"""
The purpose of this function is to:
+ open a file containing a pickled dictionary of input values to a simulation,
+ initialize the objects which the corresponding `py_qcode.Simulation` takes as input,
+ run the simulation, and
+ save the results to a file of the same name as the input, with a different extension.
"""
#Obsolete, scavenging code for pickle-independent implementation
#(you can't pickle functions).
with open(filename,'r') as phil:
sim_dict = pkl.load(phil)
sim = Simulation(**sim_dict)
sim.run()
split_name = filename.split('.')
try:
file_prefix, file_ext = split_name
except ValueError:
raise ValueError('Filenames are assumed to be of the form'+\
' "prefix.ext".')
output_name = '.'.join([file_prefix, 'out'])
sim.save(output_name)
示例3: test_single_cell
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [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__)
mycell = SupPyrRS(SupPyrRS.prototype, sim.model.path + "/SupPyrRS")
config.LOGGER.info('Created cell: %s' % (mycell.path))
vm_table = mycell.comp[SupPyrRS.presyn].insertRecorder('Vm_suppyrrs', 'Vm', sim.data)
pulsegen = mycell.soma.insertPulseGen('pulsegen', sim.model, firstLevel=3e-10, firstDelay=50e-3, firstWidth=50e-3)
sim.schedule()
if mycell.has_cycle():
config.LOGGER.warning("WARNING!! CYCLE PRESENT IN CICRUIT.")
t1 = datetime.now()
sim.run(200e-3)
t2 = datetime.now()
delta = t2 - t1
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_deepLTS.plot')
nrn_t = nrn_vm[:, 0]
nrn_vm = nrn_vm[:, 1]
config.pylab.plot(nrn_t, nrn_vm, 'y-', label='nrn vm')
except IOError:
print 'NEURON Data not available.'
config.pylab.plot(mus_t, mus_vm, 'g-.', label='mus vm')
config.pylab.legend()
config.pylab.show()
示例4: test_single_cell
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def test_single_cell(cls):
"""Simulates a single deep LTS 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__)
mycell = DeepLTS(DeepLTS.prototype, sim.model.path + "/DeepLTS")
config.LOGGER.debug(("Created cell: %s" % mycell.path))
vm_table = mycell.comp[mycell.presyn].insertRecorder("Vm_deepLTS", "Vm", sim.data)
pulsegen = mycell.soma.insertPulseGen(
"pulsegen", sim.model, firstLevel=3e-10, firstDelay=100e-3, firstWidth=200e-3
)
sim.schedule()
if mycell.has_cycle():
config.LOGGER.warning("WARNING!! CYCLE PRESENT IN CICRUIT.")
sim.run(0.5)
sim.dump_data("data")
mycell.dump_cell("deepLTS.txt")
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_deepLTS.plot")
nrn_t = nrn_vm[:, 0]
nrn_vm = nrn_vm[:, 1]
config.pylab.plot(nrn_t, nrn_vm, "y-", label="nrn vm")
except IOError:
print "NEURON Data not available."
config.pylab.plot(mus_t, mus_vm, "g-.", label="mus vm")
config.pylab.legend()
config.pylab.title("DeepLTS")
config.pylab.show()
示例5: main
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def main(argv):
R = 500
try:
opts, args = getopt.getopt(argv, "hr:", ["help", "reps="])
except getopt.GetoptError:
sys.exit(2)
for opt, arg in opts:
if opt in ('-h', '--help'):
usage()
sys.exit(2)
if opt in ('-r', '-replications'):
R = int(arg)
# Instantiate ruler ideology parameters
rid0 = float(np.random.beta(2, 2, 1))
rid1 = float(np.random.beta(2, 2, 1))
params0 = {'ideology': 1, 'quality': 0, 'seniority': 0}
params1 = {'ideology': 1, 'quality': 0, 'seniority': 0}
leonidasr = Ruler(rid0, params0)
spartar = Army(3, 3, 4, 30, [2, 4], leonidasr)
leonidasl = Ruler(rid1, params1)
spartal = Army(3, 3, 4, 30, [4, 2], leonidasl)
print('Replication: ruler0-params {}, \
ruler1-params {}'.
format(rid0,
rid1))
for oo in [True]:
# print 'Inits: {}, Ordered: {}'.format(params, oo)
population = Population().population
sargs = {'R': R, 'method': 'none'}
simp = Simulation(spartar, spartal, population, sargs)
simp.run()
simp.write()
示例6: test_spinstell_spinstell_ampa
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def test_spinstell_spinstell_ampa():
netdata = TraubFullNetData()
sim = Simulation('spinstell_spinstell_synapse')
spinstell_index = netdata.celltype.index('SpinyStellate')
pre = SpinyStellate(SpinyStellate.prototype, sim.model.path + '/SpinyStellate1')
spinstell = SpinyStellate(SpinyStellate.prototype, sim.model.path + '/SpinyStellate2')
precomp = pre.comp[SpinyStellate.presyn]
postcomp = spinstell.comp[5] # 5 is among the allowed post synaptic compartments in spiny stellate cell
synchan = precomp.makeSynapse(postcomp,
name='ampa_from_SPINSTELL',
classname='SynChan',
Ek=0.0,
Gbar=netdata.g_ampa_baseline[spinstell_index][spinstell_index],
tau1=netdata.tau_ampa[spinstell_index][spinstell_index],
tau2=netdata.tau_ampa[spinstell_index][spinstell_index],
delay = synapse.SYNAPTIC_DELAY_DEFAULT
)
stim = pre.soma.insertPulseGen('stimulus', sim.model, firstLevel=1e-9, firstDelay=200e-3, firstWidth=2e-3)
pre_soma_tab = pre.soma.insertRecorder('stim', 'Vm', sim.data)
ss_soma_tab = spinstell.soma.insertRecorder('post_soma', 'Vm', sim.data)
ss_dend_tab = postcomp.insertRecorder('post_dend', 'Vm', sim.data)
sim.schedule()
sim.run(1.0)
pylab.plot(numpy.linspace(0, 1.0, len(pre_soma_tab)), pre_soma_tab, label='pre_soma')
pylab.plot(numpy.linspace(0, 1.0, len(ss_soma_tab)), ss_soma_tab, label='ss_soma')
pylab.plot(numpy.linspace(0, 1.0, len(ss_dend_tab)), ss_dend_tab, label='ss_dend')
pylab.legend()
pylab.show()
示例7: test_single_cell
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def test_single_cell(cls):
"""Simulates a single deep basket 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__)
mycell = DeepBasket(DeepBasket.prototype, sim.model.path + "/DeepBasket")
print "Created cell:", mycell.path
vm_table = mycell.comp[mycell.presyn].insertRecorder("Vm_deepbask", "Vm", sim.data)
ca_conc_path = mycell.soma.path + "/CaPool"
ca_table = None
if config.context.exists(ca_conc_path):
ca_conc = moose.CaConc(ca_conc_path)
ca_table = moose.Table("Ca_deepbask", sim.data)
ca_table.stepMode = 3
ca_conc.connect("Ca", ca_table, "inputRequest")
kc_path = mycell.soma.path + "/KC"
gk_table = None
if config.context.exists(kc_path):
gk_table = moose.Table("gkc", sim.data)
gk_table.stepMode = 3
kc = moose.HHChannel(kc_path)
kc.connect("Gk", gk_table, "inputRequest")
pymoose.showmsg(ca_conc)
pulsegen = mycell.soma.insertPulseGen(
"pulsegen", sim.model, firstLevel=3e-10, firstDelay=100e-3, firstWidth=200e-3
)
# pulsegen1 = mycell.soma.insertPulseGen('pulsegen1', sim.model, firstLevel=3e-7, firstDelay=150e-3, firstWidth=10e-3)
sim.schedule()
if mycell.has_cycle():
print "WARNING!! CYCLE PRESENT IN CICRUIT."
t1 = datetime.now()
sim.run(500e-3)
t2 = datetime.now()
delta = t2 - t1
print "simulation time: ", delta.seconds + 1e-6 * delta.microseconds
sim.dump_data("data")
mycell.dump_cell("deepbask.txt")
if config.has_pylab:
mus_vm = config.pylab.array(vm_table) * 1e3
nrn_vm = config.pylab.loadtxt("../nrn/mydata/Vm_deepbask.plot")
nrn_t = nrn_vm[:, 0]
mus_t = linspace(0, nrn_t[-1], len(mus_vm))
nrn_vm = nrn_vm[:, 1]
nrn_ca = config.pylab.loadtxt("../nrn/mydata/Ca_deepbask.plot")
nrn_ca = nrn_ca[:, 1]
config.pylab.plot(nrn_t, nrn_vm, "y-", label="nrn 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("DeepBasket")
config.pylab.show()
示例8: test_single_cell
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [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__)
mycell = TuftedRS(TuftedRS.prototype, sim.model.path + "/TuftedRS")
print 'MOOSE: Created cell:', mycell.path
vm_table = mycell.comp[cls.presyn].insertRecorder('Vm_tuftRS', 'Vm', sim.data)
# ca_conc_path = mycell.soma.path + '/CaPool'
# ca_table = None
# if config.context.exists(ca_conc_path):
# ca_conc = moose.CaConc(ca_conc_path)
# ca_table = moose.Table('Ca_tuftRS', sim.data)
# ca_table.stepMode = 3
# ca_conc.connect('Ca', ca_table, 'inputRequest')
# kc_path = mycell.soma.path + '/KC'
# gk_table = None
# if config.context.exists(kc_path):
# gk_table = moose.Table('gkc', sim.data)
# gk_table.stepMode = 3
# kc = moose.HHChannel(kc_path)
# kc.connect('Gk', gk_table, 'inputRequest')
# pymoose.showmsg(ca_conc)
pulsegen = mycell.soma.insertPulseGen('pulsegen', sim.model, firstLevel=1e-9, firstDelay=100e-3, firstWidth=200e-3)
# pulsegen1 = mycell.soma.insertPulseGen('pulsegen1', sim.model, firstLevel=3e-7, firstDelay=150e-3, firstWidth=10e-3)
sim.schedule()
if mycell.has_cycle():
print "WARNING!! CYCLE PRESENT IN CICRUIT."
t1 = datetime.now()
sim.run(500e-3)
t2 = datetime.now()
delta = t2 - t1
print 'MOOSE: simulation time: ', delta.seconds + 1e-6 * delta.microseconds
sim.dump_data('data')
# mycell.dump_cell('tuftRS.txt')
if config.has_pylab:
mus_vm = config.pylab.array(vm_table) * 1e3
nrn_vm = config.pylab.loadtxt('../nrn/mydata/Vm_tuftRS.plot')
nrn_t = nrn_vm[:, 0]
mus_t = linspace(0, nrn_t[-1], len(mus_vm))
nrn_vm = nrn_vm[:, 1]
# nrn_ca = config.pylab.loadtxt('../nrn/mydata/Ca_tuftRS.plot')
# nrn_ca = nrn_ca[:,1]
config.pylab.plot(nrn_t, nrn_vm, 'y-', label='nrn 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('tuftedRS')
config.pylab.show()
示例9: test_single_cell
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def test_single_cell(cls):
"""Simulates a single spiny stellate 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__)
proto = TraubCell.read_proto("SpinyStellate.p", "SpinyStellate_1", SpinyStellate.chan_params)
print 'Model path', sim.model.path , 'proto', proto
mycell = SpinyStellate(proto, sim.model.path + "/SpinyStellate")
print 'Cell created'
for handler in config.LOGGER.handlers:
handler.flush()
config.LOGGER.debug('Created cell: %s' % (mycell.path))
# for neighbour in mycell.soma.neighbours('raxial'):
# print 'RAXIAL', neighbours.path()
# for neighbour in mycell.soma.neighbours('axial'):
# print 'AXIAL', neighbour.path()
vm_table = mycell.comp[mycell.presyn].insertRecorder('Vm_spinstell', 'Vm', sim.data)
pulsegen = mycell.soma.insertPulseGen('pulsegen', sim.model, firstLevel=3e-10, firstDelay=100e-3, firstWidth=200e-3)
# pulsegen1 = mycell.soma.insertPulseGen('pulsegen1', sim.model, firstLevel=3e-7, firstDelay=150e-3, firstWidth=10e-3)
sim.schedule()
if mycell.has_cycle():
config.LOGGER.warning("WARNING!! CYCLE PRESENT IN CICRUIT.")
t1 = datetime.now()
sim.run(0.5)
t2 = datetime.now()
delta = t2 - t1
config.BENCHMARK_LOGGER.info('simulation time: %g' % (delta.seconds + 1e-6 * delta.microseconds))
for msg in moose.Neutral('/model/SpinyStellate/solve').inMessages():
print msg
for msg in moose.Neutral('/model/SpinyStellate/solve').outMessages():
print msg
sim.dump_data('data')
# mycell.dump_cell('spinstell.txt')
if config.has_pylab:
mus_vm = config.pylab.array(vm_table) * 1e3
mus_t = linspace(0, sim.simtime*1e3, len(mus_vm))
config.pylab.plot(mus_t, mus_vm, 'g-.', label='mus vm')
try:
nrn_vm = config.pylab.loadtxt('../nrn/mydata/Vm_spinstell.plot')
nrn_t = nrn_vm[:, 0]
nrn_vm = nrn_vm[:, 1]
nrn_ca = config.pylab.loadtxt('../nrn/mydata/Ca_spinstell.plot')
config.pylab.plot(nrn_t, nrn_vm, 'y-', label='nrn vm')
except IOError:
pass
config.pylab.legend(loc=0)
config.pylab.title('spinystellate')
config.pylab.show()
示例10: run_simulations
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def run_simulations(self):
"""Run NUM_SIMULATIONS simulations"""
self.results = []
append = self.results.append
for _ in xrange(self.num_simulations):
simulation = Simulation(self.num_simulations, self.attrition, self.iterations_per_simulation,
self.promotion_bias, self.num_positions_at_level, self.bias_favors_this_gender)
simulation.run()
append(simulation.get_result())
示例11: test_single_cell
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def test_single_cell(cls):
"""Simulates a single spiny stellate 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__)
proto = TraubCell.read_proto("SpinyStellate.p", "SpinyStellate_1", SpinyStellate.chan_params)
print 'Model path', sim.model.path , 'proto', proto
mycell = SpinyStellate(proto, sim.model.path + "/SpinyStellate")
print 'Cell created'
for handler in config.LOGGER.handlers:
handler.flush()
mycell.soma.x0 = 0.0
mycell.soma.y0 = 0.0
mycell.soma.z0 = 0.0
mycell.soma.x = 0.0
mycell.soma.y = 0.0
mycell.soma.z = mycell.soma.length
# mycellview = MyCellView(mycell)
config.LOGGER.debug('Created cell: %s' % (mycell.path))
# for neighbour in mycell.soma.neighbours('raxial'):
# print 'RAXIAL', neighbours.path()
# for neighbour in mycell.soma.neighbours('axial'):
# print 'AXIAL', neighbour.path()
vm_table = mycell.comp[mycell.presyn].insertRecorder('Vm_spinstell', 'Vm', sim.data)
pulsegen = mycell.soma.insertPulseGen('pulsegen', sim.model, firstLevel=3e-10, firstDelay=50e-3, firstWidth=50e-3)
# pulsegen1 = mycell.soma.insertPulseGen('pulsegen1', sim.model, firstLevel=3e-7, firstDelay=150e-3, firstWidth=10e-3)
sim.schedule()
if mycell.has_cycle():
print "WARNING!! CYCLE PRESENT IN CICRUIT."
t1 = datetime.now()
sim.run(200e-3)
t2 = datetime.now()
delta = t2 - t1
print 'simulation time: ', delta.seconds + 1e-6 * delta.microseconds
sim.dump_data('data')
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_spinstell.plot')
nrn_t = nrn_vm[:, 0]
nrn_vm = nrn_vm[:, 1]
config.pylab.plot(nrn_t, nrn_vm, 'y-', label='nrn vm')
except IOError:
print 'NEURON Data not available.'
config.pylab.plot(mus_t, mus_vm, 'g-.', label='mus vm')
config.pylab.legend()
config.pylab.show()
示例12: test_single_cell
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def test_single_cell(cls):
"""Simulates a single tufted intrinsically bursting 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__)
mycell = TuftedIB(TuftedIB.prototype, sim.model.path + "/TuftedIB")
print 'Created cell:', mycell.path
vm_table = mycell.comp[mycell.presyn].insertRecorder('Vm_tuftIB', 'Vm', sim.data)
ca_conc_path = mycell.soma.path + '/CaPool'
ca_table = None
if config.context.exists(ca_conc_path):
ca_conc = moose.CaConc(ca_conc_path)
ca_table = moose.Table('Ca_tuftIB', sim.data)
ca_table.stepMode = 3
ca_conc.connect('Ca', ca_table, 'inputRequest')
kc_path = mycell.soma.path + '/KC'
gk_table = None
if config.context.exists(kc_path):
gk_table = moose.Table('gkc', sim.data)
gk_table.stepMode = 3
kc = moose.HHChannel(kc_path)
kc.connect('Gk', gk_table, 'inputRequest')
pymoose.showmsg(ca_conc)
pulsegen = mycell.soma.insertPulseGen('pulsegen', sim.model, firstLevel=0.3e-9, firstDelay=0.0, firstWidth=50e-3)
# pulsegen1 = mycell.soma.insertPulseGen('pulsegen1', sim.model, firstLevel=3e-7, firstDelay=150e-3, firstWidth=10e-3)
sim.schedule()
if mycell.has_cycle():
print "WARNING!! CYCLE PRESENT IN CICRUIT."
t1 = datetime.now()
sim.run(200e-3)
t2 = datetime.now()
delta = t2 - t1
print 'simulation time: ', delta.seconds + 1e-6 * delta.microseconds
sim.dump_data('data')
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_deepLTS.plot')
nrn_t = nrn_vm[:, 0]
nrn_vm = nrn_vm[:, 1]
config.pylab.plot(nrn_t, nrn_vm, 'y-', label='nrn vm')
except IOError:
print 'NEURON Data not available.'
config.pylab.plot(mus_t, mus_vm, 'g-.', label='mus vm')
config.pylab.legend()
config.pylab.show()
示例13: test_full_model
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def test_full_model(simtime, simdt=1e-4, plotdt=1e-3, cell_count=None):
"""Setup and run the full Traub model"""
sim = Simulation('traub')
net = []
scale = 10
if cell_count is None:
cell_count = CELL_COUNT
network = Network(sim, cell_count)
network.setup_random_recording(0.05) # record from 5% of cells
sim.schedule(simdt=simdt, plotdt=plotdt, gldt=1e10)
sim.run(time=simtime)
sim.dump_data(config.data_dir, True)
示例14: run_simulations
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def run_simulations(self):
"""Run NUM_SIMULATIONS simulations"""
self.results = []
for i in range(self.num_simulations):
simulation = Simulation(
self.num_simulations,
self.attrition,
self.iterations_per_simulation,
self.promotion_bias,
self.num_positions_list,
)
simulation.run()
self.results.append(simulation.get_result())
示例15: inject_test
# 需要导入模块: from simulation import Simulation [as 别名]
# 或者: from simulation.Simulation import run [as 别名]
def inject_test(celltype, current_list, simtime=2.0):
test_data = {}
sim = Simulation(celltype)
for ii, current in enumerate(current_list):
test_data[ii] = setup_model(ii, celltype, current, sim)
sim.schedule()
sim.run(simtime)
sim.dump_data('data')
timeseries = np.linspace(0, simtime, len(test_data[0]['Vm']))
for ii, current in enumerate(current_list):
color = cmap(ii*1.0/len(current_list), len(current_list))
plt.plot(timeseries * 1e3, np.array(test_data[ii]['Vm']) * 1e3, color=color, label='%g nA' % (current * 1e9))
plt.legend()
plt.show()