colour.MultiSpectralDistributions

class colour.MultiSpectralDistributions(data: Optional[Union[ArrayLike, DataFrame, dict, MultiSignals, MultiSpectralDistributions, Sequence, Series, Signal, SpectralDistribution]] = None, domain: Optional[Union[ArrayLike, SpectralShape]] = None, labels: Optional[Sequence] = None, **kwargs: Any)[source]

Bases: colour.continuous.multi_signals.MultiSignals

Define 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.

Important

Specific documentation about getting, setting, indexing and slicing the multi-spectral power distributions values is available in the Spectral Representation and Continuous Signal section.

Parameters
  • data (Optional[Union[ArrayLike, DataFrame, dict, MultiSignals, MultiSpectralDistributions, Sequence, Series, Signal, SpectralDistribution]]) – Data to be stored in the multi-spectral distributions.

  • domain (Optional[Union[ArrayLike, SpectralShape]]) – Values to initialise the multiple colour.SpectralDistribution class instances colour.continuous.Signal.wavelengths attribute with. If both data and domain arguments are defined, the latter will be used to initialise the colour.continuous.Signal.wavelengths property.

  • labels (Optional[Sequence]) – Names to use for the colour.SpectralDistribution class instances.

  • extrapolator – Extrapolator class type to use as extrapolating function for the colour.SpectralDistribution class instances.

  • extrapolator_kwargs – Arguments to use when instantiating the extrapolating function of the colour.SpectralDistribution class instances.

  • interpolator – Interpolator class type to use as interpolating function for the colour.SpectralDistribution class instances.

  • interpolator_kwargs – Arguments to use when instantiating the interpolating function of the colour.SpectralDistribution class instances.

  • name – Multi-spectral distributions name.

  • strict_labels – Multi-spectral distributions labels for figures, default to colour.MultiSpectralDistributions.labels property value.

  • kwargs (Any) –

Attributes

Methods

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_kwargs={},
             ... extrapolator=Extrapolator,
             ... extrapolator_kwargs={...})

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_kwargs={},
             ... extrapolator=Extrapolator,
             ... extrapolator_kwargs={...})

Instantiation with a Pandas DataFrame:

>>> from colour.utilities import is_pandas_installed
>>> if is_pandas_installed():
...     from pandas import DataFrame
...     x_bar = [data[key][0] for key in sorted(data.keys())]
...     y_bar = [data[key][1] for key in sorted(data.keys())]
...     z_bar = [data[key][2] for key in sorted(data.keys())]
...     print(MultiSignals(  
...         DataFrame(
...             dict(zip(labels, [x_bar, y_bar, z_bar])), data.keys())))
[[  5.0000000...e+02   4.9000000...e-03   3.2300000...e-01   2.7200000...e-01]
 [  5.1000000...e+02   9.3000000...e-03   5.0300000...e-01   1.5820000...e-01]
 [  5.2000000...e+02   3.1400000...e-03   3.1416000...e-01   3.1420000...e-02]
 [  5.3000000...e+02   6.3270000...e-02   7.1000000...e-01   7.8250000...e-02]
 [  5.4000000...e+02   1.6550000...e-01   8.6200000...e-01   4.2160000...e-02]
 [  5.5000000...e+02   2.9040000...e-01   9.5400000...e-01   2.0300000...e-02]
 [  5.6000000...e+02   4.3345000...e-01   9.9495000...e-01   8.7500000...e-03]
 [  5.1100000...e+02   5.9450000...e-01   9.9500000...e-01   3.9000000...e-03]]
__init__(data: Optional[Union[ArrayLike, DataFrame, dict, MultiSignals, MultiSpectralDistributions, Sequence, Series, Signal, SpectralDistribution]] = None, domain: Optional[Union[ArrayLike, SpectralShape]] = None, labels: Optional[Sequence] = None, **kwargs: Any)[source]
Parameters
property strict_name: str

Getter and setter property for the multi-spectral distributions strict name.

Parameters

value – Value to set the multi-spectral distributions strict name with.

Returns

Multi-spectral distributions strict name.

Return type

str

property strict_labels: List[str]

Getter and setter property for the multi-spectral distributions strict labels.

Parameters

value – Value to set the multi-spectral distributions strict labels with.

Returns

Multi-spectral distributions strict labels.

Return type

list

property wavelengths: numpy.ndarray

Getter and setter property for the multi-spectral distributions wavelengths \(\lambda_n\).

Parameters

value – Value to set the multi-spectral distributions wavelengths \(\lambda_n\) with.

Returns

Multi-spectral distributions wavelengths \(\lambda_n\).

Return type

numpy.ndarray

property values: numpy.ndarray

Getter and setter property for the multi-spectral distributions values.

Parameters

value – Value to set the multi-spectral distributions wavelengths values with.

Returns

Multi-spectral distributions values.

Return type

numpy.ndarray

property shape: colour.colorimetry.spectrum.SpectralShape

Getter property for the multi-spectral distributions shape.

Returns

Multi-spectral distributions shape.

Return type

colour.SpectralShape

Notes

  • Multi-spectral distributions with a non-uniformly spaced independent variable have multiple intervals, in that case colour.MultiSpectralDistributions.shape property returns the minimum interval size.

Examples

Shape of 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)
... }
>>> MultiSpectralDistributions(data).shape
SpectralShape(500.0, 560.0, 10.0)

Shape of the multi-spectral distributions with a non-uniformly spaced independent variable:

>>> data[511] = (0.00314, 0.31416, 0.03142)
>>> MultiSpectralDistributions(data).shape
SpectralShape(500.0, 560.0, 1.0)
interpolate(shape: colour.colorimetry.spectrum.SpectralShape, interpolator: Optional[Type[colour.hints.TypeInterpolator]] = None, interpolator_kwargs: Optional[Dict] = None) colour.colorimetry.spectrum.MultiSpectralDistributions[source]

Interpolate the multi-spectral distributions in-place according to CIE 167:2005 recommendation (if the interpolator has not been changed at instantiation time) or given interpolation arguments.

The logic for choosing the interpolator class when interpolator is not given is as follows:

if self.interpolator not in (SpragueInterpolator,
                             CubicSplineInterpolator):
    interpolator = self.interpolator
elif self.is_uniform():
    interpolator = SpragueInterpolator
else:
    interpolator = CubicSplineInterpolator

The logic for choosing the interpolator keyword arguments when interpolator_kwargs is not given is as follows:

if self.interpolator not in (SpragueInterpolator,
                             CubicSplineInterpolator):
    interpolator_kwargs = self.interpolator_kwargs
else:
    interpolator_kwargs = {}
Parameters
Returns

Interpolated multi-spectral distributions.

Return type

colour.MultiSpectralDistributions

Notes

Warning

See colour.SpectralDistribution.interpolate() method warning section.

References

[CIET13805a]

Examples

Multi-spectral distributions with a uniformly spaced independent variable uses Sprague (1880) interpolation:

>>> 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)
... }
>>> msds = MultiSpectralDistributions(data)
>>> with numpy_print_options(suppress=True):
...     print(msds.interpolate(SpectralShape(500, 560, 1)))
... 
[[ 500.            0.0049   ...    0.323    ...    0.272    ...]
 [ 501.            0.0043252...    0.3400642...    0.2599848...]
 [ 502.            0.0037950...    0.3572165...    0.2479849...]
 [ 503.            0.0033761...    0.3744030...    0.2360688...]
 [ 504.            0.0031397...    0.3916650...    0.2242878...]
 [ 505.            0.0031582...    0.4091067...    0.2126801...]
 [ 506.            0.0035019...    0.4268629...    0.2012748...]
 [ 507.            0.0042365...    0.4450668...    0.1900968...]
 [ 508.            0.0054192...    0.4638181...    0.1791709...]
 [ 509.            0.0070965...    0.4831505...    0.1685260...]
 [ 510.            0.0093   ...    0.503    ...    0.1582   ...]
 [ 511.            0.0120562...    0.5232543...    0.1482365...]
 [ 512.            0.0154137...    0.5439717...    0.1386625...]
 [ 513.            0.0193991...    0.565139 ...    0.1294993...]
 [ 514.            0.0240112...    0.5866255...    0.1207676...]
 [ 515.            0.0292289...    0.6082226...    0.1124864...]
 [ 516.            0.0350192...    0.6296821...    0.1046717...]
 [ 517.            0.0413448...    0.6507558...    0.0973361...]
 [ 518.            0.0481727...    0.6712346...    0.0904871...]
 [ 519.            0.0554816...    0.6909873...    0.0841267...]
 [ 520.            0.06327  ...    0.71     ...    0.07825  ...]
 [ 521.            0.0715642...    0.7283456...    0.0728614...]
 [ 522.            0.0803970...    0.7459679...    0.0680051...]
 [ 523.            0.0897629...    0.7628184...    0.0636823...]
 [ 524.            0.0996227...    0.7789004...    0.0598449...]
 [ 525.            0.1099142...    0.7942533...    0.0564111...]
 [ 526.            0.1205637...    0.8089368...    0.0532822...]
 [ 527.            0.1314973...    0.8230153...    0.0503588...]
 [ 528.            0.1426523...    0.8365417...    0.0475571...]
 [ 529.            0.1539887...    0.8495422...    0.0448253...]
 [ 530.            0.1655   ...    0.862    ...    0.04216  ...]
 [ 531.            0.1772055...    0.8738585...    0.0395936...]
 [ 532.            0.1890877...    0.8850940...    0.0371046...]
 [ 533.            0.2011304...    0.8957073...    0.0346733...]
 [ 534.            0.2133310...    0.9057092...    0.0323006...]
 [ 535.            0.2256968...    0.9151181...    0.0300011...]
 [ 536.            0.2382403...    0.9239560...    0.0277974...]
 [ 537.            0.2509754...    0.9322459...    0.0257131...]
 [ 538.            0.2639130...    0.9400080...    0.0237668...]
 [ 539.            0.2770569...    0.9472574...    0.0219659...]
 [ 540.            0.2904   ...    0.954    ...    0.0203   ...]
 [ 541.            0.3039194...    0.9602409...    0.0187414...]
 [ 542.            0.3175893...    0.9660106...    0.0172748...]
 [ 543.            0.3314022...    0.9713260...    0.0158947...]
 [ 544.            0.3453666...    0.9761850...    0.0146001...]
 [ 545.            0.3595019...    0.9805731...    0.0133933...]
 [ 546.            0.3738324...    0.9844703...    0.0122777...]
 [ 547.            0.3883818...    0.9878583...    0.0112562...]
 [ 548.            0.4031674...    0.9907270...    0.0103302...]
 [ 549.            0.4181943...    0.9930817...    0.0094972...]
 [ 550.            0.43345  ...    0.99495  ...    0.00875  ...]
 [ 551.            0.4489082...    0.9963738...    0.0080748...]
 [ 552.            0.4645599...    0.9973682...    0.0074580...]
 [ 553.            0.4803950...    0.9979568...    0.0068902...]
 [ 554.            0.4963962...    0.9981802...    0.0063660...]
 [ 555.            0.5125410...    0.9980910...    0.0058818...]
 [ 556.            0.5288034...    0.9977488...    0.0054349...]
 [ 557.            0.5451560...    0.9972150...    0.0050216...]
 [ 558.            0.5615719...    0.9965479...    0.0046357...]
 [ 559.            0.5780267...    0.9957974...    0.0042671...]
 [ 560.            0.5945   ...    0.995    ...    0.0039   ...]]

Multi-spectral distributions with a non-uniformly spaced independent variable uses Cubic Spline interpolation:

>>> data[511] = (0.00314, 0.31416, 0.03142)
>>> msds = MultiSpectralDistributions(data)
>>> with numpy_print_options(suppress=True):
...     print(msds.interpolate(SpectralShape(500, 560, 1)))
... 
[[ 500.            0.0049   ...    0.323    ...    0.272    ...]
 [ 501.            0.0300110...    0.9455153...    0.5985102...]
 [ 502.            0.0462136...    1.3563103...    0.8066498...]
 [ 503.            0.0547925...    1.5844039...    0.9126502...]
 [ 504.            0.0570325...    1.6588148...    0.9327429...]
 [ 505.            0.0542183...    1.6085619...    0.8831594...]
 [ 506.            0.0476346...    1.4626640...    0.7801312...]
 [ 507.            0.0385662...    1.2501401...    0.6398896...]
 [ 508.            0.0282978...    1.0000089...    0.4786663...]
 [ 509.            0.0181142...    0.7412892...    0.3126925...]
 [ 510.            0.0093   ...    0.503    ...    0.1582   ...]
 [ 511.            0.00314  ...    0.31416  ...    0.03142  ...]
 [ 512.            0.0006228...    0.1970419...   -0.0551709...]
 [ 513.            0.0015528...    0.1469341...   -0.1041165...]
 [ 514.            0.0054381...    0.1523785...   -0.1217152...]
 [ 515.            0.0117869...    0.2019173...   -0.1142659...]
 [ 516.            0.0201073...    0.2840925...   -0.0880670...]
 [ 517.            0.0299077...    0.3874463...   -0.0494174...]
 [ 518.            0.0406961...    0.5005208...   -0.0046156...]
 [ 519.            0.0519808...    0.6118579...    0.0400397...]
 [ 520.            0.06327  ...    0.71     ...    0.07825  ...]
 [ 521.            0.0741690...    0.7859059...    0.1050384...]
 [ 522.            0.0846726...    0.8402033...    0.1207164...]
 [ 523.            0.0948728...    0.8759363...    0.1269173...]
 [ 524.            0.1048614...    0.8961496...    0.1252743...]
 [ 525.            0.1147305...    0.9038874...    0.1174207...]
 [ 526.            0.1245719...    0.9021942...    0.1049899...]
 [ 527.            0.1344776...    0.8941145...    0.0896151...]
 [ 528.            0.1445395...    0.8826926...    0.0729296...]
 [ 529.            0.1548497...    0.8709729...    0.0565668...]
 [ 530.            0.1655   ...    0.862    ...    0.04216  ...]
 [ 531.            0.1765618...    0.858179 ...    0.0309976...]
 [ 532.            0.1880244...    0.8593588...    0.0229897...]
 [ 533.            0.1998566...    0.8647493...    0.0177013...]
 [ 534.            0.2120269...    0.8735601...    0.0146975...]
 [ 535.            0.2245042...    0.8850011...    0.0135435...]
 [ 536.            0.2372572...    0.8982820...    0.0138044...]
 [ 537.            0.2502546...    0.9126126...    0.0150454...]
 [ 538.            0.2634650...    0.9272026...    0.0168315...]
 [ 539.            0.2768572...    0.9412618...    0.0187280...]
 [ 540.            0.2904   ...    0.954    ...    0.0203   ...]
 [ 541.            0.3040682...    0.9647869...    0.0211987...]
 [ 542.            0.3178617...    0.9736329...    0.0214207...]
 [ 543.            0.3317865...    0.9807080...    0.0210486...]
 [ 544.            0.3458489...    0.9861825...    0.0201650...]
 [ 545.            0.3600548...    0.9902267...    0.0188525...]
 [ 546.            0.3744103...    0.9930107...    0.0171939...]
 [ 547.            0.3889215...    0.9947048...    0.0152716...]
 [ 548.            0.4035944...    0.9954792...    0.0131685...]
 [ 549.            0.4184352...    0.9955042...    0.0109670...]
 [ 550.            0.43345  ...    0.99495  ...    0.00875  ...]
 [ 551.            0.4486447...    0.9939867...    0.0065999...]
 [ 552.            0.4640255...    0.9927847...    0.0045994...]
 [ 553.            0.4795984...    0.9915141...    0.0028313...]
 [ 554.            0.4953696...    0.9903452...    0.0013781...]
 [ 555.            0.5113451...    0.9894483...    0.0003224...]
 [ 556.            0.5275310...    0.9889934...   -0.0002530...]
 [ 557.            0.5439334...    0.9891509...   -0.0002656...]
 [ 558.            0.5605583...    0.9900910...    0.0003672...]
 [ 559.            0.5774118...    0.9919840...    0.0017282...]
 [ 560.            0.5945   ...    0.995    ...    0.0039   ...]]
extrapolate(shape: colour.colorimetry.spectrum.SpectralShape, extrapolator: Optional[Type[colour.hints.TypeExtrapolator]] = None, extrapolator_kwargs: Optional[Dict] = None) colour.colorimetry.spectrum.MultiSpectralDistributions[source]

Extrapolate the multi-spectral distributions in-place according to CIE 15:2004 and CIE 167:2005 recommendations or given extrapolation arguments.

Parameters
Returns

Extrapolated multi-spectral distributions.

Return type

colour.MultiSpectralDistributions

References

[CIET13805c], [CIET14804h]

Examples

>>> 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)
... }
>>> msds = MultiSpectralDistributions(data)
>>> msds.extrapolate(SpectralShape(400, 700, 10)).shape
SpectralShape(400.0, 700.0, 10.0)
>>> with numpy_print_options(suppress=True):
...     print(msds)
[[ 400.         0.0049     0.323      0.272  ]
 [ 410.         0.0049     0.323      0.272  ]
 [ 420.         0.0049     0.323      0.272  ]
 [ 430.         0.0049     0.323      0.272  ]
 [ 440.         0.0049     0.323      0.272  ]
 [ 450.         0.0049     0.323      0.272  ]
 [ 460.         0.0049     0.323      0.272  ]
 [ 470.         0.0049     0.323      0.272  ]
 [ 480.         0.0049     0.323      0.272  ]
 [ 490.         0.0049     0.323      0.272  ]
 [ 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 ]
 [ 570.         0.5945     0.995      0.0039 ]
 [ 580.         0.5945     0.995      0.0039 ]
 [ 590.         0.5945     0.995      0.0039 ]
 [ 600.         0.5945     0.995      0.0039 ]
 [ 610.         0.5945     0.995      0.0039 ]
 [ 620.         0.5945     0.995      0.0039 ]
 [ 630.         0.5945     0.995      0.0039 ]
 [ 640.         0.5945     0.995      0.0039 ]
 [ 650.         0.5945     0.995      0.0039 ]
 [ 660.         0.5945     0.995      0.0039 ]
 [ 670.         0.5945     0.995      0.0039 ]
 [ 680.         0.5945     0.995      0.0039 ]
 [ 690.         0.5945     0.995      0.0039 ]
 [ 700.         0.5945     0.995      0.0039 ]]
align(shape: colour.colorimetry.spectrum.SpectralShape, interpolator: Optional[Type[colour.hints.TypeInterpolator]] = None, interpolator_kwargs: Optional[Dict] = None, extrapolator: Optional[Type[colour.hints.TypeExtrapolator]] = None, extrapolator_kwargs: Optional[Dict] = None) colour.colorimetry.spectrum.MultiSpectralDistributions[source]

Align the multi-spectral distributions in-place to given spectral shape: Interpolates first then extrapolates to fit the given range.

Interpolation is performed according to CIE 167:2005 recommendation (if the interpolator has not been changed at instantiation time) or given interpolation arguments.

The logic for choosing the interpolator class when interpolator is not given is as follows:

if self.interpolator not in (SpragueInterpolator,
                             CubicSplineInterpolator):
    interpolator = self.interpolator
elif self.is_uniform():
    interpolator = SpragueInterpolator
else:
    interpolator = CubicSplineInterpolator

The logic for choosing the interpolator keyword arguments when interpolator_kwargs is not given is as follows:

if self.interpolator not in (SpragueInterpolator,
                             CubicSplineInterpolator):
    interpolator_kwargs = self.interpolator_kwargs
else:
    interpolator_kwargs = {}
Parameters
Returns

Aligned multi-spectral distributions.

Return type

colour.MultiSpectralDistributions

Examples

>>> 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)
... }
>>> msds = MultiSpectralDistributions(data)
>>> with numpy_print_options(suppress=True):
...     print(msds.align(SpectralShape(505, 565, 1)))
... 
[[ 505.            0.0031582...    0.4091067...    0.2126801...]
 [ 506.            0.0035019...    0.4268629...    0.2012748...]
 [ 507.            0.0042365...    0.4450668...    0.1900968...]
 [ 508.            0.0054192...    0.4638181...    0.1791709...]
 [ 509.            0.0070965...    0.4831505...    0.1685260...]
 [ 510.            0.0093   ...    0.503    ...    0.1582   ...]
 [ 511.            0.0120562...    0.5232543...    0.1482365...]
 [ 512.            0.0154137...    0.5439717...    0.1386625...]
 [ 513.            0.0193991...    0.565139 ...    0.1294993...]
 [ 514.            0.0240112...    0.5866255...    0.1207676...]
 [ 515.            0.0292289...    0.6082226...    0.1124864...]
 [ 516.            0.0350192...    0.6296821...    0.1046717...]
 [ 517.            0.0413448...    0.6507558...    0.0973361...]
 [ 518.            0.0481727...    0.6712346...    0.0904871...]
 [ 519.            0.0554816...    0.6909873...    0.0841267...]
 [ 520.            0.06327  ...    0.71     ...    0.07825  ...]
 [ 521.            0.0715642...    0.7283456...    0.0728614...]
 [ 522.            0.0803970...    0.7459679...    0.0680051...]
 [ 523.            0.0897629...    0.7628184...    0.0636823...]
 [ 524.            0.0996227...    0.7789004...    0.0598449...]
 [ 525.            0.1099142...    0.7942533...    0.0564111...]
 [ 526.            0.1205637...    0.8089368...    0.0532822...]
 [ 527.            0.1314973...    0.8230153...    0.0503588...]
 [ 528.            0.1426523...    0.8365417...    0.0475571...]
 [ 529.            0.1539887...    0.8495422...    0.0448253...]
 [ 530.            0.1655   ...    0.862    ...    0.04216  ...]
 [ 531.            0.1772055...    0.8738585...    0.0395936...]
 [ 532.            0.1890877...    0.8850940...    0.0371046...]
 [ 533.            0.2011304...    0.8957073...    0.0346733...]
 [ 534.            0.2133310...    0.9057092...    0.0323006...]
 [ 535.            0.2256968...    0.9151181...    0.0300011...]
 [ 536.            0.2382403...    0.9239560...    0.0277974...]
 [ 537.            0.2509754...    0.9322459...    0.0257131...]
 [ 538.            0.2639130...    0.9400080...    0.0237668...]
 [ 539.            0.2770569...    0.9472574...    0.0219659...]
 [ 540.            0.2904   ...    0.954    ...    0.0203   ...]
 [ 541.            0.3039194...    0.9602409...    0.0187414...]
 [ 542.            0.3175893...    0.9660106...    0.0172748...]
 [ 543.            0.3314022...    0.9713260...    0.0158947...]
 [ 544.            0.3453666...    0.9761850...    0.0146001...]
 [ 545.            0.3595019...    0.9805731...    0.0133933...]
 [ 546.            0.3738324...    0.9844703...    0.0122777...]
 [ 547.            0.3883818...    0.9878583...    0.0112562...]
 [ 548.            0.4031674...    0.9907270...    0.0103302...]
 [ 549.            0.4181943...    0.9930817...    0.0094972...]
 [ 550.            0.43345  ...    0.99495  ...    0.00875  ...]
 [ 551.            0.4489082...    0.9963738...    0.0080748...]
 [ 552.            0.4645599...    0.9973682...    0.0074580...]
 [ 553.            0.4803950...    0.9979568...    0.0068902...]
 [ 554.            0.4963962...    0.9981802...    0.0063660...]
 [ 555.            0.5125410...    0.9980910...    0.0058818...]
 [ 556.            0.5288034...    0.9977488...    0.0054349...]
 [ 557.            0.5451560...    0.9972150...    0.0050216...]
 [ 558.            0.5615719...    0.9965479...    0.0046357...]
 [ 559.            0.5780267...    0.9957974...    0.0042671...]
 [ 560.            0.5945   ...    0.995    ...    0.0039   ...]
 [ 561.            0.5945   ...    0.995    ...    0.0039   ...]
 [ 562.            0.5945   ...    0.995    ...    0.0039   ...]
 [ 563.            0.5945   ...    0.995    ...    0.0039   ...]
 [ 564.            0.5945   ...    0.995    ...    0.0039   ...]
 [ 565.            0.5945   ...    0.995    ...    0.0039   ...]]
trim(shape: colour.colorimetry.spectrum.SpectralShape) colour.colorimetry.spectrum.MultiSpectralDistributions[source]

Trim the multi-spectral distributions wavelengths to given shape.

Parameters

shape (colour.colorimetry.spectrum.SpectralShape) – Spectral shape used for trimming.

Returns

Trimmed multi-spectral distributions.

Return type

colour.MultiSpectralDistributions

Examples

>>> 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)
... }
>>> msds = MultiSpectralDistributions(data)
>>> msds = msds.interpolate(SpectralShape(500, 560, 1))
>>> with numpy_print_options(suppress=True):
...     print(msds.trim(SpectralShape(520, 580, 5)))
... 
[[ 520.            0.06327  ...    0.71     ...    0.07825  ...]
 [ 521.            0.0715642...    0.7283456...    0.0728614...]
 [ 522.            0.0803970...    0.7459679...    0.0680051...]
 [ 523.            0.0897629...    0.7628184...    0.0636823...]
 [ 524.            0.0996227...    0.7789004...    0.0598449...]
 [ 525.            0.1099142...    0.7942533...    0.0564111...]
 [ 526.            0.1205637...    0.8089368...    0.0532822...]
 [ 527.            0.1314973...    0.8230153...    0.0503588...]
 [ 528.            0.1426523...    0.8365417...    0.0475571...]
 [ 529.            0.1539887...    0.8495422...    0.0448253...]
 [ 530.            0.1655   ...    0.862    ...    0.04216  ...]
 [ 531.            0.1772055...    0.8738585...    0.0395936...]
 [ 532.            0.1890877...    0.8850940...    0.0371046...]
 [ 533.            0.2011304...    0.8957073...    0.0346733...]
 [ 534.            0.2133310...    0.9057092...    0.0323006...]
 [ 535.            0.2256968...    0.9151181...    0.0300011...]
 [ 536.            0.2382403...    0.9239560...    0.0277974...]
 [ 537.            0.2509754...    0.9322459...    0.0257131...]
 [ 538.            0.2639130...    0.9400080...    0.0237668...]
 [ 539.            0.2770569...    0.9472574...    0.0219659...]
 [ 540.            0.2904   ...    0.954    ...    0.0203   ...]
 [ 541.            0.3039194...    0.9602409...    0.0187414...]
 [ 542.            0.3175893...    0.9660106...    0.0172748...]
 [ 543.            0.3314022...    0.9713260...    0.0158947...]
 [ 544.            0.3453666...    0.9761850...    0.0146001...]
 [ 545.            0.3595019...    0.9805731...    0.0133933...]
 [ 546.            0.3738324...    0.9844703...    0.0122777...]
 [ 547.            0.3883818...    0.9878583...    0.0112562...]
 [ 548.            0.4031674...    0.9907270...    0.0103302...]
 [ 549.            0.4181943...    0.9930817...    0.0094972...]
 [ 550.            0.43345  ...    0.99495  ...    0.00875  ...]
 [ 551.            0.4489082...    0.9963738...    0.0080748...]
 [ 552.            0.4645599...    0.9973682...    0.0074580...]
 [ 553.            0.4803950...    0.9979568...    0.0068902...]
 [ 554.            0.4963962...    0.9981802...    0.0063660...]
 [ 555.            0.5125410...    0.9980910...    0.0058818...]
 [ 556.            0.5288034...    0.9977488...    0.0054349...]
 [ 557.            0.5451560...    0.9972150...    0.0050216...]
 [ 558.            0.5615719...    0.9965479...    0.0046357...]
 [ 559.            0.5780267...    0.9957974...    0.0042671...]
 [ 560.            0.5945   ...    0.995    ...    0.0039   ...]]
normalise(factor: Number = 1) colour.colorimetry.spectrum.MultiSpectralDistributions[source]

Normalise the multi-spectral distributions with given normalization factor.

Parameters

factor (Number) – Normalization factor.

Returns

Normalised multi- spectral distribution.

Return type

colour.MultiSpectralDistributions

Notes

Examples

>>> 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)
... }
>>> msds = MultiSpectralDistributions(data)
>>> with numpy_print_options(suppress=True):
...     print(msds.normalise())  
[[ 500.            0.0082422...    0.3246231...    1.       ...]
 [ 510.            0.0156434...    0.5055276...    0.5816176...]
 [ 520.            0.1064255...    0.7135678...    0.2876838...]
 [ 530.            0.2783852...    0.8663316...    0.155    ...]
 [ 540.            0.4884777...    0.9587939...    0.0746323...]
 [ 550.            0.7291000...    0.9999497...    0.0321691...]
 [ 560.            1.       ...    1.       ...    0.0143382...]]
to_sds() List[colour.colorimetry.spectrum.SpectralDistribution][source]

Convert the multi-spectral distributions to a list of spectral distributions.

Returns

List of spectral distributions.

Return type

list

Examples

>>> 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)
... }
>>> msds = MultiSpectralDistributions(data)
>>> with numpy_print_options(suppress=True):
...     for sd in msds.to_sds():
...         print(sd)  
[[ 500.         0.0049 ...]
 [ 510.         0.0093 ...]
 [ 520.         0.06327...]
 [ 530.         0.1655 ...]
 [ 540.         0.2904 ...]
 [ 550.         0.43345...]
 [ 560.         0.5945 ...]]
[[ 500.         0.323  ...]
 [ 510.         0.503  ...]
 [ 520.         0.71   ...]
 [ 530.         0.862  ...]
 [ 540.         0.954  ...]
 [ 550.         0.99495...]
 [ 560.         0.995  ...]]
[[ 500.         0.272  ...]
 [ 510.         0.1582 ...]
 [ 520.         0.07825...]
 [ 530.         0.04216...]
 [ 540.         0.0203 ...]
 [ 550.         0.00875...]
 [ 560.         0.0039 ...]]