def test_plot_data(self): axl.seed(0) # Fingerprinting is a random process. af = AshlockFingerprint(axl.Cooperator()) af.fingerprint(turns=5, repetitions=3, step=0.5, progress_bar=False) reshaped_data = np.array([[0.0, 0.0, 0.0], [2.0, 1.0, 2.0], [3.0, 3.0, 3.0]]) plotted_data = af.plot().gca().images[0].get_array() np.testing.assert_allclose(plotted_data, reshaped_data)
def test_plot_data(self): axl.seed(0) # Fingerprinting is a random process. af = AshlockFingerprint(axl.Cooperator()) af.fingerprint(turns=5, repetitions=3, step=0.5, progress_bar=False) reshaped_data = np.array([[0.0, 0.0, 0.0], [2.0, 1.0, 2.0], [3.0, 3.0, 3.0]]) plotted_data = af.plot().gca().images[0].get_array() np.testing.assert_allclose(plotted_data, reshaped_data)
def test_plot_figure(self): af = AshlockFingerprint(axl.WinStayLoseShift, axl.TitForTat) af.fingerprint(turns=10, repetitions=2, step=0.25, progress_bar=False) p = af.plot() self.assertIsInstance(p, matplotlib.pyplot.Figure) q = af.plot(cmap="jet") self.assertIsInstance(q, matplotlib.pyplot.Figure) r = af.plot(interpolation="bicubic") self.assertIsInstance(r, matplotlib.pyplot.Figure) t = af.plot(title="Title") self.assertIsInstance(t, matplotlib.pyplot.Figure) u = af.plot(colorbar=False) self.assertIsInstance(u, matplotlib.pyplot.Figure) v = af.plot(labels=False) self.assertIsInstance(v, matplotlib.pyplot.Figure)
def test_plot(self): af = AshlockFingerprint(self.strategy, self.probe) af.fingerprint(turns=10, repetitions=2, step=0.25, progress_bar=False) p = af.plot() self.assertIsInstance(p, matplotlib.pyplot.Figure) q = af.plot(col_map='jet') self.assertIsInstance(q, matplotlib.pyplot.Figure) r = af.plot(interpolation='bicubic') self.assertIsInstance(r, matplotlib.pyplot.Figure) t = af.plot(title='Title') self.assertIsInstance(t, matplotlib.pyplot.Figure) u = af.plot(colorbar=False) self.assertIsInstance(u, matplotlib.pyplot.Figure) v = af.plot(labels=False) self.assertIsInstance(v, matplotlib.pyplot.Figure)
def test_plot_figure(self): af = AshlockFingerprint(axl.WinStayLoseShift, axl.TitForTat) af.fingerprint(turns=10, repetitions=2, step=0.25, progress_bar=False) p = af.plot() self.assertIsInstance(p, matplotlib.pyplot.Figure) q = af.plot(cmap="jet") self.assertIsInstance(q, matplotlib.pyplot.Figure) r = af.plot(interpolation="bicubic") self.assertIsInstance(r, matplotlib.pyplot.Figure) t = af.plot(title="Title") self.assertIsInstance(t, matplotlib.pyplot.Figure) u = af.plot(colorbar=False) self.assertIsInstance(u, matplotlib.pyplot.Figure) v = af.plot(labels=False) self.assertIsInstance(v, matplotlib.pyplot.Figure)