def test_nan_eotf_BT1886(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\
eotf_BT1886` definition nan support.
        """

        eotf_BT1886(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
Example #2
0
    def test_n_dimensional_eotf_BT1886(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.bt_1886.\
eotf_BT1886` definition n-dimensional arrays support.
        """

        V = 0.18
        L = 136.58617957
        np.testing.assert_almost_equal(
            eotf_BT1886(V),
            L,
            decimal=7)

        V = np.tile(V, 6)
        L = np.tile(L, 6)
        np.testing.assert_almost_equal(
            eotf_BT1886(V),
            L,
            decimal=7)

        V = np.reshape(V, (2, 3))
        L = np.reshape(L, (2, 3))
        np.testing.assert_almost_equal(
            eotf_BT1886(V),
            L,
            decimal=7)

        V = np.reshape(V, (2, 3, 1))
        L = np.reshape(L, (2, 3, 1))
        np.testing.assert_almost_equal(
            eotf_BT1886(V),
            L,
            decimal=7)
Example #3
0
    def test_nan_eotf_BT1886(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\
eotf_BT1886` definition nan support.
        """

        eotf_BT1886(np.array([-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]))
    def test_eotf_BT1886(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\
eotf_BT1886` definition.
        """

        self.assertAlmostEqual(eotf_BT1886(0.0), 0.0, places=7)

        self.assertAlmostEqual(eotf_BT1886(0.18), 0.016317514686316, places=7)

        self.assertAlmostEqual(eotf_BT1886(1.0), 1.0, places=7)
Example #5
0
    def test_eotf_BT1886(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\
eotf_BT1886` definition.
        """

        self.assertAlmostEqual(eotf_BT1886(0.0), 0.0, places=7)

        self.assertAlmostEqual(eotf_BT1886(0.18), 0.016317514686316, places=7)

        self.assertAlmostEqual(eotf_BT1886(1.0), 1.0, places=7)
Example #6
0
    def test_eotf_BT1886(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.bt_1886.\
eotf_BT1886` definition.
        """

        self.assertAlmostEqual(eotf_BT1886(0.0), 64.0, places=7)

        self.assertAlmostEqual(eotf_BT1886(0.18), 136.58617957, places=7)

        self.assertAlmostEqual(eotf_BT1886(1.0), 940.00000000, places=7)
    def test_domain_range_scale_eotf_BT1886(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\
eotf_BT1886` definition domain and range scale support.
        """

        V = 0.016317514686316
        L = eotf_BT1886(V)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(
                    eotf_BT1886(V * factor), L * factor, decimal=7)
Example #8
0
    def test_domain_range_scale_eotf_BT1886(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.itur_bt_1886.\
eotf_BT1886` definition domain and range scale support.
        """

        V = 0.016317514686316
        L = eotf_BT1886(V)

        d_r = (('reference', 1), (1, 1), (100, 100))
        for scale, factor in d_r:
            with domain_range_scale(scale):
                np.testing.assert_almost_equal(eotf_BT1886(V * factor),
                                               L * factor,
                                               decimal=7)
Example #9
0
def ootf_BT2100_PQ(E):
    """
    Defines *Recommendation ITU-R BT.2100* *Reference PQ* opto-optical transfer
    function (OOTF / OOCF).

    The OOTF maps relative scene linear light to display linear light.

    Parameters
    ----------
    E : numeric or array_like
        :math:`E = {R_S, G_S, B_S; Y_S; or I_S}` is the signal determined by
        scene light and scaled by camera exposure. The values :math:`E`,
        :math:`R_S`, :math:`G_S`, :math:`B_S`, :math:`Y_S`, :math:`I_S` are in
        the range [0, 1].

    Returns
    -------
    numeric or ndarray
        :math:`F_D` is the luminance of a displayed linear component
        (:math:`R_D`, :math:`G_D`, :math:`B_D`; :math:`Y_D`; or :math:`I_D`).

    References
    ----------
    -   :cite:`Borer2017a`
    -   :cite:`InternationalTelecommunicationUnion2016a`

    Examples
    --------
    >>> ootf_BT2100_PQ(0.1)  # doctest: +ELLIPSIS
    779.9883608...
    """

    E = np.asarray(E)

    return 100 * eotf_BT1886(oetf_BT709(59.5208 * E))
Example #10
0
    def test_eotf_BT1886(self):
        """
        Tests :func:`colour.models.rgb.transfer_functions.bt_1886.\
eotf_BT1886` definition.
        """

        self.assertAlmostEqual(
            eotf_BT1886(0.0),
            64.0,
            places=7)

        self.assertAlmostEqual(
            eotf_BT1886(0.18),
            136.58617957,
            places=7)

        self.assertAlmostEqual(
            eotf_BT1886(1.0),
            940.00000000,
            places=7)
Example #11
0
def ootf_BT2100_PQ(E):
    """
    Defines *Recommendation ITU-R BT.2100* *Reference PQ* opto-optical transfer
    function (OOTF / OOCF).

    The OOTF maps relative scene linear light to display linear light.

    Parameters
    ----------
    E : numeric or array_like
        :math:`E = {R_S, G_S, B_S; Y_S; or I_S}` is the signal determined by
        scene light and scaled by camera exposure.

    Returns
    -------
    numeric or ndarray
        :math:`F_D` is the luminance of a displayed linear component
        (:math:`R_D`, :math:`G_D`, :math:`B_D`; :math:`Y_D`; or :math:`I_D`).

    Notes
    -----

    +------------+-----------------------+---------------+
    | **Domain** | **Scale - Reference** | **Scale - 1** |
    +============+=======================+===============+
    | ``E``      | [0, 1]                | [0, 1]        |
    +------------+-----------------------+---------------+

    +------------+-----------------------+---------------+
    | **Range**  | **Scale - Reference** | **Scale - 1** |
    +============+=======================+===============+
    | ``F_D``    | [0, 1]                | [0, 1]        |
    +------------+-----------------------+---------------+

    References
    ----------
    :cite:`Borer2017a`, :cite:`InternationalTelecommunicationUnion2016a`

    Examples
    --------
    >>> ootf_BT2100_PQ(0.1)  # doctest: +ELLIPSIS
    779.9883608...
    """

    E = as_float_array(E)

    return 100 * eotf_BT1886(oetf_BT709(59.5208 * E))