def test_meshgrid(self): a = np.linspace(0, 5) b = np.linspace(0, 3) A, B = np.meshgrid(a, b) c = pybamm.linspace(0, 5) d = pybamm.linspace(0, 3) C, D = pybamm.meshgrid(c, d) np.testing.assert_array_equal(A, C.entries) np.testing.assert_array_equal(B, D.entries)
def test_plot2D(self): x = pybamm.Array(np.array([0, 3, 10])) y = pybamm.Array(np.array([6, 16, 78])) X, Y = pybamm.meshgrid(x, y) # plot with array directly pybamm.plot2D(x, y, Y, testing=True) # plot with meshgrid pybamm.plot2D(X, Y, Y, testing=True) _, ax = plt.subplots() ax_out = pybamm.plot2D(X, Y, Y, ax=ax, testing=True) self.assertEqual(ax_out, ax)
def test_plot2D(self): x = pybamm.Array(np.array([0, 3, 10])) y = pybamm.Array(np.array([6, 16, 78])) X, Y = pybamm.meshgrid(x, y) # plot with array directly pybamm.plot2D(x, y, Y, xlabel="x", ylabel="y", title="title", testing=True) # plot with meshgrid pybamm.plot2D(X, Y, Y, xlabel="x", ylabel="y", title="title", testing=True)