def test_n_dimensional_contrast_sensitivity_function_Barten1999(self): """ Tests :func:`colour.contrast.barten1999.\ contrast_sensitivity_function_Barten1999` definition n-dimensional support. """ u = np.array([4, 8, 12]) sigma = np.array([0.01, 0.02, 0.04]) E = np.array([0.65, 90, 1500]) X_0 = np.array([60, 120, 240]) S = contrast_sensitivity_function_Barten1999( u=u, sigma=sigma, E=E, X_0=X_0) u = np.tile(u, (6, 1)) E = np.tile(E, (6, 1)) S = np.tile(S, (6, 1)) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=u, sigma=sigma, E=E, X_0=X_0), S, decimal=7) u = np.reshape(u, (2, 3, 3)) E = np.reshape(E, (2, 3, 3)) S = np.reshape(S, (2, 3, 3)) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=u, sigma=sigma, E=E, X_0=X_0), S, decimal=7)
def test_nan_contrast_sensitivity_function_Barten1999(self): """ Tests :func:`colour.contrast.barten1999.\ contrast_sensitivity_function_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: contrast_sensitivity_function_Barten1999(u=np.array(case), sigma=np.array(case), E=np.array(case), X_0=np.array(case))
def test_nan_contrast_sensitivity_function_Barten1999(self): """ Tests :func:`colour.contrast.barten1999.\ contrast_sensitivity_function_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: contrast_sensitivity_function_Barten1999( u=np.array(case), sigma=np.array(case), E=np.array(case), X_0=np.array(case))
def test_contrast_sensitivity_function_Barten1999(self): """ Tests :func:`colour.contrast.barten1999.\ contrast_sensitivity_function_Barten1999` definition. """ np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999(u=4, sigma=0.01, E=65, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10**6), 352.761342126727020, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999(u=8, sigma=0.01, E=65, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10**6), 177.706338840717340, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999(u=4, sigma=0.02, E=65, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10**6), 320.872401634215750, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999(u=4, sigma=0.01, E=130, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10**6), 455.171315756946400, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999(u=4, sigma=0.01, E=65, X_0=120, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10**6), 352.996281545740660, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999(u=4, sigma=0.01, E=65, X_0=60, X_max=24, Y_0=60, Y_max=12, p=1.2 * 10**6), 358.881580104493650, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999(u=4, sigma=0.01, E=65, X_0=240, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10**6), contrast_sensitivity_function_Barten1999(u=4, sigma=0.01, E=65, X_0=60, X_max=12, Y_0=240, Y_max=12, p=1.2 * 10**6), decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999(u=4, sigma=0.01, E=65, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.4 * 10**6), 374.791328640476140, decimal=7)
def test_contrast_sensitivity_function_Barten1999(self): """ Tests :func:`colour.contrast.barten1999.\ contrast_sensitivity_function_Barten1999` definition. """ np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=4, sigma=0.01, E=65, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10 ** 6), 352.761342126727020, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=8, sigma=0.01, E=65, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10 ** 6), 177.706338840717340, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=4, sigma=0.02, E=65, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10 ** 6), 320.872401634215750, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=4, sigma=0.01, E=130, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10 ** 6), 455.171315756946400, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=4, sigma=0.01, E=65, X_0=120, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10 ** 6), 352.996281545740660, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=4, sigma=0.01, E=65, X_0=60, X_max=24, Y_0=60, Y_max=12, p=1.2 * 10 ** 6), 358.881580104493650, decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=4, sigma=0.01, E=65, X_0=240, X_max=12, Y_0=60, Y_max=12, p=1.2 * 10 ** 6), contrast_sensitivity_function_Barten1999( u=4, sigma=0.01, E=65, X_0=60, X_max=12, Y_0=240, Y_max=12, p=1.2 * 10 ** 6), decimal=7) np.testing.assert_almost_equal( contrast_sensitivity_function_Barten1999( u=4, sigma=0.01, E=65, X_0=60, X_max=12, Y_0=60, Y_max=12, p=1.4 * 10 ** 6), 374.791328640476140, decimal=7)