colour.MultiSpectralPowerDistribution¶
-
class
colour.
MultiSpectralPowerDistribution
(data=None, domain=None, labels=None, **kwargs)[source]¶ Defines multi-spectral power distribution: the base object for multi spectral computations. It is used to model colour matching functions, display primaries, camera sensitivities, etc…
The multi-spectral power 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 MultiSpectralPowerDistribution or array_like or dict_like, optional) – Data to be stored in the multi-spectral power distribution.
- domain (array_like, optional) – Values to initialise the multiple
colour.SpectralPowerDistribution
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.SpectralPowerDistribution
class instances.
Other Parameters: - name (unicode, optional) – Multi-spectral power distribution name.
- interpolator (object, optional) – Interpolator class type to use as interpolating function for the
colour.SpectralPowerDistribution
class instances. - interpolator_args (dict_like, optional) – Arguments to use when instantiating the interpolating function
of the
colour.SpectralPowerDistribution
class instances. - extrapolator (object, optional) – Extrapolator class type to use as extrapolating function for the
colour.SpectralPowerDistribution
class instances. - extrapolator_args (dict_like, optional) – Arguments to use when instantiating the extrapolating function
of the
colour.SpectralPowerDistribution
class instances. - strict_labels (array_like, optional) – Multi-spectral power distribution labels for figures, default to
colour.MultiSpectralPowerDistribution.labels
attribute value.
-
strict_name
¶
-
strict_labels
¶
-
wavelengths
¶
-
values
¶
-
shape
¶
References
Examples
Instantiating a multi-spectral power 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): ... MultiSpectralPowerDistribution(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 power distribution with a non-uniformly spaced independent variable:
>>> data[511] = (0.00314, 0.31416, 0.03142) >>> with numpy_print_options(suppress=True): ... MultiSpectralPowerDistribution(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={...})
Methods
__init__
([data, domain, labels])align
(shape[, interpolator, …])Aligns the multi-spectral power 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, must be reimplemented by sub-classes. domain_distance
(a)Returns the euclidean distance between given array and independent domain \(x\) closest element. extrapolate
(shape[, extrapolator, …])Extrapolates the multi-spectral power distribution in-place accordingly 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 power distribution in-place accordingly 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 power distribution with given normalization factor. to_dataframe
()Converts the continuous signal to a Pandas DataFrame
class instance.trim
(shape)Trims the multi-spectral power distribution wavelengths to given shape. trim_wavelengths
(shape)zeros
()