• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python utility.get_simulator函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyNN.utility.get_simulator函数的典型用法代码示例。如果您正苦于以下问题:Python get_simulator函数的具体用法?Python get_simulator怎么用?Python get_simulator使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: initialize

def initialize():
    global sim
    global options
    global extra
    global rngseed
    global parallel_safe
    global rng
    global n_ext
    global n_exc
    global n_inh
    
    sim, options = get_simulator(
        ("--plot-figure", "Plot the connections to a file."))

    init_logging(None, debug=True)

    # === General parameters =================================================

    threads = 1
    rngseed = 98765
    parallel_safe = True
    rng = NumpyRNG(seed=rngseed, parallel_safe=parallel_safe)

    # === general network parameters (except connections) ====================

    n_ext = 60   # number of external stimuli
    n_exc = 60  # number of excitatory cells
    n_inh = 60  # number of inhibitory cells

    # === Options ============================================================

    extra = {'loglevel': 2, 'useSystemSim': True,
            'maxNeuronLoss': 0., 'maxSynapseLoss': 0.4,
            'hardwareNeuronSize': 8,
            'threads': threads,
            'filename': "connections.xml",
            'label': 'VA'}
    if sim.__name__ == "pyNN.hardware.brainscales":
        extra['hardware'] = sim.hardwareSetup['small']

    if options.simulator == "neuroml":
        extra["file"] = "connections.xml"
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:42,代码来源:connections.py


示例2: get_simulator

Usage: varying_poisson.py [-h] [--plot-figure] simulator

positional arguments:
  simulator      neuron, nest, brian or another backend simulator

optional arguments:
  -h, --help     show this help message and exit
  --plot-figure  Plot the simulation results to a file.
"""

import numpy as np
from pyNN.utility import get_simulator, normalized_filename, ProgressBar
from pyNN.utility.plotting import Figure, Panel

sim, options = get_simulator(("--plot-figure", "Plot the simulation results to a file.",
                              {"action": "store_true"}))

rate_increment = 20
interval = 200

class SetRate(object):
    """
    A callback which changes the firing rate of a population of poisson
    processes at a fixed interval.
    """

    def __init__(self, population, rate_generator, interval=20.0):
        assert isinstance(population.celltype, sim.SpikeSourcePoisson)
        self.population = population
        self.interval = interval
        self.rate_generator = rate_generator
开发者ID:codeteam17,项目名称:spiked,代码行数:31,代码来源:time-dependent-poisson.py


示例3: get_simulator

    inhibitory_cells = sim.create(iaf_neuron, n=n_inh)
    inputs = sim.create(sim.SpikeSourcePoisson(**stimulation_params), n=n_input)
    all_cells = excitatory_cells + inhibitory_cells
    sim.initialize(all_cells, v=cell_params['v_rest'])

    sim.connect(excitatory_cells, all_cells, weight=w_exc, delay=delay,
                receptor_type='excitatory', p=pconn_recurr)
    sim.connect(inhibitory_cells, all_cells, weight=w_exc, delay=delay,
                receptor_type='inhibitory', p=pconn_recurr)
    sim.connect(inputs, all_cells, weight=w_input, delay=delay,
                receptor_type='excitatory', p=pconn_input)
    sim.record('spikes', all_cells, "scenario1a_%s_spikes.pkl" % sim.__name__)
    sim.record('v', excitatory_cells[0:2], "scenario1a_%s_v.pkl" % sim.__name__)

    sim.run(tstop)

    E_count = excitatory_cells.mean_spike_count()
    I_count = inhibitory_cells.mean_spike_count()
    print "Excitatory rate        : %g Hz" % (E_count*1000.0/tstop,)
    print "Inhibitory rate        : %g Hz" % (I_count*1000.0/tstop,)
    sim.end()
    for filename in glob.glob("scenario1a_*"):
        os.remove(filename)


if __name__ == '__main__':
    from pyNN.utility import get_simulator
    sim, args = get_simulator()
    scenario1(sim)
    scenario1a(sim)
开发者ID:jakobj,项目名称:PyNN,代码行数:30,代码来源:scenario1.py


示例4: get_simulator

"""
Network of integrate-and-fire neurons with distance-dependent connectivity and STDP.
"""

from pyNN.utility import get_simulator
sim, options = get_simulator()
from pyNN import space

n_exc = 80
n_inh = 20
n_stim = 20
cell_parameters = {
    'tau_m' : 20.0,    'tau_syn_E': 2.0,    'tau_syn_I': 5.0,
    'v_rest': -65.0,   'v_reset'  : -70.0,  'v_thresh':  -50.0,
    'cm':     1.0,     'tau_refrac': 2.0,   'e_rev_E':   0.0,
    'e_rev_I': -70.0,
}
grid_parameters = {
    'aspect_ratio': 1, 'dx': 50.0, 'dy': 50.0, 'fill_order': 'random'
}
stimulation_parameters = {
    'rate': 100.0,
    'duration': 50.0
}

connectivity_parameters = {
    'gaussian': {'d_expression': 'exp(-d**2/1e4)'},
    'global': {'p_connect': 0.1},
    'input': {'n': 10},
}
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:30,代码来源:stdp_network.py


示例5: replace


# ADDITIONAL FUNCTIONS ---------------------------------------------------------

def replace(dic, keys,value):
    getValue(dic,keys[:-1])[keys[-1]]=value

def getValue(dic, keys):
    return reduce(lambda d, k: d[k], keys, dic)


sim, opts = get_simulator(
        ("--analysis", "Perform analysis only", {"type":bool}),
        ("--remove", "Remove data files (after analysis)", {"type":bool}),
        ("--folder", "Folder to save the data in (created if it does not exists)", {"dest":"data_folder", "required":True}),
        ("--params", "Parameter filename", {"dest":"param_file", "required":True}),
        ("--search", "Parameter search filename", {"dest":"search_file"}),
        ("--map",    "Produce a map of 2D parameter search", {"type":bool}),
        ("--debug", "Print debugging information")
    )

if opts.debug:
    init_logging(None, debug=True)

if opts.analysis:
    print "Running analysis and plotting only ..."

if opts.remove:
    print "Removing data files after analysis ..."

if opts.data_folder:
开发者ID:dguarino,项目名称:SlowDyn,代码行数:29,代码来源:run.py


示例6: assert_less

        assert_less(D, 0.1)

    return data
test_SpikeSourcePoissonRefractory.__test__ = False



@register()
def issue511(sim):
    """Giving SpikeSourceArray an array of non-ordered spike times should produce an InvalidParameterValueError error"""
    sim.setup()
    celltype = sim.SpikeSourceArray(spike_times=[[2.4, 4.8, 6.6, 9.4], [3.5, 6.8, 9.6, 8.3]])
    assert_raises(InvalidParameterValueError, sim.Population, 2, celltype)



# todo: add test of Izhikevich model


if __name__ == '__main__':
    from pyNN.utility import get_simulator
    sim, args = get_simulator(("--plot-figure",
                               {"help": "generate a figure",
                                "action": "store_true"}))
    test_EIF_cond_alpha_isfa_ista(sim, plot_figure=args.plot_figure)
    test_HH_cond_exp(sim, plot_figure=args.plot_figure)
    issue367(sim, plot_figure=args.plot_figure)
    test_SpikeSourcePoisson(sim, plot_figure=args.plot_figure)
    test_SpikeSourceGamma(sim, plot_figure=args.plot_figure)
    test_SpikeSourcePoissonRefractory(sim, plot_figure=args.plot_figure)
    issue511(sim)
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:31,代码来源:test_cell_types.py


示例7: get_simulator

optional arguments:
  -h, --help     show this help message and exit
  --plot-figure  Plot the simulation results to a file.
  --debug DEBUG  Print debugging information

"""

import matplotlib
matplotlib.use('Agg')
import numpy as np
from pyNN.utility import get_simulator, init_logging, normalized_filename


# === Configure the simulator ================================================

sim, options = get_simulator(("--plot-figure", "Plot the simulation results to a file.", {"action": "store_true"}),
                             ("--debug", "Print debugging information"))

if options.debug:
    init_logging(None, debug=True)

sim.setup(quit_on_end=False)


# === Build and instrument the network =======================================

spike_times = np.hstack((np.arange(10, 100, 10), np.arange(250, 350, 10)))
spike_source = sim.Population(1, sim.SpikeSourceArray(spike_times=spike_times))

connector = sim.AllToAllConnector()

depressing = dict(U=0.8, tau_rec=100.0, tau_facil=0.0, weight=0.01, delay=0.5)
开发者ID:NeuralEnsemble,项目名称:PyNN,代码行数:32,代码来源:stochastic_tsodyksmarkram.py


示例8: get_simulator

    "cm": 1.0,  # (nF)
    "tau_refrac": firing_period / 2,  # (ms) long refractory period to prevent bursting
}
n = 60  # number of synapses / number of presynaptic neurons
delta_t = 1.0  # (ms) time difference between the firing times of neighbouring neurons
t_stop = 10 * firing_period + n * delta_t
delay = 3.0  # (ms) synaptic time delay


# === Configure the simulator ===============================================

sim, options = get_simulator(
    ("--plot-figure", "Plot the simulation results to a file", {"action": "store_true"}),
    ("--fit-curve", "Calculate the best-fit curve to the weight-delta_t measurements", {"action": "store_true"}),
    (
        "--dendritic-delay-fraction",
        "What fraction of the total transmission delay is due to dendritic propagation",
        {"default": 1},
    ),
    ("--debug", "Print debugging information"),
)

if options.debug:
    init_logging(None, debug=True)

sim.setup(timestep=0.01, min_delay=delay, max_delay=delay)


# === Build the network =====================================================


def build_spike_sequences(period, duration, n, delta_t):
开发者ID:pgleeson,项目名称:PyNN,代码行数:32,代码来源:simple_STDP.py


示例9: get_simulator

"""

import os
import socket
from math import *
from pyNN.utility import get_simulator, Timer, ProgressBar, init_logging, normalized_filename
from pyNN.random import NumpyRNG, RandomDistribution


# === Configure the simulator ================================================

sim, options = get_simulator(
                    ("benchmark", "either CUBA or COBA"),
                    ("--plot-figure", "plot the simulation results to a file", {"action": "store_true"}),
                    ("--use-views", "use population views in creating the network", {"action": "store_true"}),
                    ("--use-assembly", "use assemblies in creating the network", {"action": "store_true"}),
                    ("--use-csa", "use the Connection Set Algebra to define the connectivity", {"action": "store_true"}),
                    ("--debug", "print debugging information"))

if options.use_csa:
    import csa

if options.debug:
    init_logging(None, debug=True)

timer = Timer()

# === Define parameters ========================================================

threads  = 1
开发者ID:Huitzilo,项目名称:PyNN,代码行数:30,代码来源:VAbenchmarks.py


示例10: get_simulator

"""
Test of the EIF_cond_alpha_isfa_ista model

Andrew Davison, UNIC, CNRS
December 2007

"""

from pyNN.utility import get_simulator, normalized_filename

sim, options = get_simulator(("--plot-figure",
                              "Plot the simulation results to a file."))

sim.setup(timestep=0.01, min_delay=0.1, max_delay=4.0)

cell_type = sim.EIF_cond_alpha_isfa_ista(i_offset=1.0, tau_refrac=2.0, v_spike=-40)
ifcell = sim.create(cell_type)
print ifcell[0].get_parameters()

filename = normalized_filename("Results", "EIF_cond_alpha_isfa_ista", "pkl",
                               options.simulator)
sim.record('v', ifcell, filename, annotations={'script_name': __file__})
sim.run(200.0)

if options.plot_figure:
    from pyNN.utility.plotting import Figure, Panel
    data = ifcell.get_data().segments[0]
    vm = data.filter(name="v")[0]
    Figure(
        Panel(vm, ylabel="Membrane potential (mV)", xlabel="Time (ms)",
              xticks=True),
开发者ID:jakobj,项目名称:PyNN,代码行数:31,代码来源:EIF_cond_alpha_isfa_ista.py


示例11: get_simulator

Usage: python VAbenchmarks.py <simulator> <benchmark>

    <simulator> is either neuron, nest, brian or pcsim
    <benchmark> is either CUBA or COBA.

Andrew Davison, UNIC, CNRS
August 2006

"""

import os
import socket
from math import *

from pyNN.utility import get_simulator, Timer, ProgressBar, init_logging, normalized_filename
sim, options = get_simulator(("benchmark", "Either CUBA or COBA"))

from pyNN.random import NumpyRNG, RandomDistribution

init_logging(None, debug=True)
timer = Timer()

# === Define parameters ========================================================

threads  = 1
rngseed  = 98765
parallel_safe = True

n        = 4000  # number of cells
r_ei     = 4.0   # number of excitatory cells:number of inhibitory cells
pconn    = 0.02  # connection probability
开发者ID:jakobj,项目名称:PyNN,代码行数:31,代码来源:VAbenchmarks.py


示例12: get_simulator

    "v_reset": -60.0,    # (mV)
    "v_rest": -60.0,     # (mV)
    "cm": 1.0,           # (nF)
    "tau_refrac": 20,    # (ms) long refractory period to prevent bursting
}

n = 256                  # number of synapses / number of presynaptic neurons
t_stop = 0               # defined later if is == 0
delay = 3.0              # (ms) synaptic time delay
episodes = 5;


# === Configure the simulator ===============================================

sim, options = get_simulator(("--plot-figure", "Plot the simulation results to a file", {"action": "store_true"}),
                             ("--fit-curve", "Calculate the best-fit curve to the weight-delta_t measurements", {"action": "store_true"}),
                             ("--debug", "Print debugging information"))

if options.debug:
    init_logging(None, debug=True)

sim.setup(timestep=0.01, min_delay=delay, max_delay=delay)


# === Build the network =====================================================

def get_data(filename):
    dvs_data = scipy.io.loadmat(filename)
    ts = dvs_data['ts'][0]
    ts = (ts - ts[0])/1000 #from ns to ms
    x = dvs_data['X'][0]
开发者ID:darioml,项目名称:fyp-public,代码行数:31,代码来源:ball_trajectories.py


示例13: open

              "command_line_options": options,
              "timestamp": timestamp}
    with open("I_f_curve.json", 'r') as f:
        output["configuration"] = {"model": json.load(f)}
    print("RESULTS")
    print(output)  # debug
    with open("results/%s/%s.json" % (timestamp, BENCHMARK_NAME), 'w') as f:
        json.dump(output, f, indent=4)


def benchmarks(sim, **options):
    from spike_train_statistics import run_model
    data, times = run_model(sim, **options)
    timestamp = datetime.now().isoformat()
    if not os.path.exists("results/" + timestamp):
        os.makedirs("results/" + timestamp)
    results = []
    results.append(analysis_quality(data, timestamp, **options))
    results = analysis_performance(times, results)
    output_result(results, options, timestamp)


if __name__ == '__main__':
    try:
        from pyNN.utility import get_simulator  # PyNN 0.8
    except ImportError:
        from utility import get_simulator

    sim, options = get_simulator(("--plot-figure", "plot a graph of the result"))
    benchmarks(sim=sim, **vars(options))
开发者ID:CNRS-UNIC,项目名称:hardware-benchmarks,代码行数:30,代码来源:run_spike_train_statistics.py


示例14: import

"""
Example of using a cell type defined in 9ML
"""

import sys
from copy import deepcopy
from nineml.abstraction import (
    Dynamics, Regime, On, OutputEvent, StateVariable, AnalogReceivePort,
    AnalogReducePort, AnalogSendPort, EventSendPort, Parameter)
from nineml import units as un
from pyNN.utility import init_logging, get_simulator, normalized_filename

sim, options = get_simulator(("--plot-figure", "plot a figure with the given filename"))

init_logging(None, debug=True)

sim.setup(timestep=0.1, min_delay=0.1, max_delay=2.0)


iaf = Dynamics(
    name="iaf",
    regimes=[
        Regime(
            name="subthresholdregime",
            time_derivatives=["dV/dt = ( gl*( vrest - V ) + ISyn)/(cm)"],
            transitions=On("V > vthresh",
                           do=["tspike = t",
                               "V = vreset",
                               OutputEvent('spikeoutput')],
                           to="refractoryregime"),
        ),
开发者ID:HBPNeurorobotics,项目名称:PyNN,代码行数:31,代码来源:nineml_neuron.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utility.init_logging函数代码示例发布时间:2022-05-25
下一篇:
Python utility.get_script_args函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap