colour.MultiSpectralDistributions¶
-
class
colour.
MultiSpectralDistributions
(data=None, domain=None, labels=None, **kwargs)[source]¶ Defines the multi-spectral distributions: the base object for multi spectral computations. It is used to model colour matching functions, display primaries, camera sensitivities, etc…
The multi-spectral distributions will be initialised according to CIE 15:2004 recommendation: the method developed by Sprague (1880) will be used for interpolating functions having a uniformly spaced independent variable and the Cubic Spline method for non-uniformly spaced independent variable. Extrapolation is performed according to CIE 167:2005 recommendation.
- Parameters
data (Series or Dataframe or Signal or MultiSignals or MultiSpectralDistributions or array_like or dict_like, optional) – Data to be stored in the multi-spectral distributions.
domain (array_like, optional) – Values to initialise the multiple
colour.SpectralDistribution
class instancescolour.continuous.Signal.wavelengths
attribute with. If bothdata
anddomain
arguments are defined, the latter will be used to initialise thecolour.continuous.Signal.wavelengths
attribute.labels (array_like, optional) – Names to use for the
colour.SpectralDistribution
class instances.
- Other Parameters
name (unicode, optional) – Multi-spectral distributions name.
interpolator (object, optional) – Interpolator class type to use as interpolating function for the
colour.SpectralDistribution
class instances.interpolator_args (dict_like, optional) – Arguments to use when instantiating the interpolating function of the
colour.SpectralDistribution
class instances.extrapolator (object, optional) – Extrapolator class type to use as extrapolating function for the
colour.SpectralDistribution
class instances.extrapolator_args (dict_like, optional) – Arguments to use when instantiating the extrapolating function of the
colour.SpectralDistribution
class instances.strict_labels (array_like, optional) – Multi-spectral distributions labels for figures, default to
colour.MultiSpectralDistributions.labels
attribute value.
-
strict_name
¶
-
strict_labels
¶
-
wavelengths
¶
-
values
¶
-
shape
¶
References
[CIET13805a], [CIET13805c], [CIET14804h]
Examples
Instantiating the multi-spectral distributions with a uniformly spaced independent variable:
>>> from colour.utilities import numpy_print_options >>> data = { ... 500: (0.004900, 0.323000, 0.272000), ... 510: (0.009300, 0.503000, 0.158200), ... 520: (0.063270, 0.710000, 0.078250), ... 530: (0.165500, 0.862000, 0.042160), ... 540: (0.290400, 0.954000, 0.020300), ... 550: (0.433450, 0.994950, 0.008750), ... 560: (0.594500, 0.995000, 0.003900) ... } >>> labels = ('x_bar', 'y_bar', 'z_bar') >>> with numpy_print_options(suppress=True): ... MultiSpectralDistributions(data, labels=labels) ... MultiSpectral...([[ 500. , 0.0049 , 0.323 , 0.272 ], ... [ 510. , 0.0093 , 0.503 , 0.1582 ], ... [ 520. , 0.06327, 0.71 , 0.07825], ... [ 530. , 0.1655 , 0.862 , 0.04216], ... [ 540. , 0.2904 , 0.954 , 0.0203 ], ... [ 550. , 0.43345, 0.99495, 0.00875], ... [ 560. , 0.5945 , 0.995 , 0.0039 ]], ... labels=[...'x_bar', ...'y_bar', ...'z_bar'], ... interpolator=SpragueInterpolator, ... interpolator_args={}, ... extrapolator=Extrapolator, ... extrapolator_args={...})
Instantiating a spectral distribution with a non-uniformly spaced independent variable:
>>> data[511] = (0.00314, 0.31416, 0.03142) >>> with numpy_print_options(suppress=True): ... MultiSpectralDistributions(data, labels=labels) ... MultiSpectral...([[ 500. , 0.0049 , 0.323 , 0.272 ], ... [ 510. , 0.0093 , 0.503 , 0.1582 ], ... [ 511. , 0.00314, 0.31416, 0.03142], ... [ 520. , 0.06327, 0.71 , 0.07825], ... [ 530. , 0.1655 , 0.862 , 0.04216], ... [ 540. , 0.2904 , 0.954 , 0.0203 ], ... [ 550. , 0.43345, 0.99495, 0.00875], ... [ 560. , 0.5945 , 0.995 , 0.0039 ]], ... labels=[...'x_bar', ...'y_bar', ...'z_bar'], ... interpolator=CubicSplineInterpolator, ... interpolator_args={}, ... extrapolator=Extrapolator, ... extrapolator_args={...})
-
__init__
(data=None, domain=None, labels=None, **kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
([data, domain, labels])Initialize self.
align
(shape[, interpolator, …])Aligns the multi-spectral distributions in-place to given spectral shape: Interpolates first then extrapolates to fit the given range.
arithmetical_operation
(a, operation[, in_place])Performs given arithmetical operation with \(a\) operand, the operation can be either performed on a copy or in-place.
clone
()copy
()Returns a copy of the sub-class instance.
domain_distance
(a)Returns the euclidean distance between given array and independent domain \(x\) closest element.
extrapolate
(shape[, extrapolator, …])Extrapolates the multi-spectral distributions in-place according to CIE 15:2004 and CIE 167:2005 recommendations or given extrapolation arguments.
fill_nan
([method, default])Fill NaNs in independent domain \(x\) variable and corresponding range \(y\) variable using given method.
get
()interpolate
(shape[, interpolator, …])Interpolates the multi-spectral distributions in-place according to CIE 167:2005 recommendation or given interpolation arguments.
is_uniform
()Returns if independent domain \(x\) variable is uniform.
multi_signals_unpack_data
([data, domain, …])Unpack given data for multi-continuous signals instantiation.
normalise
([factor])Normalises the multi-spectral distributions with given normalization factor.
to_dataframe
()Converts the continuous signal to a Pandas
DataFrame
class instance.to_sds
()Converts the multi-spectral distributions to a list of spectral distributions and update their name and strict name using the labels and strict labels.
trim
(shape)Trims the multi-spectral distributions wavelengths to given shape.
trim_wavelengths
(shape)zeros
()Attributes
data
domain
Getter and setter property for the
colour.continuous.Signal
sub-class instances independent domain \(x\) variable.dtype
Getter and setter property for the continuous signal dtype.
extrapolator
Getter and setter property for the
colour.continuous.Signal
sub-class instances extrapolator type.extrapolator_args
Getter and setter property for the
colour.continuous.Signal
sub-class instances extrapolator instantiation time arguments.function
Getter and setter property for the
colour.continuous.Signal
sub-class instances callable.interpolator
Getter and setter property for the
colour.continuous.Signal
sub-class instances interpolator type.interpolator_args
Getter and setter property for the
colour.continuous.Signal
sub-class instances interpolator instantiation time arguments.items
labels
Getter and setter property for the
colour.continuous.Signal
sub-class instances name.mapping
name
Getter and setter property for the abstract continuous function name.
range
Getter and setter property for the
colour.continuous.Signal
sub-class instances corresponding range \(y\) variable.Getter and setter property for the multi-spectral distributions shape.
signal_type
Getter and setter property for the
colour.continuous.Signal
sub-class instances type.signals
Getter and setter property for the
colour.continuous.Signal
sub-class instances.Getter and setter property for the multi-spectral distributions strict labels.
Getter and setter property for the multi-spectral distributions strict name.
title
Getter and setter property for the multi-spectral distributions values.
Getter and setter property for the multi-spectral distributions wavelengths \(\lambda_n\).
x
y
z