From 1a936130516ff77a2d6a8783cb0a0081d21b6fa1 Mon Sep 17 00:00:00 2001 From: Marcel Stimberg Date: Mon, 22 Jul 2013 15:56:58 +0200 Subject: [PATCH] Make sure all examples work --- examples/I-F_curve_Hodgkin_Huxley.py | 8 +++----- examples/I-F_curve_LIF.py | 2 ++ examples/non_reliability.py | 2 ++ examples/phase_locking.py | 2 ++ examples/synapses.py | 3 ++- examples/synapses_STDP.py | 2 ++ examples/synapses_gapjunctions.py | 2 ++ examples/synapses_licklider.py | 6 ++++-- examples/synapses_nonlinear.py | 2 ++ examples/synapses_state_variables.py | 2 ++ 10 files changed, 23 insertions(+), 8 deletions(-) diff --git a/examples/I-F_curve_Hodgkin_Huxley.py b/examples/I-F_curve_Hodgkin_Huxley.py index 47e7a8d1d..241a14a7c 100644 --- a/examples/I-F_curve_Hodgkin_Huxley.py +++ b/examples/I-F_curve_Hodgkin_Huxley.py @@ -10,8 +10,7 @@ BrianLogger.log_level_info() -language = PythonLanguage() -#language = CPPLanguage() +#brian_prefs.codegen.target = 'weave' N = 100 @@ -38,9 +37,8 @@ I : amp ''') # Threshold and refractoriness are only used for spike counting -group = NeuronGroup(N, model=eqs, threshold='is_active * (v > -40*mV)', - language=language) -group.refractory = 1*ms +group = NeuronGroup(N, model=eqs, threshold='not_refractory and (v > -40*mV)', + refractory='v > -40*mV') group.v = El group.I = linspace(0 * nA, 0.7 * nA, N) diff --git a/examples/I-F_curve_LIF.py b/examples/I-F_curve_LIF.py index 2be32fca8..e65791285 100644 --- a/examples/I-F_curve_LIF.py +++ b/examples/I-F_curve_LIF.py @@ -8,6 +8,8 @@ from pylab import * from brian2 import * +#brian_prefs.codegen.target = 'weave' + N = 1000 tau = 10 * ms eqs = ''' diff --git a/examples/non_reliability.py b/examples/non_reliability.py index 14f20470e..768893164 100644 --- a/examples/non_reliability.py +++ b/examples/non_reliability.py @@ -10,6 +10,8 @@ from pylab import * from brian2 import * +#brian_prefs.codegen.target = 'weave' + N = 25 tau = 20 * ms sigma = .015 diff --git a/examples/phase_locking.py b/examples/phase_locking.py index d9a0fc9a1..40338bbb8 100644 --- a/examples/phase_locking.py +++ b/examples/phase_locking.py @@ -5,6 +5,8 @@ from pylab import * from brian2 import * +#brian_prefs.codegen.target = 'weave' + tau = 20 * ms N = 100 b = 1.2 # constant current mean, the modulation varies diff --git a/examples/synapses.py b/examples/synapses.py index da733b868..45e691b81 100644 --- a/examples/synapses.py +++ b/examples/synapses.py @@ -1,8 +1,9 @@ -import numpy as np import matplotlib.pyplot as plt from brian2 import * +#brian_prefs.codegen.target = 'weave' + G1 = NeuronGroup(10, 'dv/dt = -v / (10*ms) : 1', threshold='v > 1', reset='v=0.') diff --git a/examples/synapses_STDP.py b/examples/synapses_STDP.py index 5df3c4fb7..4afa699e8 100644 --- a/examples/synapses_STDP.py +++ b/examples/synapses_STDP.py @@ -9,6 +9,8 @@ import matplotlib.pyplot as plt from time import time +#brian_prefs.codegen.target = 'weave' + N = 1000 taum = 10 * ms taupre = 20 * ms diff --git a/examples/synapses_gapjunctions.py b/examples/synapses_gapjunctions.py index 253ef2ed0..02dc5b547 100755 --- a/examples/synapses_gapjunctions.py +++ b/examples/synapses_gapjunctions.py @@ -7,6 +7,8 @@ from brian2 import * +#brian_prefs.codegen.target = 'weave' + N = 10 v0 = 1.05 tau = 10*ms diff --git a/examples/synapses_licklider.py b/examples/synapses_licklider.py index b57ac160f..8fd0eabac 100644 --- a/examples/synapses_licklider.py +++ b/examples/synapses_licklider.py @@ -7,14 +7,16 @@ from pylab import * from brian2 import * +#brian_prefs.codegen.target = 'weave' + defaultclock.dt = .02 * ms # Ear and sound max_delay = 20 * ms # 50 Hz tau_ear = 1 * ms -sigma_ear = .1 +sigma_ear = .0 eqs_ear = ''' -dx/dt=(sound-x)/tau_ear+sigma_ear*(2./tau_ear)**.5*xi : 1 (unless-refractory) +dx/dt=(sound-x)/tau_ear+0.1*(2./tau_ear)**.5*xi : 1 (unless-refractory) sound=5*sin(2*pi*frequency*t)**3 : 1 # nonlinear distorsion #sound=5*(sin(4*pi*frequency*t)+.5*sin(6*pi*frequency*t)) : 1 # missing fundamental frequency=(200+200*t*Hz)*Hz : Hz # increasing pitch diff --git a/examples/synapses_nonlinear.py b/examples/synapses_nonlinear.py index 901c3432d..7259e3480 100755 --- a/examples/synapses_nonlinear.py +++ b/examples/synapses_nonlinear.py @@ -4,6 +4,8 @@ """ from brian2 import * +brian_prefs.codegen.target = 'weave' + a=1/(10*ms) b=1/(10*ms) c=1/(10*ms) diff --git a/examples/synapses_state_variables.py b/examples/synapses_state_variables.py index 9d28afc99..7c16cbb80 100644 --- a/examples/synapses_state_variables.py +++ b/examples/synapses_state_variables.py @@ -5,6 +5,8 @@ from brian2 import * import numpy as np +#brian_prefs.codegen.target = 'weave' + G = NeuronGroup(100, 'v:volt') G.v = '(sin(2*pi*i/_num_neurons) - 70 + 0.25*randn()) * mV' S = Synapses(G, G, 'w:volt', pre='v+=w')