本文整理汇总了Python中brian2.NeuronGroup.V方法的典型用法代码示例。如果您正苦于以下问题:Python NeuronGroup.V方法的具体用法?Python NeuronGroup.V怎么用?Python NeuronGroup.V使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类brian2.NeuronGroup
的用法示例。
在下文中一共展示了NeuronGroup.V方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _build_model
# 需要导入模块: from brian2 import NeuronGroup [as 别名]
# 或者: from brian2.NeuronGroup import V [as 别名]
def _build_model(self, traj, brian_list, network_dict):
"""Builds the neuron groups from `traj`.
Adds the neuron groups to `brian_list` and `network_dict`.
"""
model = traj.parameters.model
# Create the equations for both models
eqs_dict = self._build_model_eqs(traj)
# Create inhibitory neurons
eqs_i = eqs_dict['i']
neurons_i = NeuronGroup(N=model.N_i,
model = eqs_i,
threshold=model.V_th,
reset=model.reset_func,
refractory=model.refractory,
method='Euler')
# Create excitatory neurons
eqs_e = eqs_dict['e']
neurons_e = NeuronGroup(N=model.N_e,
model = eqs_e,
threshold=model.V_th,
reset=model.reset_func,
refractory=model.refractory,
method='Euler')
# Set the bias terms
neurons_e.mu =rand(model.N_e) * (model.mu_e_max - model.mu_e_min) + model.mu_e_min
neurons_i.mu =rand(model.N_i) * (model.mu_i_max - model.mu_i_min) + model.mu_i_min
# Set initial membrane potentials
neurons_e.V = rand(model.N_e)
neurons_i.V = rand(model.N_i)
# Add both groups to the `brian_list` and the `network_dict`
brian_list.append(neurons_i)
brian_list.append(neurons_e)
network_dict['neurons_e']=neurons_e
network_dict['neurons_i']=neurons_i
示例2: example_run
# 需要导入模块: from brian2 import NeuronGroup [as 别名]
# 或者: from brian2.NeuronGroup import V [as 别名]
def example_run(debug=False, **build_options):
'''
Run a simple example simulation that test whether the Brian2/Brian2GeNN/GeNN
pipeline is working correctly.
Parameters
----------
debug : bool
Whether to display debug information (e.g. compilation output) during
the run. Defaults to ``False``.
build_options : dict
Additional options that will be forwarded to the ``set_device`` call,
e.g. ``use_GPU=False``.
'''
from brian2.devices.device import set_device, reset_device
from brian2 import ms, NeuronGroup, run
from brian2.utils.logger import std_silent
import numpy as np
from numpy.testing import assert_allclose
from tempfile import mkdtemp
import shutil
with std_silent(debug):
test_dir = mkdtemp(prefix='brian2genn_test')
set_device('genn', directory=test_dir, debug=debug, **build_options)
N = 100
tau = 10*ms
eqs = '''
dV/dt = -V/tau: 1
'''
G = NeuronGroup(N, eqs, threshold='V>1', reset='V=0', refractory=5 * ms,
method='linear')
G.V = 'i/100.'
run(1*ms)
assert_allclose(G.V, np.arange(100)/100.*np.exp(-1*ms/tau))
shutil.rmtree(test_dir, ignore_errors=True)
reset_device()
print('Example run was successful.')