Esempio n. 1
0
    def test_get_cmap(self):
        test_clst = tuple([
            (x, x, x) for x in np.linspace(0, 1, ginga.cmap.min_cmap_len)
        ])
        ginga.cmap.add_cmap('test-name', test_clst)

        expected = ColorMap('test-name', test_clst)
        actual = ginga.cmap.get_cmap('test-name')
        assert expected.name == actual.name
        assert expected.clst == actual.clst

        # Teardown
        del ginga.cmap.cmaps['test-name']
Esempio n. 2
0
    def test_ColorMap_init(self):
        test_clst = tuple([
            (x, x, x) for x in np.linspace(0, 1, ginga.cmap.min_cmap_len)
        ])
        test_color_map = ColorMap('test-name', test_clst)

        expected = 'test-name'
        actual = test_color_map.name
        assert expected == actual

        expected = ginga.cmap.min_cmap_len
        actual = len(test_color_map.clst)
        assert expected == actual

        expected = (0.0, 0.0, 0.0)
        actual = test_color_map.clst[0]
        assert np.allclose(expected, actual)

        expected = (1.0, 1.0, 1.0)
        actual = test_color_map.clst[-1]
        assert np.allclose(expected, actual)
Esempio n. 3
0
 def test_ColorMap_init_exception(self):
     with pytest.raises(TypeError):
         ColorMap('test-name')