예제 #1
0
파일: conversion.py 프로젝트: yixw/colour
def JMh_CAM16_to_CAM16(JMh):
    """
    Converts from *CAM6* :math:`JMh` correlates to *CAM6* specification.

    Parameters
    ----------
    JMh : array_like
         *CAM6* :math:`JMh` correlates.

    Returns
    -------
    CAM6_Specification
        *CAM6* colour appearance model specification.

    Examples
    --------
    >>> JMh = np.array([4.17312079e+01, 1.07436772e-01, 2.17067960e+02])
    >>> JMh_CAM16_to_CAM16(JMh)  # doctest: +ELLIPSIS
    CAM16_Specification(J=41.7312079..., C=None, h=217.06796..., s=None, \
Q=None, M=0.1074367..., H=None, HC=None)
    """

    J, M, h = tsplit(JMh)

    return CAM16_Specification(J=J, M=M, h=h)
예제 #2
0
    def test_nan_CAM16_to_XYZ(self):
        """
        Tests :func:`colour.appearance.cam16.CAM16_to_XYZ` definition
        nan support.
        """

        cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
        cases = set(permutations(cases * 3, r=3))
        for case in cases:
            J = case[0]
            C = case[0]
            h = case[0]
            XYZ_w = np.array(case)
            L_A = case[0]
            Y_b = case[0]
            surround = CAM16_InductionFactors(case[0], case[0], case[0])
            CAM16_to_XYZ(CAM16_Specification(J, C, h), XYZ_w, L_A, Y_b,
                         surround)
예제 #3
0
    def test_raise_exception_CAM16_to_XYZ(self):
        """
        Tests :func:`colour.appearance.cam16.CAM16_to_XYZ` definition raised
        exception.
        """

        try:
            CAM16_to_XYZ(
                CAM16_Specification(
                    41.731207905126638,
                    None,
                    217.06795976739301,
                ),
                np.array([95.05, 100.00, 108.88]),
                318.31,
                20.0,
                CAM16_VIEWING_CONDITIONS['Average'],
            )
        except ValueError:
            pass