本文整理汇总了Python中pyNN.utility.get_script_args函数的典型用法代码示例。如果您正苦于以下问题:Python get_script_args函数的具体用法?Python get_script_args怎么用?Python get_script_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_script_args函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_script_args
"""
Simple test of injecting noisy current into a cell
"""
import sys
from pyNN.utility import get_script_args, normalized_filename
simulator_name = get_script_args(1)[0]
exec("from pyNN.%s import *" % simulator_name)
setup()
filename = normalized_filename("Results", "NoisyCurrentInput", "pkl", simulator_name)
cells = Population(4, IF_curr_exp(v_thresh=-55.0, tau_refrac=5.0))
mean=0.55
stdev=0.1
start=50.0
stop=450.0
steady = DCSource(amplitude=mean, start=start, stop=stop)
cells[0].inject(steady)
noise1 = NoisyCurrentSource(mean=mean, stdev=stdev, start=start, stop=stop, dt=1.0)
cells[1].inject(noise1)
#record('i', noise0, filename)
noise2 = NoisyCurrentSource(mean=mean, stdev=stdev, start=start, stop=stop, dt=5)
cells[2].inject(noise2)
示例2: get_script_args
from pyNN.utility import get_script_args, Timer
import numpy as np
import matplotlib.pyplot as plt
from connector_functions import load_positions, load_lgn_spikes, return_lgn_starting_coordinates
import pyNN.space as space
from connector_functions import create_cortical_to_cortical_connection
from connector_functions import normalize_connection_list
from connector_functions import create_cortical_to_cortical_connection_corr
from connector_functions import create_thalamocortical_connection
from analysis_functions import calculate_tuning, visualize_conductances, visualize_conductances_and_voltage
from analysis_functions import conductance_analysis
from plot_functions import plot_spiketrains
#############################
simulator = get_script_args(1)[0]
exec("import pyNN.%s as simulator" % simulator)
#import pyNN.nest as simulator
#import pyNN.neuron as simulator
timer = Timer()
#############################
## Parameters
#############################
# ============== Network and simulation parameters =================
contrast = 0.50 # Contrast used (possible range available in ./data)
Nside_lgn = 30 # N_lgn x N_lgn is the size of the LGN
示例3: get_script_args
Andrew Davison, UNIC, CNRS
March 2010
$Id: $
"""
import os
import socket
from math import *
from pyNN.utility import get_script_args, Timer, ProgressBar
usage = """Usage: python VAbenchmarks.py <simulator> <benchmark>
<simulator> is either neuron, nest, brian or pcsim
<benchmark> is either CUBA or COBA."""
simulator_name, benchmark = get_script_args(2, usage)
exec("from pyNN.%s import *" % simulator_name)
from pyNN.random import NumpyRNG, RandomDistribution
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
stim_dur = 50. # (ms) duration of random stimulation
示例4: get_script_args
"""
Simple network with a Poisson spike source projecting to populations of of IF_cond_exp neurons
"""
import time
import numpy as np
import numpy.random as rnd
from pyNN.utility import get_script_args
simulator_name = get_script_args(1)[0]
exec("from pyNN.%s import *" % simulator_name)
if (len(get_script_args(1)) > 1):
sim_cnt = get_script_args(1)[1]
else:
sim_cnt = 0
print "DEBUG sim_cnt:", sim_cnt
# # # # # # # # # # # # # # # # # # # # #
# Simulation parameters #
# # # # # # # # # # # # # # # # # # # # #
import simulation_parameters
network_params = simulation_parameters.parameter_storage() # network_params class containing the simulation parameters
params = network_params.load_params() # params stores cell numbers, etc as a dictionary
# # # # # # # # # # # #
# S E T U P #
# # # # # # # # # # # #
setup()# timestep=0.1, min_delay=0.1, max_delay=1.0)
rng = NumpyRNG(seed = params['seed'], parallel_safe=True) #if True, slower but does not depend on number of nodes
v_init_distr = RandomDistribution('normal',
示例5: test_get_script_args
def test_get_script_args(self):
utility.get_script_args(0)
示例6: get_script_args
"""
Very simple STDP test
Andrew Davison, UNIC, CNRS
January 2008
$Id: simple_STDP.py 607 2009-05-19 15:04:35Z apdavison $
"""
import numpy
from pyNN.utility import get_script_args
sim_name = get_script_args(1)[0]
exec("from pyNN.%s import *" % sim_name)
setup(timestep=0.001, min_delay=0.1, max_delay=1.0, debug=True, quit_on_end=False)
p1 = Population(1, SpikeSourceArray, {'spike_times': numpy.arange(1, 50, 1.0)})
p2 = Population(1, IF_curr_exp)
stdp_model = STDPMechanism(timing_dependence=SpikePairRule(tau_plus=20.0, tau_minus=20.0),
weight_dependence=AdditiveWeightDependence(w_min=0, w_max=0.8,
A_plus=0.01, A_minus=0.012))
connection_method = AllToAllConnector(weights=0.48, delays=0.2)
prj = Projection(p1, p2, method=connection_method,
synapse_dynamics=SynapseDynamics(slow=stdp_model))
p1.record()
p2.record()
p2.record_v()
示例7: describe
synapse_dynamics = self._build_synapse_dynamics(nineml_projection)
prj_obj = self.sim.Projection(
populations[nineml_projection.source.name],
populations[nineml_projection.target.name],
connector,
target=target,
synapse_dynamics=synapse_dynamics,
label=nineml_projection.name)
self.projections[prj_obj.label] = prj_obj # need to add assembly label to make the name unique
def describe(self):
description = "Network model generated from a 9ML description, consisting of:\n "
description += "\n ".join(a.describe() for a in self.assemblies.values()) + "\n"
description += "\n ".join(prj.describe() for prj in self.projections.values())
return description
if __name__ == "__main__":
# For testing purposes: read in the network and print its description
# if using the nineml or neuroml backend, re-export the network as XML (this doesn't work, but it should).
import sys, os
from pyNN.utility import get_script_args
nineml_file, simulator_name = get_script_args(2, "Please specify the 9ML file and the simulator backend.")
exec("import pyNN.%s as sim" % simulator_name)
sim.setup(filename="%s_export.xml" % os.path.splitext(nineml_file)[0])
network = Network(sim, nineml_file)
print(network.describe())
sim.end()
示例8: get_script_args
"""
Network of integrate-and-fire neurons with distance-dependent connectivity and STDP.
"""
from pyNN.utility import get_script_args
usage = """Usage: python stdp_network.py <simulator>"""
simulator_name, = get_script_args(1, usage)
exec("import pyNN.%s as sim" % simulator_name)
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},