colour.MultiSpectralDistribution¶
-
class
colour.MultiSpectralDistribution(data=None, domain=None, labels=None, **kwargs)[source]¶ Defines multi-spectral distribution: the base object for multi spectral computations. It is used to model colour matching functions, display primaries, camera sensitivities, etc…
The multi-spectral distribution 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 MultiSignal or MultiSpectralDistribution or array_like or dict_like, optional) – Data to be stored in the multi-spectral distribution.
- domain (array_like, optional) – Values to initialise the multiple
colour.SpectralDistributionclass instancescolour.continuous.Signal.wavelengthsattribute with. If bothdataanddomainarguments are defined, the latter will be used to initialise thecolour.continuous.Signal.wavelengthsattribute. - labels (array_like, optional) – Names to use for the
colour.SpectralDistributionclass instances.
Other Parameters: - name (unicode, optional) – Multi-spectral distribution name.
- interpolator (object, optional) – Interpolator class type to use as interpolating function for the
colour.SpectralDistributionclass instances. - interpolator_args (dict_like, optional) – Arguments to use when instantiating the interpolating function of the
colour.SpectralDistributionclass instances. - extrapolator (object, optional) – Extrapolator class type to use as extrapolating function for the
colour.SpectralDistributionclass instances. - extrapolator_args (dict_like, optional) – Arguments to use when instantiating the extrapolating function of the
colour.SpectralDistributionclass instances. - strict_labels (array_like, optional) – Multi-spectral distribution labels for figures, default to
colour.MultiSpectralDistribution.labelsattribute value.
-
strict_name¶
-
strict_labels¶
-
wavelengths¶
-
values¶
-
shape¶
References
[CIET13805a], [CIET13805c], [CIET14804h]
Examples
Instantiating a multi-spectral distribution 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): ... MultiSpectralDistribution(data, labels=labels) ... # doctest: +ELLIPSIS 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): ... MultiSpectralDistribution(data, labels=labels) ... # doctest: +ELLIPSIS 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 distribution 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 distribution 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 distribution in-place according to CIE 167:2005 recommendation or given interpolation arguments. is_uniform()Returns if independent domain \(x\) variable is uniform. multi_signal_unpack_data([data, domain, …])Unpack given data for multi-continuous signal instantiation. normalise([factor])Normalises the multi-spectral distribution with given normalization factor. to_dataframe()Converts the continuous signal to a Pandas DataFrameclass 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 distribution wavelengths to given shape. trim_wavelengths(shape)zeros()Attributes
datadomainGetter and setter property for the colour.continuous.Signalsub-class instances independent domain \(x\) variable.dtypeGetter and setter property for the continuous signal dtype. extrapolatorGetter and setter property for the colour.continuous.Signalsub-class instances extrapolator type.extrapolator_argsGetter and setter property for the colour.continuous.Signalsub-class instances extrapolator instantiation time arguments.functionGetter and setter property for the colour.continuous.Signalsub-class instances callable.interpolatorGetter and setter property for the colour.continuous.Signalsub-class instances interpolator type.interpolator_argsGetter and setter property for the colour.continuous.Signalsub-class instances interpolator instantiation time arguments.itemslabelsGetter and setter property for the colour.continuous.Signalsub-class instances name.mappingnameGetter and setter property for the abstract continuous function name. rangeGetter and setter property for the colour.continuous.Signalsub-class instances corresponding range \(y\) variable.shapeGetter and setter property for the multi-spectral distribution shape. signal_typeGetter and setter property for the colour.continuous.Signalsub-class instances type.signalsGetter and setter property for the colour.continuous.Signalsub-class instances.strict_labelsGetter and setter property for the multi-spectral distribution strict labels. strict_nameGetter and setter property for the multi-spectral distribution strict name. titlevaluesGetter and setter property for the multi-spectral distribution values. wavelengthsGetter and setter property for the multi-spectral distribution wavelengths \(\lambda_n\). xyz