Ejemplo n.º 1
0
    def test_n_dimensional_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self):
        """
        Tests :func:`colour.colorimetry.transformations.\
LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition n-dimensional arrays
        support.
        """

        wl = 700
        XYZ = np.array([0.01096778, 0.00419594, 0.00000000])
        np.testing.assert_almost_equal(
            LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(wl), XYZ)

        wl = np.tile(wl, 6)
        XYZ = np.tile(XYZ, (6, 1))
        np.testing.assert_almost_equal(
            LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(wl), XYZ)

        wl = np.reshape(wl, (2, 3))
        XYZ = np.reshape(XYZ, (2, 3, 3))
        np.testing.assert_almost_equal(
            LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(wl), XYZ)

        wl = np.reshape(wl, (2, 3, 1))
        XYZ = np.reshape(XYZ, (2, 3, 1, 3))
        np.testing.assert_almost_equal(
            LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(wl), XYZ)
Ejemplo n.º 2
0
    def test_nan_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self):
        """
        Tests :func:`colour.colorimetry.transformations.\
LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition nan support.
        """

        LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(
            np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Ejemplo n.º 3
0
    def test_LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(self):
        """
        Tests :func:`colour.colorimetry.transformations.\
LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs` definition.
        """

        cmfs = CMFS.get('CIE 2012 2 Degree Standard Observer')
        np.testing.assert_allclose(LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(435),
                                   cmfs.get(435),
                                   atol=0.00015)

        np.testing.assert_allclose(LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(545),
                                   cmfs.get(545),
                                   atol=0.00015)

        np.testing.assert_allclose(LMS_2_degree_cmfs_to_XYZ_2_degree_cmfs(700),
                                   cmfs.get(700),
                                   atol=0.00015)