diff --git a/conda_build/meta.yaml b/conda_build/meta.yaml index 2b8ccf2..8923d12 100644 --- a/conda_build/meta.yaml +++ b/conda_build/meta.yaml @@ -37,11 +37,11 @@ test: - neurodynex.test commands: - - nosetests neurodynex.test.test_LIF - - nosetests neurodynex.test.test_HH - - nosetests neurodynex.test.test_hopfield - - nosetests neurodynex.test.test_nagumo - - nosetests neurodynex.test.test_neuron_type + - nosetests --verbosity=2 neurodynex.test.test_LIF + - nosetests --verbosity=2 neurodynex.test.test_HH + - nosetests --verbosity=2 neurodynex.test.test_hopfield + - nosetests --verbosity=2 neurodynex.test.test_nagumo + - nosetests --verbosity=2 neurodynex.test.test_neuron_type requires: - nose diff --git a/neurodynex/hopfield_network/hopfield.py b/neurodynex/hopfield_network/hopfield.py index f3e43d2..70993ab 100644 --- a/neurodynex/hopfield_network/hopfield.py +++ b/neurodynex/hopfield_network/hopfield.py @@ -26,14 +26,12 @@ import matplotlib.pyplot as plt import numpy as np from copy import copy -from time import sleep import pickle import gzip from pkg_resources import resource_filename import sys plot_dic = {'cmap': plt.cm.gray, 'interpolation': 'nearest'} -plt.ion() class HopfieldNetwork: @@ -166,7 +164,7 @@ def run(self, t_max=20, mu=0, flip_ratio=0, do_plot=True): overlap = [self.overlap(mu)] # prepare the figure - plt.figure() + fig = plt.figure() # plot the current network state plt.subplot(221) @@ -191,7 +189,7 @@ def run(self, t_max=20, mu=0, flip_ratio=0, do_plot=True): plt.ylabel('overlap') # this forces pylab to update and show the fig. - plt.draw() + fig.show() x_old = copy(self.x) for i in range(t_max): @@ -215,7 +213,7 @@ def run(self, t_max=20, mu=0, flip_ratio=0, do_plot=True): x_old = copy(self.x) # sleep for replotting - sleep(0.5) + plt.pause(0.5) print("Pattern recovered in %i time steps." % i_fin + " Final overlap %.3f" % overlap[-1])