def test_steps(self): """ Tests :func:`colour.utilities.array.steps` definition. """ np.testing.assert_almost_equal(steps(range(0, 10, 2)), np.array([2])) np.testing.assert_almost_equal(steps([1, 2, 3, 4, 6, 6.5]), np.array([0.5, 1, 2]))
def test_steps(self): """ Tests :func:`colour.utilities.array.steps` definition. """ np.testing.assert_almost_equal(steps(range(0, 10, 2)), np.array([2])) np.testing.assert_almost_equal( steps([1, 2, 3, 4, 6, 6.5]), np.array([0.5, 1, 2]))
def x(self, value): """ Setter for **self.__x** private attribute. Parameters ---------- value : array_like Attribute value. """ if value is not None: value = np.atleast_1d(value).astype(np.float_) assert value.ndim == 1, ( '"x" independent variable must have exactly one dimension!') value_steps = steps(value)[0] xp1 = value[0] - value_steps * 2 xp2 = value[0] - value_steps xp3 = value[-1] + value_steps xp4 = value[-1] + value_steps * 2 self.__xp = np.concatenate(((xp1, xp2), value, (xp3, xp4))) self.__x = value