code stringlengths 66 870k | docstring stringlengths 19 26.7k | func_name stringlengths 1 138 | language stringclasses 1
value | repo stringlengths 7 68 | path stringlengths 5 324 | url stringlengths 46 389 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
def test_nan_whiteness_CIE2004(self) -> None:
"""
Test :func:`colour.colorimetry.whiteness.whiteness_CIE2004`
definition nan support.
"""
cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
cases = np.array(list(set(product(cases, repeat=3))))
whiteness_CIE2004(cas... |
Test :func:`colour.colorimetry.whiteness.whiteness_CIE2004`
definition nan support.
| test_nan_whiteness_CIE2004 | python | colour-science/colour | colour/colorimetry/tests/test_whiteness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_whiteness.py | BSD-3-Clause |
def test_domain_range_scale_whiteness(self) -> None:
"""
Test :func:`colour.colorimetry.whiteness.whiteness` definition domain
and range scale support.
"""
XYZ = np.array([95.00000000, 100.00000000, 105.00000000])
XYZ_0 = np.array([94.80966767, 100.00000000, 107.30513595... |
Test :func:`colour.colorimetry.whiteness.whiteness` definition domain
and range scale support.
| test_domain_range_scale_whiteness | python | colour-science/colour | colour/colorimetry/tests/test_whiteness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_whiteness.py | BSD-3-Clause |
def test_yellowness_ASTMD1925(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925`
definition.
"""
np.testing.assert_allclose(
yellowness_ASTMD1925(np.array([95.00000000, 100.00000000, 105.00000000])),
10.299999999999997,
... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925`
definition.
| test_yellowness_ASTMD1925 | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_n_dimensional_yellowness_ASTMD1925(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925`
definition n_dimensional arrays support.
"""
XYZ = np.array([95.00000000, 100.00000000, 105.00000000])
YI = yellowness_ASTMD1925(XYZ)
X... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925`
definition n_dimensional arrays support.
| test_n_dimensional_yellowness_ASTMD1925 | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_domain_range_scale_yellowness_ASTMD1925(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925`
definition domain and range scale support.
"""
XYZ = np.array([95.00000000, 100.00000000, 105.00000000])
YI = 10.299999999999997
d... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925`
definition domain and range scale support.
| test_domain_range_scale_yellowness_ASTMD1925 | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_nan_yellowness_ASTMD1925(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925`
definition nan support.
"""
cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
cases = np.array(list(set(product(cases, repeat=3))))
yellowness_AST... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTMD1925`
definition nan support.
| test_nan_yellowness_ASTMD1925 | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_yellowness_ASTME313_alternative(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.\
yellowness_ASTME313_alternative` definition.
"""
np.testing.assert_allclose(
yellowness_ASTME313_alternative(
np.array([95.00000000, 100.00000000, 105.0000... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313_alternative` definition.
| test_yellowness_ASTME313_alternative | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_n_dimensional_yellowness_ASTME313_alternative(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.\
yellowness_ASTME313_alternative` definition n_dimensional arrays support.
"""
XYZ = np.array([95.00000000, 100.00000000, 105.00000000])
YI = yellowness_ASTME313_... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313_alternative` definition n_dimensional arrays support.
| test_n_dimensional_yellowness_ASTME313_alternative | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_domain_range_scale_yellowness_ASTME313_alternative(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.\
yellowness_ASTME313_alternative` definition domain and range scale support.
"""
XYZ = np.array([95.00000000, 100.00000000, 105.00000000])
YI = 11.0650000000... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313_alternative` definition domain and range scale support.
| test_domain_range_scale_yellowness_ASTME313_alternative | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_nan_yellowness_ASTME313_alternative(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.\
yellowness_ASTME313_alternative` definition nan support.
"""
cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
cases = np.array(list(set(product(cases, repeat=3))))
... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313_alternative` definition nan support.
| test_nan_yellowness_ASTME313_alternative | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_yellowness_ASTME313(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313`
definition.
"""
np.testing.assert_allclose(
yellowness_ASTME313(np.array([95.00000000, 100.00000000, 105.00000000])),
4.340000000000003,
... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313`
definition.
| test_yellowness_ASTME313 | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_n_dimensional_yellowness_ASTME313(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313`
definition n_dimensional arrays support.
"""
XYZ = np.array([95.00000000, 100.00000000, 105.00000000])
YI = yellowness_ASTME313(XYZ)
XYZ ... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313`
definition n_dimensional arrays support.
| test_n_dimensional_yellowness_ASTME313 | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_domain_range_scale_yellowness_ASTME313(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313`
definition domain and range scale support.
"""
XYZ = np.array([95.00000000, 100.00000000, 105.00000000])
YI = 4.340000000000003
d_r ... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313`
definition domain and range scale support.
| test_domain_range_scale_yellowness_ASTME313 | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_nan_yellowness_ASTME313(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313`
definition nan support.
"""
cases = [-1.0, 0.0, 1.0, -np.inf, np.inf, np.nan]
cases = np.array(list(set(product(cases, repeat=3))))
yellowness_ASTME... |
Test :func:`colour.colorimetry.yellowness.yellowness_ASTME313`
definition nan support.
| test_nan_yellowness_ASTME313 | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def test_domain_range_scale_yellowness(self) -> None:
"""
Test :func:`colour.colorimetry.yellowness.yellowness` definition
domain and range scale support.
"""
XYZ = np.array([95.00000000, 100.00000000, 105.00000000])
m = ("ASTM D1925", "ASTM E313")
v = [yellowne... |
Test :func:`colour.colorimetry.yellowness.yellowness` definition
domain and range scale support.
| test_domain_range_scale_yellowness | python | colour-science/colour | colour/colorimetry/tests/test_yellowness.py | https://github.com/colour-science/colour/blob/master/colour/colorimetry/tests/test_yellowness.py | BSD-3-Clause |
def name(self, value: str) -> None:
"""Setter for the **self.name** property."""
attest(
isinstance(value, str),
f'"name" property: "{value}" type is not "str"!',
)
self._name = value | Setter for the **self.name** property. | name | python | colour-science/colour | colour/continuous/abstract.py | https://github.com/colour-science/colour/blob/master/colour/continuous/abstract.py | BSD-3-Clause |
def arithmetical_operation(
self,
a: ArrayLike | Self,
operation: Literal["+", "-", "*", "/", "**"],
in_place: bool = False,
) -> Self:
"""
Perform specified arithmetical operation with operand :math:`a`, the
operation can be either performed on a copy or in-p... |
Perform specified arithmetical operation with operand :math:`a`, the
operation can be either performed on a copy or in-place, must be
reimplemented by sub-classes.
Parameters
----------
a
Operand :math:`a`.
operation
Operation to perform.... | arithmetical_operation | python | colour-science/colour | colour/continuous/abstract.py | https://github.com/colour-science/colour/blob/master/colour/continuous/abstract.py | BSD-3-Clause |
def fill_nan(
self,
method: Literal["Constant", "Interpolation"] | str = "Interpolation",
default: Real = 0,
) -> Self:
"""
Fill NaNs in independent domain variable :math:`x` and corresponding
range variable :math:`y` using specified method, must be reimplemented
... |
Fill NaNs in independent domain variable :math:`x` and corresponding
range variable :math:`y` using specified method, must be reimplemented
by sub-classes.
Parameters
----------
method
*Interpolation* method linearly interpolates through the NaNs,
... | fill_nan | python | colour-science/colour | colour/continuous/abstract.py | https://github.com/colour-science/colour/blob/master/colour/continuous/abstract.py | BSD-3-Clause |
def domain_distance(self, a: ArrayLike) -> NDArrayFloat:
"""
Return the euclidean distance between specified array and independent
domain :math:`x` closest element.
Parameters
----------
a
Variable :math:`a` to compute the euclidean distance with
... |
Return the euclidean distance between specified array and independent
domain :math:`x` closest element.
Parameters
----------
a
Variable :math:`a` to compute the euclidean distance with
independent domain variable :math:`x`.
Returns
----... | domain_distance | python | colour-science/colour | colour/continuous/abstract.py | https://github.com/colour-science/colour/blob/master/colour/continuous/abstract.py | BSD-3-Clause |
def dtype(self, value: Type[DTypeFloat]) -> None:
"""Setter for the **self.dtype** property."""
for signal in self._signals.values():
signal.dtype = value | Setter for the **self.dtype** property. | dtype | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def domain(self, value: ArrayLike) -> None:
"""Setter for the **self.domain** property."""
for signal in self._signals.values():
signal.domain = as_float_array(value, self.dtype) | Setter for the **self.domain** property. | domain | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def range(self, value: ArrayLike) -> None:
"""Setter for the **self.range** property."""
value = as_float_array(value)
if value.ndim in (0, 1):
for signal in self._signals.values():
signal.range = value
else:
attest(
value.shape[-... | Setter for the **self.range** property. | range | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def extrapolator(self, value: Type[ProtocolExtrapolator]) -> None:
"""Setter for the **self.extrapolator** property."""
for signal in self._signals.values():
signal.extrapolator = value | Setter for the **self.extrapolator** property. | extrapolator | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def signals(
self,
value: ArrayLike | DataFrame | dict | Self | Series | Signal | None,
) -> None:
"""Setter for the **self.signals** property."""
self._signals = self.multi_signals_unpack_data(
value, signal_type=self._signal_type
) | Setter for the **self.signals** property. | signals | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def labels(self, value: Sequence) -> None:
"""Setter for the **self.labels** property."""
attest(
is_iterable(value),
f'"labels" property: "{value}" is not an "iterable" like object!',
)
attest(
len(set(value)) == len(value),
'"labels" pr... | Setter for the **self.labels** property. | labels | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def __repr__(self) -> str:
"""
Return an evaluable string representation of the multi-continuous
signals.
Returns
-------
:class:`str`
Evaluable string representation.
Examples
--------
>>> domain = np.arange(0, 10, 1)
>>> ran... |
Return an evaluable string representation of the multi-continuous
signals.
Returns
-------
:class:`str`
Evaluable string representation.
Examples
--------
>>> domain = np.arange(0, 10, 1)
>>> range_ = tstack([np.linspace(10, 100, 10)... | __repr__ | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def __hash__(self) -> int:
"""
Return the abstract continuous function hash.
Returns
-------
:class:`int`
Object hash.
"""
return hash(
(
int_digest(self.domain.tobytes()),
*[hash(signal) for signal in self... |
Return the abstract continuous function hash.
Returns
-------
:class:`int`
Object hash.
| __hash__ | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def __getitem__(self, x: ArrayLike | slice) -> NDArrayFloat:
"""
Return the corresponding range variable :math:`y` for independent
domain variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
Returns
-------
... |
Return the corresponding range variable :math:`y` for independent
domain variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
Returns
-------
:class:`numpy.ndarray`
Variable :math:`y` range value.
... | __getitem__ | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def __setitem__(self, x: ArrayLike | slice, y: ArrayLike) -> None:
"""
Set the corresponding range variable :math:`y` for independent domain
variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
y
Corresponding... |
Set the corresponding range variable :math:`y` for independent domain
variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
y
Corresponding range variable :math:`y`.
Examples
--------
>>> doma... | __setitem__ | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def __eq__(self, other: object) -> bool:
"""
Return whether the multi-continuous signals is equal to specified
other object.
Parameters
----------
other
Object to test whether it is equal to the multi-continuous signals.
Returns
-------
... |
Return whether the multi-continuous signals is equal to specified
other object.
Parameters
----------
other
Object to test whether it is equal to the multi-continuous signals.
Returns
-------
:class:`bool`
Whether specified objec... | __eq__ | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def arithmetical_operation(
self,
a: ArrayLike | AbstractContinuousFunction,
operation: Literal["+", "-", "*", "/", "**"],
in_place: bool = False,
) -> MultiSignals:
"""
Perform specified arithmetical operation with operand :math:`a`, the
operation can be eith... |
Perform specified arithmetical operation with operand :math:`a`, the
operation can be either performed on a copy or in-place.
Parameters
----------
a
Operand :math:`a`.
operation
Operation to perform.
in_place
Operation happen... | arithmetical_operation | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def multi_signals_unpack_data(
data: (
ArrayLike
| DataFrame
| dict
| MultiSignals
| Sequence
| Series
| Signal
| ValuesView
| None
) = None,
domain: ArrayLike | KeysView | None = None,
... |
Unpack specified data for multi-continuous signals instantiation.
Parameters
----------
data
Data to unpack for multi-continuous signals instantiation.
domain
Values to initialise the multiple :class:`colour.continuous.Signal`
sub-class insta... | multi_signals_unpack_data | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def fill_nan(
self,
method: Literal["Constant", "Interpolation"] | str = "Interpolation",
default: Real = 0,
) -> MultiSignals:
"""
Fill NaNs in independent domain variable :math:`x` and corresponding
range variable :math:`y` using specified method.
Parameter... |
Fill NaNs in independent domain variable :math:`x` and corresponding
range variable :math:`y` using specified method.
Parameters
----------
method
*Interpolation* method linearly interpolates through the NaNs,
*Constant* method replaces NaNs with ``defau... | fill_nan | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def to_dataframe(self) -> DataFrame:
"""
Convert the continuous signal to a *Pandas* :class:`pandas.DataFrame`
class instance.
Returns
-------
:class:`pandas.DataFrame`
Continuous signal as a *Pandas* :class:`pandas.DataFrame` class
instance.
... |
Convert the continuous signal to a *Pandas* :class:`pandas.DataFrame`
class instance.
Returns
-------
:class:`pandas.DataFrame`
Continuous signal as a *Pandas* :class:`pandas.DataFrame` class
instance.
Examples
--------
>>> if is... | to_dataframe | python | colour-science/colour | colour/continuous/multi_signals.py | https://github.com/colour-science/colour/blob/master/colour/continuous/multi_signals.py | BSD-3-Clause |
def function(self) -> Callable:
"""
Getter property for the continuous signal callable.
Returns
-------
Callable
Continuous signal callable.
"""
if self._function is None:
# Create the underlying continuous function.
if self.... |
Getter property for the continuous signal callable.
Returns
-------
Callable
Continuous signal callable.
| function | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def _undefined_function(
*args: Any, # noqa: ARG001
**kwargs: Any, # noqa: ARG001
) -> None:
"""
Raise a :class:`ValueError` exception.
Other Parameters
----------------
... |
Raise a :class:`ValueError` exception.
Other Parameters
----------------
args
Arguments.
kwargs
Keywords arguments.
Raises
------... | _undefined_function | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def __repr__(self) -> str:
"""
Return an evaluable string representation of the continuous signal.
Returns
-------
:class:`str`
Evaluable string representation.
Examples
--------
>>> range_ = np.linspace(10, 100, 10)
>>> Signal(range_... |
Return an evaluable string representation of the continuous signal.
Returns
-------
:class:`str`
Evaluable string representation.
Examples
--------
>>> range_ = np.linspace(10, 100, 10)
>>> Signal(range_)
Signal([[ 0., 10.],
... | __repr__ | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def __getitem__(self, x: ArrayLike | slice) -> NDArrayFloat:
"""
Return the corresponding range variable :math:`y` for independent
domain variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
Returns
-------
... |
Return the corresponding range variable :math:`y` for independent
domain variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
Returns
-------
:class:`numpy.ndarray`
Variable :math:`y` range value.
... | __getitem__ | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def __setitem__(self, x: ArrayLike | slice, y: ArrayLike) -> None:
"""
Set the corresponding range variable :math:`y` for independent domain
variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
y
Corresponding... |
Set the corresponding range variable :math:`y` for independent domain
variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
y
Corresponding range variable :math:`y`.
Examples
--------
>>> rang... | __setitem__ | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def __contains__(self, x: ArrayLike | slice) -> bool:
"""
Return whether the continuous signal contains specified independent
domain variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
Returns
-------
:c... |
Return whether the continuous signal contains specified independent
domain variable :math:`x`.
Parameters
----------
x
Independent domain variable :math:`x`.
Returns
-------
:class:`bool`
Whether :math:`x` domain value is contain... | __contains__ | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def __eq__(self, other: object) -> bool:
"""
Return whether the continuous signal is equal to specified other
object.
Parameters
----------
other
Object to test whether it is equal to the continuous signal.
Returns
-------
:class:`boo... |
Return whether the continuous signal is equal to specified other
object.
Parameters
----------
other
Object to test whether it is equal to the continuous signal.
Returns
-------
:class:`bool`
Whether specified object is equal to ... | __eq__ | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def _fill_domain_nan(
self,
method: Literal["Constant", "Interpolation"] | str = "Interpolation",
default: Real = 0,
) -> None:
"""
Fill NaNs in independent domain variable :math:`x` using specified
method.
Parameters
----------
method
... |
Fill NaNs in independent domain variable :math:`x` using specified
method.
Parameters
----------
method
*Interpolation* method linearly interpolates through the NaNs,
*Constant* method replaces NaNs with ``default``.
default
Value to ... | _fill_domain_nan | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def _fill_range_nan(
self,
method: Literal["Constant", "Interpolation"] | str = "Interpolation",
default: Real = 0,
) -> None:
"""
Fill NaNs in corresponding range variable :math:`y` using specified
method.
Parameters
----------
method
... |
Fill NaNs in corresponding range variable :math:`y` using specified
method.
Parameters
----------
method
*Interpolation* method linearly interpolates through the NaNs,
*Constant* method replaces NaNs with ``default``.
default
Value to... | _fill_range_nan | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def arithmetical_operation(
self,
a: ArrayLike | AbstractContinuousFunction,
operation: Literal["+", "-", "*", "/", "**"],
in_place: bool = False,
) -> AbstractContinuousFunction:
"""
Perform specified arithmetical operation with operand :math:`a`, the
operati... |
Perform specified arithmetical operation with operand :math:`a`, the
operation can be either performed on a copy or in-place.
Parameters
----------
a
Operand :math:`a`.
operation
Operation to perform.
in_place
Operation happen... | arithmetical_operation | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def signal_unpack_data(
data: ArrayLike | dict | Series | Signal | ValuesView | None,
domain: ArrayLike | KeysView | None = None,
dtype: Type[DTypeFloat] | None = None,
) -> tuple:
"""
Unpack specified data for continuous signal instantiation.
Parameters
----... |
Unpack specified data for continuous signal instantiation.
Parameters
----------
data
Data to unpack for continuous signal instantiation.
domain
Values to initialise the :attr:`colour.continuous.Signal.domain`
attribute with. If both ``data``... | signal_unpack_data | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def fill_nan(
self,
method: Literal["Constant", "Interpolation"] | str = "Interpolation",
default: Real = 0,
) -> Signal:
"""
Fill NaNs in independent domain variable :math:`x` and corresponding
range variable :math:`y` using specified method.
Parameters
... |
Fill NaNs in independent domain variable :math:`x` and corresponding
range variable :math:`y` using specified method.
Parameters
----------
method
*Interpolation* method linearly interpolates through the NaNs,
*Constant* method replaces NaNs with ``defau... | fill_nan | python | colour-science/colour | colour/continuous/signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/signal.py | BSD-3-Clause |
def test_pickling(self) -> None:
"""
Test whether the :class:``colour.continuous.signal.MultiSignals` class
can be pickled.
"""
data = pickle.dumps(self._multi_signals)
data = pickle.loads(data) # noqa: S301
assert self._multi_signals == data |
Test whether the :class:``colour.continuous.signal.MultiSignals` class
can be pickled.
| test_pickling | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_dtype(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.dtype`
property.
"""
assert self._multi_signals.dtype == DTYPE_FLOAT_DEFAULT
multi_signals = self._multi_signals.copy()
multi_signals.dtype = np.float32
assert mul... |
Test :func:`colour.continuous.multi_signals.MultiSignals.dtype`
property.
| test_dtype | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_domain(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.domain`
property.
"""
multi_signals = self._multi_signals.copy()
np.testing.assert_allclose(
multi_signals[np.array([0, 1, 2])],
np.array([[10.0, 20.0, 30... |
Test :func:`colour.continuous.multi_signals.MultiSignals.domain`
property.
| test_domain | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_range(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.range`
property.
"""
multi_signals = self._multi_signals.copy()
np.testing.assert_allclose(
multi_signals[np.array([0, 1, 2])],
np.array([[10.0, 20.0, 30.0... |
Test :func:`colour.continuous.multi_signals.MultiSignals.range`
property.
| test_range | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_interpolator(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.interpolator`
property.
"""
multi_signals = self._multi_signals.copy()
np.testing.assert_allclose(
multi_signals[np.linspace(0, 5, 5)],
np.array(
... |
Test :func:`colour.continuous.multi_signals.MultiSignals.interpolator`
property.
| test_interpolator | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_interpolator_kwargs(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.\
interpolator_kwargs` property.
"""
multi_signals = self._multi_signals.copy()
np.testing.assert_allclose(
multi_signals[np.linspace(0, 5, 5)],
np.a... |
Test :func:`colour.continuous.multi_signals.MultiSignals.interpolator_kwargs` property.
| test_interpolator_kwargs | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_extrapolator_kwargs(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.\
extrapolator_kwargs` property.
"""
multi_signals = self._multi_signals.copy()
attest(np.all(np.isnan(multi_signals[np.array([-1000, 1000])])))
multi_signals.extra... |
Test :func:`colour.continuous.multi_signals.MultiSignals.extrapolator_kwargs` property.
| test_extrapolator_kwargs | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_signals(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.signals`
property.
"""
multi_signals = self._multi_signals.copy()
multi_signals.signals = self._range_1
np.testing.assert_array_equal(multi_signals.domain, self._domain_... |
Test :func:`colour.continuous.multi_signals.MultiSignals.signals`
property.
| test_signals | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_labels(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.labels`
property.
"""
assert self._multi_signals.labels == ["0", "1", "2"]
multi_signals = self._multi_signals.copy()
multi_signals.labels = ["a", "b", "c"]
ass... |
Test :func:`colour.continuous.multi_signals.MultiSignals.labels`
property.
| test_labels | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_signal_type(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.signal_type`
property.
"""
multi_signals = MultiSignals(signal_type=Signal)
assert multi_signals.signal_type == Signal |
Test :func:`colour.continuous.multi_signals.MultiSignals.signal_type`
property.
| test_signal_type | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test__init__(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.__init__`
method.
"""
multi_signals = MultiSignals(self._range_1)
np.testing.assert_array_equal(multi_signals.domain, self._domain_1)
np.testing.assert_array_equal(multi_... |
Test :meth:`colour.continuous.multi_signals.MultiSignals.__init__`
method.
| test__init__ | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test__str__(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.__str__`
method.
"""
assert (
str(self._multi_signals)
== (
textwrap.dedent(
"""
[[ 0. 10. 20. 30.]
... |
Test :meth:`colour.continuous.multi_signals.MultiSignals.__str__`
method.
| test__str__ | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test__repr__(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.__repr__`
method.
"""
assert repr(self._multi_signals) == (
textwrap.dedent(
"""
MultiSignals([[ 0., 10., 20., 30.],
... |
Test :meth:`colour.continuous.multi_signals.MultiSignals.__repr__`
method.
| test__repr__ | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test__getitem__(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.__getitem__`
method.
"""
np.testing.assert_allclose(
self._multi_signals[0],
np.array([10.0, 20.0, 30.0]),
atol=TOLERANCE_ABSOLUTE_TESTS,
)... |
Test :meth:`colour.continuous.multi_signals.MultiSignals.__getitem__`
method.
| test__getitem__ | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test__setitem__(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.__setitem__`
method.
"""
multi_signals = self._multi_signals.copy()
multi_signals[0] = 20
np.testing.assert_allclose(
multi_signals[0],
np.arr... |
Test :meth:`colour.continuous.multi_signals.MultiSignals.__setitem__`
method.
| test__setitem__ | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test__contains__(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.__contains__`
method.
"""
assert 0 in self._multi_signals
assert 0.5 in self._multi_signals
assert 1000 not in self._multi_signals |
Test :meth:`colour.continuous.multi_signals.MultiSignals.__contains__`
method.
| test__contains__ | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test__iter__(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.__iter__` method."""
domain = np.arange(0, 10)
for i, domain_range_value in enumerate(self._multi_signals):
np.testing.assert_array_equal(domain_range_value[0], domain[i])
np.testing.assert_ar... | Test :func:`colour.continuous.signal.Signal.__iter__` method. | test__iter__ | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test__eq__(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.__eq__`
method.
"""
signal_1 = self._multi_signals.copy()
signal_2 = self._multi_signals.copy()
assert signal_1 == signal_2
assert signal_1 != () |
Test :meth:`colour.continuous.multi_signals.MultiSignals.__eq__`
method.
| test__eq__ | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test__ne__(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.__ne__`
method.
"""
multi_signals_1 = self._multi_signals.copy()
multi_signals_2 = self._multi_signals.copy()
multi_signals_2[0] = 20
assert multi_signals_1 != mul... |
Test :meth:`colour.continuous.multi_signals.MultiSignals.__ne__`
method.
| test__ne__ | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_arithmetical_operation(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.\
arithmetical_operation` method.
"""
np.testing.assert_allclose(
self._multi_signals.arithmetical_operation(10, "+", False).range,
self._range_2 + 10,
... |
Test :func:`colour.continuous.multi_signals.MultiSignals.arithmetical_operation` method.
| test_arithmetical_operation | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_is_uniform(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.is_uniform`
method.
"""
assert self._multi_signals.is_uniform()
multi_signals = self._multi_signals.copy()
multi_signals[0.5] = 1.0
assert not multi_signals.i... |
Test :meth:`colour.continuous.multi_signals.MultiSignals.is_uniform`
method.
| test_is_uniform | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_copy(self) -> None:
"""Test :func:`colour.continuous.multi_signals.MultiSignals.copy` method."""
assert self._multi_signals is not self._multi_signals.copy()
assert self._multi_signals == self._multi_signals.copy() | Test :func:`colour.continuous.multi_signals.MultiSignals.copy` method. | test_copy | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_multi_signals_unpack_data(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.\
multi_signals_unpack_data` method.
"""
signals = MultiSignals.multi_signals_unpack_data(self._range_1)
assert list(signals.keys()) == ["0"]
np.testing.assert_... |
Test :func:`colour.continuous.multi_signals.MultiSignals.multi_signals_unpack_data` method.
| test_multi_signals_unpack_data | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_fill_nan(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.fill_nan`
method.
"""
multi_signals = self._multi_signals.copy()
multi_signals[3:7] = np.nan
np.testing.assert_allclose(
multi_signals.fill_nan().range,
... |
Test :meth:`colour.continuous.multi_signals.MultiSignals.fill_nan`
method.
| test_fill_nan | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_domain_distance(self) -> None:
"""
Test :func:`colour.continuous.multi_signals.MultiSignals.\
domain_distance` method.
"""
np.testing.assert_allclose(
self._multi_signals.domain_distance(0.5),
0.5,
atol=TOLERANCE_ABSOLUTE_TESTS,
)
... |
Test :func:`colour.continuous.multi_signals.MultiSignals.domain_distance` method.
| test_domain_distance | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_to_dataframe(self) -> None:
"""
Test :meth:`colour.continuous.multi_signals.MultiSignals.to_dataframe`
method.
"""
if is_pandas_installed():
from pandas import DataFrame
data = dict(zip(["a", "b", "c"], tsplit(self._range_2), strict=True))
... |
Test :meth:`colour.continuous.multi_signals.MultiSignals.to_dataframe`
method.
| test_to_dataframe | python | colour-science/colour | colour/continuous/tests/test_multi_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_multi_signal.py | BSD-3-Clause |
def test_pickling(self) -> None:
"""
Test whether the :class:``colour.continuous.signal.Signal` class can be
pickled.
"""
data = pickle.dumps(self._signal)
data = pickle.loads(data) # noqa: S301
assert self._signal == data |
Test whether the :class:``colour.continuous.signal.Signal` class can be
pickled.
| test_pickling | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_dtype(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.dtype` property."""
assert self._signal.dtype == DTYPE_FLOAT_DEFAULT
signal = self._signal.copy()
signal.dtype = np.float32
assert signal.dtype == np.float32 | Test :func:`colour.continuous.signal.Signal.dtype` property. | test_dtype | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_domain(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.domain` property."""
signal = self._signal.copy()
np.testing.assert_allclose(
signal[np.array([0, 1, 2])],
np.array([10.0, 20.0, 30.0]),
atol=TOLERANCE_ABSOLUTE_TESTS,
)
... | Test :func:`colour.continuous.signal.Signal.domain` property. | test_domain | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_range(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.range` property."""
signal = self._signal.copy()
np.testing.assert_allclose(
signal[np.array([0, 1, 2])],
np.array([10.0, 20.0, 30.0]),
atol=TOLERANCE_ABSOLUTE_TESTS,
)
... | Test :func:`colour.continuous.signal.Signal.range` property. | test_range | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_interpolator(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.interpolator` property."""
signal = self._signal.copy()
np.testing.assert_allclose(
signal[np.linspace(0, 5, 5)],
np.array(
[
10.00000000,
... | Test :func:`colour.continuous.signal.Signal.interpolator` property. | test_interpolator | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_interpolator_kwargs(self) -> None:
"""
Test :func:`colour.continuous.signal.Signal.interpolator_kwargs`
property.
"""
signal = self._signal.copy()
np.testing.assert_allclose(
signal[np.linspace(0, 5, 5)],
np.array(
[
... |
Test :func:`colour.continuous.signal.Signal.interpolator_kwargs`
property.
| test_interpolator_kwargs | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_extrapolator_kwargs(self) -> None:
"""
Test :func:`colour.continuous.signal.Signal.extrapolator_kwargs`
property.
"""
signal = self._signal.copy()
attest(np.all(np.isnan(signal[np.array([-1000, 1000])])))
signal.extrapolator_kwargs = {
"met... |
Test :func:`colour.continuous.signal.Signal.extrapolator_kwargs`
property.
| test_extrapolator_kwargs | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test__init__(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.__init__` method."""
signal = Signal(self._range)
np.testing.assert_array_equal(signal.domain, np.arange(0, 10, 1))
np.testing.assert_array_equal(signal.range, self._range)
signal = Signal(self._rang... | Test :func:`colour.continuous.signal.Signal.__init__` method. | test__init__ | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test__str__(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.__str__` method."""
assert (
str(self._signal)
== (
textwrap.dedent(
"""
[[ 0. 10.]
[ 1. 20.]
[ 2. 30.]... | Test :func:`colour.continuous.signal.Signal.__str__` method. | test__str__ | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test__repr__(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.__repr__` method."""
assert repr(self._signal) == (
textwrap.dedent(
"""
Signal([[ 0., 10.],
[ 1., 20.],
[ 2., 30.],
... | Test :func:`colour.continuous.signal.Signal.__repr__` method. | test__repr__ | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test__getitem__(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.__getitem__` method."""
assert self._signal[0] == 10.0
np.testing.assert_allclose(
self._signal[np.array([0, 1, 2])],
np.array([10.0, 20.0, 30.0]),
atol=TOLERANCE_ABSOLUTE_TEST... | Test :func:`colour.continuous.signal.Signal.__getitem__` method. | test__getitem__ | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test__setitem__(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.__setitem__` method."""
signal = self._signal.copy()
signal[0] = 20
np.testing.assert_allclose(
signal.range,
np.array([20.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0]... | Test :func:`colour.continuous.signal.Signal.__setitem__` method. | test__setitem__ | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test__contains__(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.__contains__` method."""
assert 0 in self._signal
assert 0.5 in self._signal
assert 1000 not in self._signal | Test :func:`colour.continuous.signal.Signal.__contains__` method. | test__contains__ | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test__eq__(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.__eq__` method."""
signal_1 = self._signal.copy()
signal_2 = self._signal.copy()
assert signal_1 == signal_2 | Test :func:`colour.continuous.signal.Signal.__eq__` method. | test__eq__ | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test__ne__(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.__ne__` method."""
signal_1 = self._signal.copy()
signal_2 = self._signal.copy()
signal_2[0] = 20
assert signal_1 != signal_2
signal_2[0] = 10
assert signal_1 == signal_2
sign... | Test :func:`colour.continuous.signal.Signal.__ne__` method. | test__ne__ | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_arithmetical_operation(self) -> None:
"""
Test :meth:`colour.continuous.signal.Signal.arithmetical_operation`
method.
"""
np.testing.assert_allclose(
self._signal.arithmetical_operation(10, "+", False).range,
self._range + 10,
atol=TO... |
Test :meth:`colour.continuous.signal.Signal.arithmetical_operation`
method.
| test_arithmetical_operation | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_is_uniform(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.is_uniform` method."""
assert self._signal.is_uniform()
signal = self._signal.copy()
signal[0.5] = 1.0
assert not signal.is_uniform() | Test :func:`colour.continuous.signal.Signal.is_uniform` method. | test_is_uniform | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_copy(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.copy` method."""
assert self._signal is not self._signal.copy()
assert self._signal == self._signal.copy() | Test :func:`colour.continuous.signal.Signal.copy` method. | test_copy | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_signal_unpack_data(self) -> None:
"""
Test :meth:`colour.continuous.signal.Signal.signal_unpack_data`
method.
"""
domain, range_ = Signal.signal_unpack_data(self._range)
np.testing.assert_array_equal(range_, self._range)
np.testing.assert_array_equal(dom... |
Test :meth:`colour.continuous.signal.Signal.signal_unpack_data`
method.
| test_signal_unpack_data | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_fill_nan(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.fill_nan` method."""
signal = self._signal.copy()
signal[3:7] = np.nan
np.testing.assert_allclose(
signal.fill_nan().range,
np.array([10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0,... | Test :func:`colour.continuous.signal.Signal.fill_nan` method. | test_fill_nan | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_domain_distance(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.domain_distance` method."""
np.testing.assert_allclose(
self._signal.domain_distance(0.5),
0.5,
atol=TOLERANCE_ABSOLUTE_TESTS,
)
np.testing.assert_allclose(
... | Test :func:`colour.continuous.signal.Signal.domain_distance` method. | test_domain_distance | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def test_to_series(self) -> None:
"""Test :func:`colour.continuous.signal.Signal.to_series` method."""
if is_pandas_installed():
from pandas import Series
assert (
Signal(self._range, self._domain).to_series().all()
== Series(dict(zip(self._domai... | Test :func:`colour.continuous.signal.Signal.to_series` method. | test_to_series | python | colour-science/colour | colour/continuous/tests/test_signal.py | https://github.com/colour-science/colour/blob/master/colour/continuous/tests/test_signal.py | BSD-3-Clause |
def optical_MTF_Barten1999(u: ArrayLike, sigma: ArrayLike = 0.01) -> NDArrayFloat:
"""
Return the optical modulation transfer function (MTF) :math:`M_{opt}` of
the eye using *Barten (1999)* method.
Parameters
----------
u
Spatial frequency :math:`u`, the cycles per degree.
sigma
... |
Return the optical modulation transfer function (MTF) :math:`M_{opt}` of
the eye using *Barten (1999)* method.
Parameters
----------
u
Spatial frequency :math:`u`, the cycles per degree.
sigma
Standard deviation :math:`\sigma` of the line-spread function
resulting from ... | optical_MTF_Barten1999 | python | colour-science/colour | colour/contrast/barten1999.py | https://github.com/colour-science/colour/blob/master/colour/contrast/barten1999.py | BSD-3-Clause |
def pupil_diameter_Barten1999(
L: ArrayLike,
X_0: ArrayLike = 60,
Y_0: ArrayLike | None = None,
) -> NDArrayFloat:
"""
Return the pupil diameter for specified luminance and object or stimulus
angular size using *Barten (1999)* method.
Parameters
----------
L
Average luminanc... |
Return the pupil diameter for specified luminance and object or stimulus
angular size using *Barten (1999)* method.
Parameters
----------
L
Average luminance :math:`L` in :math:`cd/m^2`.
X_0
Angular size of the object :math:`X_0` in degrees in the x direction.
Y_0
A... | pupil_diameter_Barten1999 | python | colour-science/colour | colour/contrast/barten1999.py | https://github.com/colour-science/colour/blob/master/colour/contrast/barten1999.py | BSD-3-Clause |
def sigma_Barten1999(
sigma_0: ArrayLike = 0.5 / 60,
C_ab: ArrayLike = 0.08 / 60,
d: ArrayLike = 2.1,
) -> NDArrayFloat:
"""
Return the standard deviation :math:`\\sigma` of the line-spread function
resulting from the convolution of the different elements of the convolution
process using *Ba... |
Return the standard deviation :math:`\sigma` of the line-spread function
resulting from the convolution of the different elements of the convolution
process using *Barten (1999)* method.
The :math:`\sigma` quantity depends on the pupil diameter :math:`d` of the
eye lens. For very small pupil diame... | sigma_Barten1999 | python | colour-science/colour | colour/contrast/barten1999.py | https://github.com/colour-science/colour/blob/master/colour/contrast/barten1999.py | BSD-3-Clause |
def retinal_illuminance_Barten1999(
L: ArrayLike,
d: ArrayLike = 2.1,
apply_stiles_crawford_effect_correction: bool = True,
) -> NDArrayFloat:
"""
Return the retinal illuminance :math:`E` in Trolands for specified
average luminance :math:`L` and pupil diameter :math:`d` using
*Barten (1999)*... |
Return the retinal illuminance :math:`E` in Trolands for specified
average luminance :math:`L` and pupil diameter :math:`d` using
*Barten (1999)* method.
Parameters
----------
L
Average luminance :math:`L` in :math:`cd/m^2`.
d
Pupil diameter :math:`d` in millimeters.
ap... | retinal_illuminance_Barten1999 | python | colour-science/colour | colour/contrast/barten1999.py | https://github.com/colour-science/colour/blob/master/colour/contrast/barten1999.py | BSD-3-Clause |
def maximum_angular_size_Barten1999(
u: ArrayLike,
X_0: ArrayLike = 60,
X_max: ArrayLike = 12,
N_max: ArrayLike = 15,
) -> NDArrayFloat:
"""
Return the maximum angular size :math:`X` of the object considered using
*Barten (1999)* method.
Parameters
----------
u
Spatial f... |
Return the maximum angular size :math:`X` of the object considered using
*Barten (1999)* method.
Parameters
----------
u
Spatial frequency :math:`u`, the cycles per degree.
X_0
Angular size :math:`X_0` in degrees of the object in the x direction.
X_max
Maximum angul... | maximum_angular_size_Barten1999 | python | colour-science/colour | colour/contrast/barten1999.py | https://github.com/colour-science/colour/blob/master/colour/contrast/barten1999.py | BSD-3-Clause |
def contrast_sensitivity_function_Barten1999(
u: ArrayLike,
sigma: ArrayLike = SIGMA_DEFAULT,
k: ArrayLike = 3.0,
T: ArrayLike = 0.1,
X_0: ArrayLike = 60,
Y_0: ArrayLike | None = None,
X_max: ArrayLike = 12,
Y_max: ArrayLike | None = None,
N_max: ArrayLike = 15,
n: ArrayLike = 0.... |
Return the contrast sensitivity :math:`S` of the human eye according to
the contrast sensitivity function (CSF) described by *Barten (1999)*.
Contrast sensitivity is defined as the inverse of the modulation threshold
of a sinusoidal luminance pattern. The modulation threshold of this pattern
is ge... | contrast_sensitivity_function_Barten1999 | python | colour-science/colour | colour/contrast/barten1999.py | https://github.com/colour-science/colour/blob/master/colour/contrast/barten1999.py | BSD-3-Clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.