def test_n_dimensional_cylindrical_to_cartesian(self): """ Tests :func:`colour.algebra.coordinates.transformations.\ cylindrical_to_cartesian` definition n-dimensional arrays support. """ a_i = np.array([6.00000000, 0.32175055, 3.16227766]) a_o = np.array([3, 1, 6]) np.testing.assert_almost_equal( cylindrical_to_cartesian(a_i), a_o, decimal=7) a_i = np.tile(a_i, (6, 1)) a_o = np.tile(a_o, (6, 1)) np.testing.assert_almost_equal( cylindrical_to_cartesian(a_i), a_o, decimal=7) a_i = np.reshape(a_i, (2, 3, 3)) a_o = np.reshape(a_o, (2, 3, 3)) np.testing.assert_almost_equal( cylindrical_to_cartesian(a_i), a_o, decimal=7)
def test_cylindrical_to_cartesian(self): """ Test :func:`colour.algebra.coordinates.transformations.\ cylindrical_to_cartesian` definition. """ np.testing.assert_almost_equal( cylindrical_to_cartesian( np.array([0.32175055, 1.08574654, 6.78232998])), np.array([0.15001697, 0.28463718, 6.78232998]), decimal=7, ) np.testing.assert_almost_equal( cylindrical_to_cartesian( np.array([1.68145355, 1.05578119, 18.38477631])), np.array([0.82819662, 1.46334425, 18.38477631]), decimal=7, ) np.testing.assert_almost_equal( cylindrical_to_cartesian( np.array([-0.14626640, 1.23829030, 19.64342307])), np.array([-0.04774323, -0.13825500, 19.64342307]), decimal=7, )
def test_n_dimensional_cylindrical_to_cartesian(self): """ Tests :func:`colour.algebra.coordinates.transformations.\ cylindrical_to_cartesian` definition n-dimensional arrays support. """ vector_i = np.array([6.00000000, 0.32175055, 3.16227766]) vector_o = np.array([3, 1, 6]) np.testing.assert_almost_equal( cylindrical_to_cartesian(vector_i), vector_o, decimal=7) vector_i = np.tile(vector_i, (6, 1)) vector_o = np.tile(vector_o, (6, 1)) np.testing.assert_almost_equal( cylindrical_to_cartesian(vector_i), vector_o, decimal=7) vector_i = np.reshape(vector_i, (2, 3, 3)) vector_o = np.reshape(vector_o, (2, 3, 3)) np.testing.assert_almost_equal( cylindrical_to_cartesian(vector_i), vector_o, decimal=7)
def test_nan_cylindrical_to_cartesian(self): """ Tests :func:`colour.algebra.coordinates.transformations.\ cylindrical_to_cartesian` 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: a_i = np.array(case) cylindrical_to_cartesian(a_i)
def test_cylindrical_to_cartesian(self): """ Tests :func:`colour.algebra.coordinates.transformations.cylindrical_to_cartesian` # noqa definition. """ np.testing.assert_almost_equal( cylindrical_to_cartesian((6.78232998, 1.08574654, 0.32175055)), np.array([0.15001697, 0.28463718, 6.78232998]), decimal=7) np.testing.assert_almost_equal( cylindrical_to_cartesian((18.38477631, 1.05578119, 1.68145355)), np.array([0.82819662, 1.46334425, 18.38477631]), decimal=7) np.testing.assert_almost_equal( cylindrical_to_cartesian((19.64342307, 1.2382903, -0.1462664)), np.array([-0.04774323, -0.138255, 19.64342307]), decimal=7)
def test_n_dimensional_cylindrical_to_cartesian(self): """ Test :func:`colour.algebra.coordinates.transformations.\ cylindrical_to_cartesian` definition n-dimensional arrays support. """ a_i = np.array([3.16227766, 0.32175055, 6.00000000]) a_o = cylindrical_to_cartesian(a_i) a_i = np.tile(a_i, (6, 1)) a_o = np.tile(a_o, (6, 1)) np.testing.assert_almost_equal(cylindrical_to_cartesian(a_i), a_o, decimal=7) a_i = np.reshape(a_i, (2, 3, 3)) a_o = np.reshape(a_o, (2, 3, 3)) np.testing.assert_almost_equal(cylindrical_to_cartesian(a_i), a_o, decimal=7)