Exemplo n.º 1
0
    def test_is_uniform(self):
        """
        Tests :func:`colour.utilities.array.is_uniform` definition.
        """

        self.assertTrue(is_uniform(range(0, 10, 2)))

        self.assertFalse(is_uniform([1, 2, 3, 4, 6]))
Exemplo n.º 2
0
    def test_is_uniform(self):
        """
        Tests :func:`colour.utilities.array.is_uniform` definition.
        """

        self.assertTrue(is_uniform(range(0, 10, 2)))

        self.assertFalse(is_uniform([1, 2, 3, 4, 6]))
Exemplo n.º 3
0
    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!')

            assert is_uniform(value), (
                '"x" independent variable is not uniform!')

            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
Exemplo n.º 4
0
    def is_uniform(self):
        """
        Returns if independent domain :math:`x` variable is uniform.

        Returns
        -------
        bool
            Is independent domain :math:`x` variable uniform.
        """

        return is_uniform(self.domain)
Exemplo n.º 5
0
    def is_uniform(self) -> Boolean:
        """
        Return if independent domain variable :math:`x` is uniform.

        Returns
        -------
        :class:`bool`
            Is independent domain variable :math:`x` uniform.
        """

        return is_uniform(self.domain)
Exemplo n.º 6
0
    def is_uniform(self):
        """
        Returns if independent domain :math:`x` variable is uniform.

        Returns
        -------
        bool
            Is independent domain :math:`x` variable uniform.
        """

        return is_uniform(self.domain)