MCPcopy Create free account
hub / github.com/PythonOT/POT / test_rescale_for_imshow_plot

Function test_rescale_for_imshow_plot

test/test_plot.py:46–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

44
45@pytest.mark.skipif(nogo, reason="Matplotlib not installed")
46def test_rescale_for_imshow_plot():
47 import ot
48 import ot.plot
49
50 n = 7
51 a_x, b_x = -1, 3
52 x = np.linspace(a_x, b_x, n)
53 a_y, b_y = 2, 6
54 y = np.linspace(a_y, b_y, n)
55
56 x_rescaled, y_rescaled = ot.plot.rescale_for_imshow_plot(x, y, n)
57 assert x_rescaled.shape == (n,)
58 assert y_rescaled.shape == (n,)
59
60 x_rescaled, y_rescaled = ot.plot.rescale_for_imshow_plot(
61 x, y, n, m=n, a_y=a_y + 1, b_y=b_y - 1
62 )
63 assert x_rescaled.shape[0] <= n
64 assert y_rescaled.shape[0] <= n
65 with pytest.raises(AssertionError):
66 ot.plot.rescale_for_imshow_plot(x[3:], y, n)
67
68
69@pytest.mark.skipif(nogo, reason="Matplotlib not installed")

Callers

nothing calls this directly

Calls 1

linspaceMethod · 0.45

Tested by

no test coverage detected