本文整理汇总了Python中nest.set_verbosity函数的典型用法代码示例。如果您正苦于以下问题:Python set_verbosity函数的具体用法?Python set_verbosity怎么用?Python set_verbosity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_verbosity函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
# test parameter
self.rtol = 0.05
# neuron parameters
self.neuron_params = {'mu': 1.5, 'sigma': 0.5, 'tau': 5.}
# simulation parameters
self.simtime = 10000.
self.dt = 0.1
self.tstart = 10. * self.neuron_params['tau']
nest.set_verbosity('M_WARNING')
nest.ResetKernel()
nest.SetKernelStatus(
{'resolution': self.dt, 'use_wfr': False, 'print_time': True})
# set up rate neuron and devices
self.rate_neuron_ipn = nest.Create(
'lin_rate_ipn', params=self.neuron_params)
self.rate_neuron_opn = nest.Create(
'lin_rate_opn', params=self.neuron_params)
self.multimeter = nest.Create(
"multimeter", params={'record_from': ['rate', 'noise'],
'interval': self.dt, 'start': self.tstart})
# record rates and noise
nest.Connect(
self.multimeter, self.rate_neuron_ipn + self.rate_neuron_opn)
示例2: setUp
def setUp(self):
nest.set_verbosity('M_WARNING')
nest.ResetKernel()
# settings
self.dendritic_delay = 1.0
self.decay_duration = 5.0
self.synapse_model = "stdp_triplet_synapse"
self.syn_spec = {
"model": self.synapse_model,
"delay": self.dendritic_delay,
"receptor_type": 1, # set receptor 1 post-synaptically, to not generate extra spikes
"weight": 5.0,
"tau_plus": 16.8,
"tau_plus_triplet": 101.0,
"Aplus": 0.1,
"Aminus": 0.1,
"Aplus_triplet": 0.1,
"Aminus_triplet": 0.1,
"Kplus": 0.0,
"Kplus_triplet": 0.0,
"Wmax": 100.0,
}
self.post_neuron_params = {
"tau_minus": 33.7,
"tau_minus_triplet": 125.0,
}
# setup basic circuit
self.pre_neuron = nest.Create("parrot_neuron")
self.post_neuron = nest.Create("parrot_neuron", 1, params=self.post_neuron_params)
nest.Connect(self.pre_neuron, self.post_neuron, syn_spec=self.syn_spec)
示例3: run_simulation
def run_simulation():
'''Performs a simulation, including network construction'''
# open log file
with Logger(params['log_file']) as logger:
nest.ResetKernel()
nest.set_verbosity(M_INFO)
logger.log(str(memory_thisjob()) + ' # virt_mem_0')
sdet = build_network(logger)
tic = time.time()
nest.Simulate(params['presimtime'])
PreparationTime = time.time() - tic
logger.log(str(memory_thisjob()) + ' # virt_mem_after_presim')
logger.log(str(PreparationTime) + ' # presim_time')
tic = time.time()
nest.Simulate(params['simtime'])
SimCPUTime = time.time() - tic
logger.log(str(memory_thisjob()) + ' # virt_mem_after_sim')
logger.log(str(SimCPUTime) + ' # sim_time')
if params['record_spikes']:
logger.log(str(compute_rate(sdet)) + ' # average rate')
print(nest.GetKernelStatus())
示例4: setUp
def setUp(self):
# test parameter to compare analytic solution to simulation
self.rtol = 1.0
# test parameters
self.N = 100
self.rate_ex = 1.5 * 1e4
self.J = 0.1
# simulation parameters
self.simtime = 500.
self.dt = 0.1
self.start = 200.
nest.set_verbosity('M_WARNING')
nest.ResetKernel()
nest.SetKernelStatus(
{'resolution': self.dt, 'use_wfr': False, 'print_time': True})
# set up driven integrate-and-fire neuron
self.iaf_psc_delta = nest.Create(
'iaf_psc_delta', self.N) # , params={"C_m": 1.0})
self.poisson_generator = nest.Create(
'poisson_generator', params={'rate': self.rate_ex})
nest.Connect(self.poisson_generator, self.iaf_psc_delta,
syn_spec={'weight': self.J, 'delay': self.dt})
self.spike_detector = nest.Create(
"spike_detector", params={'start': self.start})
nest.Connect(
self.iaf_psc_delta, self.spike_detector)
# set up driven siegert neuron
neuron_status = nest.GetStatus(self.iaf_psc_delta)[0]
siegert_params = {'tau_m': neuron_status['tau_m'],
't_ref': neuron_status['t_ref'],
'theta': neuron_status['V_th'] -
neuron_status['E_L'],
'V_reset': neuron_status['V_reset'] -
neuron_status['E_L']}
self.siegert_neuron = nest.Create(
'siegert_neuron', params=siegert_params)
self.siegert_drive = nest.Create(
'siegert_neuron', 1, params={'mean': self.rate_ex})
J_mu_ex = neuron_status['tau_m'] * 1e-3 * self.J
J_sigma_ex = neuron_status['tau_m'] * 1e-3 * self.J ** 2
syn_dict = {'drift_factor': J_mu_ex, 'diffusion_factor':
J_sigma_ex, 'model': 'diffusion_connection'}
nest.Connect(
self.siegert_drive, self.siegert_neuron, syn_spec=syn_dict)
self.multimeter = nest.Create(
"multimeter", params={'record_from': ['rate'],
'interval': self.dt})
nest.Connect(
self.multimeter, self.siegert_neuron)
示例5: single_neuron
def single_neuron(spike_times, sim_duration):
nest.set_verbosity('M_WARNING') # reduce NEST output
nest.ResetKernel() # reset simulation kernel
# create LIF neuron with exponential synaptic currents
neuron = nest.Create('iaf_psc_exp')
# create a voltmeter
voltmeter = nest.Create('voltmeter', params={'interval': 0.1})
# create a spike generator
spikegenerator = nest.Create('spike_generator')
# ... and let it spike at predefined times
nest.SetStatus(spikegenerator, {'spike_times': spike_times})
# connect spike generator and voltmeter to the neuron
nest.Connect(spikegenerator, neuron)
nest.Connect(voltmeter, neuron)
# run simulation for sim_duration
nest.Simulate(sim_duration)
# read out recording time and voltage from voltmeter
times = nest.GetStatus(voltmeter)[0]['events']['times']
voltage = nest.GetStatus(voltmeter)[0]['events']['V_m']
# plot results
plt.plot(times, voltage)
plt.xlabel('Time (ms)')
plt.ylabel('Membrane potential (mV)')
filename = 'single_neuron.png'
plt.savefig(filename, dpi=300)
示例6: setUp
def setUp(self):
"""Set up the test."""
nest.set_verbosity('M_WARNING')
nest.ResetKernel()
# settings
self.dendritic_delay = 1.0
self.decay_duration = 5.0
self.synapse_model = "vogels_sprekeler_synapse"
self.syn_spec = {
"model": self.synapse_model,
"delay": self.dendritic_delay,
"weight": 5.0,
"eta": 0.001,
"alpha": 0.1,
"tau": 20.,
"Kplus": 0.0,
"Wmax": 15.,
}
# setup basic circuit
self.pre_neuron = nest.Create("parrot_neuron")
self.post_neuron = nest.Create("parrot_neuron")
nest.Connect(self.pre_neuron, self.post_neuron,
syn_spec=self.syn_spec)
示例7: test_ConnectNeuronsWithClopathSynapse
def test_ConnectNeuronsWithClopathSynapse(self):
"""Ensures that the restriction to supported neuron models works."""
nest.set_verbosity('M_WARNING')
# Specify supported models
supported_models = [
'aeif_psc_delta_clopath',
'hh_psc_alpha_clopath',
]
# Connect supported models with Clopath synapse
for nm in supported_models:
nest.ResetKernel()
n = nest.Create(nm, 2)
nest.Connect(n, n, {"rule": "all_to_all"},
{"model": "clopath_synapse"})
# Compute not supported models
not_supported_models = [n for n in nest.Models(mtype='nodes')
if n not in supported_models]
# Ensure that connecting not supported models fails
for nm in not_supported_models:
nest.ResetKernel()
n = nest.Create(nm, 2)
# try to connect with clopath_rule
with self.assertRaises(nest.kernel.NESTError):
nest.Connect(n, n, {"rule": "all_to_all"},
{"model": "clopath_synapse"})
示例8: setUp
def setUp(self):
nest.ResetKernel()
nest.SetKernelStatus({"total_num_virtual_procs": 4})
nest.ResetNetwork()
nest.set_verbosity('M_DEBUG')
self.sim_time = 10000
self.sim_step = 100
nest.SetKernelStatus(
{'structural_plasticity_update_interval': self.sim_time + 1})
self.se_integrator = []
self.sim_steps = None
self.ca_nest = None
self.ca_python = None
self.se_nest = None
self.se_python = None
# build
self.pop = nest.Create('iaf_psc_alpha', 10)
self.local_nodes = nest.GetNodes([0], {'model': 'iaf_psc_alpha'}, True)[0]
self.spike_detector = nest.Create('spike_detector')
nest.Connect(self.pop, self.spike_detector, 'all_to_all')
noise = nest.Create('poisson_generator')
nest.SetStatus(noise, {"rate": 800000.0})
nest.Connect(noise, self.pop, 'all_to_all')
示例9: setUp
def setUp(self):
nest.ResetKernel()
nest.set_verbosity('M_ERROR')
self.num_procs = 1
if mpi_test:
self.comm = MPI.COMM_WORLD
self.rank = self.comm.Get_rank()
assert(nest.Rank() == self.rank)
self.num_procs = 2
self.exclude_synapse_model = [
'stdp_dopamine_synapse',
'stdp_dopamine_synapse_lbl',
'stdp_dopamine_synapse_hpc',
'stdp_dopamine_synapse_hpc_lbl',
'rate_connection_instantaneous',
'rate_connection_instantaneous_lbl',
'rate_connection_delayed',
'rate_connection_delayed_lbl',
'gap_junction',
'gap_junction_lbl',
'diffusion_connection',
'diffusion_connection_lbl',
'clopath_synapse',
'clopath_synapse_lbl'
]
示例10: setupSimulation
def setupSimulation(self):
"""Set up the simulation."""
print("[INFO] Setting up simulation.")
# NEST stuff
nest.ResetKernel()
nest.set_verbosity('M_INFO')
nest.EnableStructuralPlasticity()
nest.SetKernelStatus(
{
'resolution': self.dt
}
)
nest.SetStructuralPlasticityStatus(
{
'structural_plasticity_update_interval':
self.spUpdateInterval, }
)
self.setupSPSynapses()
self.setupLayered()
self.setupSpikeRecorders()
self.calciumFile = open(self.calciumFileName, 'w')
self.synapticElementsFile = open(self.synapticElementsFileName, 'w')
print("[INFO] Setup complete.")
示例11: test_targets
def test_targets(self):
nest.ResetKernel()
nest.set_verbosity('M_ALL')
# Testing with 2 MPI processes
nest.SetKernelStatus(
{
'resolution': 0.1,
'total_num_virtual_procs': 2
}
)
# Update the SP interval
nest.EnableStructuralPlasticity()
nest.SetStructuralPlasticityStatus({
'structural_plasticity_update_interval':
100,
})
growth_curve = {
'growth_curve': "gaussian",
'growth_rate': 0.0001, # Beta (elements/ms)
'continuous': False,
'eta': 0.1,
'eps': 0.7,
}
structural_p_elements_E = {
'Den_ex': growth_curve,
'Den_in': growth_curve,
'Axon_ex': growth_curve
}
neuronDict = {'V_m': -60.,
't_ref': 5.0, 'V_reset': -60.,
'V_th': -50., 'C_m': 200.,
'E_L': -60., 'g_L': 10.,
'E_ex': 0., 'E_in': -80.,
'tau_syn_ex': 5., 'tau_syn_in': 10.,
'I_e': 220.}
nest.SetDefaults("iaf_cond_exp", neuronDict)
neuronsE = nest.Create('iaf_cond_exp', 1, {
'synaptic_elements': structural_p_elements_E})
# synapses
synDictE = {'model': 'static_synapse',
'weight': 3.,
'pre_synaptic_element': 'Axon_ex',
'post_synaptic_element': 'Den_ex'}
nest.SetStructuralPlasticityStatus({
'structural_plasticity_synapses': {
'synapseEE': synDictE,
}
})
try:
nest.Simulate(200 * 1000)
except:
print(sys.exc_info()[0])
self.fail("Exception during simulation")
示例12: build_and_connect_nodes
def build_and_connect_nodes(self, sigma, theta):
""" sets up an erfc neuron and spin detector. """
nest.set_verbosity('M_WARNING')
nest.ResetKernel()
self.neuron = nest.Create('erfc_neuron', 1,
{'sigma': sigma, 'theta': theta})
self.detector = nest.Create('spin_detector', 1)
nest.Connect(self.neuron, self.detector)
示例13: setUpNetwork
def setUpNetwork(self, conn_dict=None, syn_dict=None, N1=None, N2=None):
if N1 == None:
N1 = self.N1
if N2 == None:
N2 = self.N2
self.pop1 = nest.Create('iaf_neuron', N1)
self.pop2 = nest.Create('iaf_neuron', N2)
nest.set_verbosity('M_FATAL')
nest.Connect(self.pop1, self.pop2, conn_dict, syn_dict)
示例14: test_rate_copy_model
def test_rate_copy_model(self):
# neuron parameters
neuron_params = {'tau': 5., 'sigma': 0.}
drive = 1.5
weight = 0.5
# simulation parameters
simtime = 100.
dt = 0.001
nest.set_verbosity('M_WARNING')
nest.ResetKernel()
nest.SetKernelStatus(
{'resolution': dt, 'use_wfr': True, 'print_time': False})
# set up rate neuron network
rate_neuron_drive = nest.Create(
'lin_rate_ipn', params={'mu': drive, 'sigma': 0.})
rate_neuron_1 = nest.Create(
'lin_rate_ipn', params=neuron_params)
rate_neuron_2 = nest.Create(
'lin_rate_ipn', params=neuron_params)
multimeter = nest.Create(
'multimeter', params={
'record_from': ['rate'],
'precision': 10,
'interval': dt})
# create new connection
nest.CopyModel('rate_connection_instantaneous', 'rate_connection_new')
# record rates and connect neurons
neurons = rate_neuron_1 + rate_neuron_2
nest.Connect(
multimeter, neurons, 'all_to_all', {'delay': 10.})
nest.Connect(rate_neuron_drive, rate_neuron_1,
'all_to_all', {'model': 'rate_connection_instantaneous',
'weight': weight})
nest.Connect(rate_neuron_drive, rate_neuron_2,
'all_to_all', {'model': 'rate_connection_new',
'weight': weight})
# simulate
nest.Simulate(simtime)
# make sure rates are identical
events = nest.GetStatus(multimeter)[0]['events']
senders = events['senders']
rate_1 = np.array(events['rate'][np.where(senders == rate_neuron_1)])
rate_2 = np.array(events['rate'][np.where(senders == rate_neuron_2)])
assert(np.sum(np.abs(rate_2 - rate_1)) < 1e-12)
示例15: run_protocol
def run_protocol(self, dt):
"""Set up a network with pre-post spike pairings with t_post - t_pre = dt"""
nest.set_verbosity("M_WARNING")
nest.ResetKernel()
# set pre and postsynaptic spike times
delay = 1. # delay for connections
dspike = 100. # ISI
# set the correct real spike times for generators (correcting for delays)
pre_times = [100., 100. + dspike]
post_times = [k+dt for k in pre_times]
# create spike_generators with these times
pre_spikes = nest.Create("spike_generator", 1, {"spike_times": pre_times})
post_spikes = nest.Create("spike_generator", 1, {"spike_times": post_times})
# create parrot neurons and connect spike_generators
pre_parrot = nest.Create("parrot_neuron", 1)
post_parrot = nest.Create("parrot_neuron", 1)
nest.Connect(pre_spikes, pre_parrot, syn_spec={"delay": delay})
nest.Connect(post_spikes, post_parrot, syn_spec={"delay": delay})
# create spike detector
spikes = nest.Create("spike_detector")
nest.Connect(pre_parrot, spikes)
nest.Connect(post_parrot, spikes)
# connect both parrot neurons with a stdp synapse onto port 1
# thereby spikes transmitted through the stdp connection are
# not repeated postsynaptically.
syn_spec = {
"model": "stdp_synapse",
"receptor_type": 1, # set receptor 1 postsynaptically, to not generate extra spikes
}
conn_spec = {
"rule": "one_to_one",
}
nest.Connect(pre_parrot, post_parrot, syn_spec=syn_spec, conn_spec=conn_spec)
# get STDP synapse and weight before protocol
syn = nest.GetConnections(source=pre_parrot, synapse_model="stdp_synapse")
syn_status = nest.GetStatus(syn)[0]
w_pre = syn_status['weight']
last_time = max(pre_times[-1], post_times[-1])
nest.Simulate(last_time + 2 * delay)
# get weight post protocol
syn_status = nest.GetStatus(syn)[0]
w_post = syn_status['weight']
return w_pre, w_post