示例#1
0
def tcs_colorimetry_data(
    sd_irradiance: SpectralDistribution,
    sds_tcs: MultiSpectralDistributions,
    cmfs: MultiSpectralDistributions,
) -> Tuple[TCS_ColorimetryData_CIE2017, ...]:
    """
    Return the *test colour samples* colorimetry data under given test light
    source or reference illuminant spectral distribution for the
    *CIE 2017 Colour Fidelity Index* (CFI) computations.

    Parameters
    ----------
    sd_irradiance
        Test light source or reference illuminant spectral distribution, i.e.
        the irradiance emitter.
    sds_tcs
        *Test colour samples* spectral distributions.
    cmfs
        Standard observer colour matching functions.

    Returns
    -------
    :class:`tuple`
        *Test colour samples* colorimetry data under the given test light
        source or reference illuminant spectral distribution.

    Examples
    --------
    >>> delta_E_to_R_f(4.4410383190)  # doctest: +ELLIPSIS
    70.1208254...
    """

    XYZ_w = sd_to_XYZ(sd_ones(), cmfs, sd_irradiance)
    Y_b = 20
    L_A = 100
    surround = VIEWING_CONDITIONS_CIECAM02["Average"]

    tcs_data = []
    for sd_tcs in sds_tcs.to_sds():
        XYZ = sd_to_XYZ(sd_tcs, cmfs, sd_irradiance)
        CAM = XYZ_to_CIECAM02(XYZ, XYZ_w, L_A, Y_b, surround, True)
        JMh = tstack([CAM.J, CAM.M, CAM.h])
        Jpapbp = JMh_CIECAM02_to_CAM02UCS(JMh)

        tcs_data.append(
            TCS_ColorimetryData_CIE2017(sd_tcs.name, XYZ, CAM, JMh, Jpapbp))

    return tuple(tcs_data)
示例#2
0
    def test_JMh_CIECAM02_to_UCS_Luo2006(self):
        """
        Test :func:`colour.models.cam02_ucs.JMh_CIECAM02_to_UCS_Luo2006`
        definition.
        """

        np.testing.assert_almost_equal(
            JMh_CIECAM02_to_UCS_Luo2006(self._JMh,
                                        COEFFICIENTS_UCS_LUO2006["CAM02-LCD"]),
            np.array([54.90433134, -0.08450395, -0.06854831]),
            decimal=7,
        )

        np.testing.assert_almost_equal(
            JMh_CIECAM02_to_UCS_Luo2006(self._JMh,
                                        COEFFICIENTS_UCS_LUO2006["CAM02-LCD"]),
            JMh_CIECAM02_to_CAM02LCD(self._JMh),
            decimal=7,
        )

        np.testing.assert_almost_equal(
            JMh_CIECAM02_to_UCS_Luo2006(self._JMh,
                                        COEFFICIENTS_UCS_LUO2006["CAM02-SCD"]),
            np.array([54.90433134, -0.08436178, -0.06843298]),
            decimal=7,
        )

        np.testing.assert_almost_equal(
            JMh_CIECAM02_to_UCS_Luo2006(self._JMh,
                                        COEFFICIENTS_UCS_LUO2006["CAM02-SCD"]),
            JMh_CIECAM02_to_CAM02SCD(self._JMh),
            decimal=7,
        )

        np.testing.assert_almost_equal(
            JMh_CIECAM02_to_UCS_Luo2006(self._JMh,
                                        COEFFICIENTS_UCS_LUO2006["CAM02-UCS"]),
            np.array([54.90433134, -0.08442362, -0.06848314]),
            decimal=7,
        )

        np.testing.assert_almost_equal(
            JMh_CIECAM02_to_UCS_Luo2006(self._JMh,
                                        COEFFICIENTS_UCS_LUO2006["CAM02-UCS"]),
            JMh_CIECAM02_to_CAM02UCS(self._JMh),
            decimal=7,
        )