@@ 85-92 (lines=8) @@ | ||
82 | assert table.colors == true_colors |
|
83 | ||
84 | ||
85 | def test_get_steps(registry): |
|
86 | """Test getting a colortable and norm with appropriate steps.""" |
|
87 | registry['table'] = [(0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)] |
|
88 | norm, cmap = registry.get_with_steps('table', 5., 10.) |
|
89 | assert cmap(norm(np.array([6.]))).tolist() == [[0.0, 0.0, 1.0, 1.0]] |
|
90 | assert cmap(norm(np.array([14.9]))).tolist() == [[0.0, 0.0, 1.0, 1.0]] |
|
91 | assert cmap(norm(np.array([15.1]))).tolist() == [[1.0, 0.0, 0.0, 1.0]] |
|
92 | assert cmap(norm(np.array([26.]))).tolist() == [[0.0, 1.0, 0.0, 1.0]] |
|
93 | ||
94 | ||
95 | def test_get_steps_negative_start(registry): |
|
@@ 103-109 (lines=7) @@ | ||
100 | assert norm.vmax == 5 |
|
101 | ||
102 | ||
103 | def test_get_boundaries(registry): |
|
104 | """Test getting a colortable with explicit boundaries.""" |
|
105 | registry['table'] = [(0.0, 0.0, 1.0), (1.0, 0.0, 0.0), (0.0, 1.0, 0.0)] |
|
106 | norm, cmap = registry.get_with_boundaries('table', [0., 8., 10., 20.]) |
|
107 | assert cmap(norm(np.array([7.]))).tolist() == [[0.0, 0.0, 1.0, 1.0]] |
|
108 | assert cmap(norm(np.array([9.]))).tolist() == [[1.0, 0.0, 0.0, 1.0]] |
|
109 | assert cmap(norm(np.array([10.1]))).tolist() == [[0.0, 1.0, 0.0, 1.0]] |
|
110 | ||
111 | ||
112 | def test_gempak(): |