Ejemplo n.º 1
0
    def test_n_dimensional_optical_MTF_Barten1999(self):
        """
        Tests :func:`colour.contrast.barten1999.optical_MTF_Barten1999`
        definition n-dimensions support.
        """

        u = np.array([4, 8, 12])
        sigma = np.array([0.01, 0.05, 0.1])
        M_opt = np.array([9.6891079e-01, 4.2499056e-02, 4.5228645e-13])
        np.testing.assert_almost_equal(optical_MTF_Barten1999(u, sigma),
                                       M_opt,
                                       decimal=7)

        u = np.tile(u, (6, 1))
        sigma = np.tile(sigma, (6, 1))
        M_opt = np.tile(M_opt, (6, 1))
        np.testing.assert_almost_equal(optical_MTF_Barten1999(u, sigma),
                                       M_opt,
                                       decimal=7)

        u = np.reshape(u, (2, 3, 3))
        sigma = np.reshape(sigma, (2, 3, 3))
        M_opt = np.reshape(M_opt, (2, 3, 3))
        np.testing.assert_almost_equal(optical_MTF_Barten1999(u, sigma),
                                       M_opt,
                                       decimal=7)
Ejemplo n.º 2
0
    def test_nan_optical_MTF_Barten1999(self):
        """
        Tests :func:`colour.contrast.barten1999.optical_MTF_Barten1999`
        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:
            optical_MTF_Barten1999(np.array(case), np.array(case))
Ejemplo n.º 3
0
    def test_optical_MTF_Barten1999(self):
        """
        Tests :func:`colour.contrast.barten1999.optical_MTF_Barten1999`
        definition.
        """

        np.testing.assert_almost_equal(
            optical_MTF_Barten1999(4, 0.01), 0.968910791191297, decimal=7)

        np.testing.assert_almost_equal(
            optical_MTF_Barten1999(8, 0.01), 0.881323136669471, decimal=7)

        np.testing.assert_almost_equal(
            optical_MTF_Barten1999(4, 0.05), 0.454040738727245, decimal=7)
Ejemplo n.º 4
0
    def test_n_dimensional_optical_MTF_Barten1999(self):
        """
        Tests :func:`colour.contrast.barten1999.optical_MTF_Barten1999`
        definition n-dimensional support.
        """

        u = np.array([4, 8, 12])
        sigma = np.array([0.01, 0.05, 0.1])
        M_opt = optical_MTF_Barten1999(u, sigma)

        u = np.tile(u, (6, 1))
        sigma = np.tile(sigma, (6, 1))
        M_opt = np.tile(M_opt, (6, 1))
        np.testing.assert_almost_equal(
            optical_MTF_Barten1999(u, sigma), M_opt, decimal=7)

        u = np.reshape(u, (2, 3, 3))
        sigma = np.reshape(sigma, (2, 3, 3))
        M_opt = np.reshape(M_opt, (2, 3, 3))
        np.testing.assert_almost_equal(
            optical_MTF_Barten1999(u, sigma), M_opt, decimal=7)