Skip to content

Commit

Permalink
Merge pull request #196 from jougs/fix-pynest-test-failures
Browse files Browse the repository at this point in the history
Fix pylab and matplotlib imports
  • Loading branch information
jougs committed Dec 17, 2015
2 parents c3be899 + a3afcda commit 470bf93
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 39 deletions.
31 changes: 15 additions & 16 deletions pynest/examples/mc_neuron.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@
'''

import nest
import matplotlib
import pylab as pl
import pylab

nest.ResetKernel()

Expand Down Expand Up @@ -178,22 +177,22 @@
V_m.s,V_m.p,V_m.d state for the membrane potential in soma, proximal and distal dendrites.
'''

pl.figure()
pl.subplot(211)
pl.plot(t, rec['V_m.s'], t, rec['V_m.p'], t, rec['V_m.d'])
pl.legend(('Soma', 'Proximal dendrite', 'Distal dendrite'),loc='lower right')
pl.axis([0, 1000, -76, -59])
pl.ylabel('Membrane potential [mV]')
pl.title('Responses of iaf_cond_alpha_mc neuron')
pylab.figure()
pylab.subplot(211)
pylab.plot(t, rec['V_m.s'], t, rec['V_m.p'], t, rec['V_m.d'])
pylab.legend(('Soma', 'Proximal dendrite', 'Distal dendrite'),loc='lower right')
pylab.axis([0, 1000, -76, -59])
pylab.ylabel('Membrane potential [mV]')
pylab.title('Responses of iaf_cond_alpha_mc neuron')

'''
Plot time traces of the synaptic conductance measured in different compartments.
'''

pl.subplot(212)
pl.plot(t, rec['g_ex.s'], 'b-', t, rec['g_ex.p'], 'g-', t, rec['g_ex.d'], 'r-')
pl.plot(t, rec['g_in.s'], 'b--', t, rec['g_in.p'], 'g--', t, rec['g_in.d'], 'r--')
pl.legend(('g_ex.s', 'g_ex.p', 'g_in.d','g_in.s', 'g_in.p', 'g_in.d'))
pl.axis([350, 700, 0, 1.15])
pl.xlabel('Time [ms]')
pl.ylabel('Synaptic conductance [nS]')
pylab.subplot(212)
pylab.plot(t, rec['g_ex.s'], 'b-', t, rec['g_ex.p'], 'g-', t, rec['g_ex.d'], 'r-')
pylab.plot(t, rec['g_in.s'], 'b--', t, rec['g_in.p'], 'g--', t, rec['g_in.d'], 'r--')
pylab.legend(('g_ex.s', 'g_ex.p', 'g_in.d','g_in.s', 'g_in.p', 'g_in.d'))
pylab.axis([350, 700, 0, 1.15])
pylab.xlabel('Time [ms]')
pylab.ylabel('Synaptic conductance [nS]')
30 changes: 15 additions & 15 deletions pynest/examples/multimeter_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
'''

import nest
import numpy as np
import pylab as pl
import numpy
import pylab

nest.ResetKernel()

Expand Down Expand Up @@ -101,9 +101,9 @@
"label": "my_multimeter"})

s_ex = nest.Create("spike_generator",
params = {"spike_times": np.array([10.0, 20.0, 50.0])})
params = {"spike_times": numpy.array([10.0, 20.0, 50.0])})
s_in = nest.Create("spike_generator",
params = {"spike_times": np.array([15.0, 25.0, 55.0])})
params = {"spike_times": numpy.array([15.0, 25.0, 55.0])})

'''
Next, the spike generators are connected to the neuron with `Connect`. Synapse
Expand Down Expand Up @@ -137,16 +137,16 @@
conductance are displayed.
'''

pl.clf()
pylab.clf()

pl.subplot(211)
pl.plot(t, events["V_m"])
pl.axis([0, 100, -75, -53])
pl.ylabel("membrane potential (mV)")
pylab.subplot(211)
pylab.plot(t, events["V_m"])
pylab.axis([0, 100, -75, -53])
pylab.ylabel("membrane potential (mV)")

pl.subplot(212)
pl.plot(t, events["g_ex"], t, events["g_in"])
pl.axis([0, 100, 0, 45])
pl.xlabel("time (ms)")
pl.ylabel("synaptic conductance (nS)")
pl.legend(("g_exc", "g_inh"))
pylab.subplot(212)
pylab.plot(t, events["g_ex"], t, events["g_in"])
pylab.axis([0, 100, 0, 45])
pylab.xlabel("time (ms)")
pylab.ylabel("synaptic conductance (nS)")
pylab.legend(("g_exc", "g_inh"))
2 changes: 0 additions & 2 deletions pynest/examples/twoneurons.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see <http://www.gnu.org/licenses/>.

import matplotlib
# matplotlib.use("macosx")
import pylab

import nest
Expand Down
10 changes: 5 additions & 5 deletions pynest/examples/vinit_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

import nest
import numpy
import pylab as pl
import pylab

'''
A loop runs over a range of initial membrane voltages.
Expand Down Expand Up @@ -79,12 +79,12 @@
t = nest.GetStatus(voltmeter,"events")[0]["times"]
v = nest.GetStatus(voltmeter,"events")[0]["V_m"]

pl.plot(t, v, label="initial V_m = %.2f mV" % vinit)
pylab.plot(t, v, label="initial V_m = %.2f mV" % vinit)

'''
Set the legend and the labels for the plot outside of the loop.
'''

pl.legend(loc=4)
pl.xlabel("time (ms)")
pl.ylabel("V_m (mV)")
pylab.legend(loc=4)
pylab.xlabel("time (ms)")
pylab.ylabel("V_m (mV)")
1 change: 0 additions & 1 deletion pynest/nest/tests/test_connect_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import numpy as np
import scipy.stats
import nest
import matplotlib.pylab as plt
from scipy.stats import truncexpon

try:
Expand Down

0 comments on commit 470bf93

Please sign in to comment.