colour.quality.cqs Module

Colour Quality Scale

Defines colour quality scale computation objects:

References

[1]Davis, W., & Ohno, Y. (2010). Color quality scale. Optical Engineering, 49(3), 33602–33616. doi:10.1117/1.3360335
[2]Ohno, Y., & Davis, W. (2008). NIST CQS simulation 7.4. Retrieved from http://cie2.nist.gov/TC1-69/NIST CQS simulation 7.4.xls
class colour.quality.cqs.VS_ColorimetryData[source]

Bases: colour.quality.cqs.VS_ColorimetryData

Defines the the class holding VS test colour samples colorimetry data.

class colour.quality.cqs.VS_ColourQualityScaleData[source]

Bases: colour.quality.cqs.VS_ColourQualityScaleData

Defines the the class holding VS test colour samples colour quality scale data.

class colour.quality.cqs.CQS_Specification[source]

Bases: colour.quality.cqs.CQS_Specification

Defines the CQS colour quality specification.

Parameters:
  • name (unicode) – Name of the test spectral power distribution.
  • Q_a (numeric) – Colour quality scale \(Q_a\).
  • Q_f (numeric) – Colour fidelity scale \(Q_f\) intended to evaluate the fidelity of object colour appearances (compared to the reference illuminant of the same correlated colour temperature and illuminance).
  • Q_p (numeric) – Colour preference scale \(Q_p\) similar to colour quality scale \(Q_a\) but placing additional weight on preference of object colour appearance. This metric is based on the notion that increases in chroma are generally preferred and should be rewarded.
  • Q_g (numeric) – Gamut area scale \(Q_g\) representing the relative gamut formed by the (\(a^*\), \(b^*\)) coordinates of the 15 samples illuminated by the test light source in the CIE LAB object colourspace.
  • Q_d (numeric) – Relative gamut area scale \(Q_d\).
  • Q_as (dict) – Individual CQS data for each sample.
  • colorimetry_data (tuple) – Colorimetry data for the test and reference computations.
colour.quality.cqs.colour_quality_scale(spd_test, additional_data=False)[source]

Returns the colour quality scale of given spectral power distribution.

Parameters:
  • spd_test (SpectralPowerDistribution) – Test spectral power distribution.
  • additional_data (bool, optional) – Output additional data.
Returns:

Color quality scale.

Return type:

numeric or CQS_Specification

Examples

>>> from colour import ILLUMINANTS_RELATIVE_SPDS
>>> spd = ILLUMINANTS_RELATIVE_SPDS.get('F2')
>>> colour_quality_scale(spd)  
64.6860580...
colour.quality.cqs.gamut_area(Lab)[source]

Returns the gamut area \(G\) covered by given CIE Lab matrices.

Parameters:Lab (array_like) – CIE Lab colourspace matrices.
Returns:Gamut area \(G\).
Return type:numeric

Examples

>>> Lab = [
...     np.array([39.94996006, 34.59018231, -19.86046321]),
...     np.array([38.88395498, 21.44348519, -34.87805301]),
...     np.array([36.60576301, 7.06742454, -43.21461177]),
...     np.array([46.60142558, -15.90481586, -34.64616865]),
...     np.array([56.50196523, -29.54655550, -20.50177194]),
...     np.array([55.73912101, -43.39520959, -5.08956953]),
...     np.array([56.20776870, -53.68997662, 20.21134410]),
...     np.array([66.16683122, -38.64600327, 42.77396631]),
...     np.array([76.72952110, -23.92148210, 61.04740432]),
...     np.array([82.85370708, -3.98679065, 75.43320144]),
...     np.array([69.26458861, 13.11066359, 68.83858372]),
...     np.array([69.63154351, 28.24532497, 59.45609803]),
...     np.array([61.26281449, 40.87950839, 44.97606172]),
...     np.array([41.62567821, 57.34129516, 27.46718170]),
...     np.array([40.52565174, 48.87449192, 3.45121680])]
>>> gamut_area(Lab)  
8335.9482018...
colour.quality.cqs.vs_colorimetry_data(spd_test, spd_reference, spds_vs, cmfs, chromatic_adaptation=False)[source]

Returns the VS test colour samples colorimetry data.

Parameters:
  • spd_test (SpectralPowerDistribution) – Test spectral power distribution.
  • spd_reference (SpectralPowerDistribution) – Reference spectral power distribution.
  • spds_vs (dict) – VS test colour samples spectral power distributions.
  • cmfs (XYZ_ColourMatchingFunctions) – Standard observer colour matching functions.
  • chromatic_adaptation (bool, optional) – Perform chromatic adaptation.
Returns:

VS test colour samples colorimetry data.

Return type:

list

colour.quality.cqs.CCT_factor(reference_data, XYZ_r)[source]

Returns the correlated colour temperature factor penalizing lamps with extremely low correlated colour temperatures.

Parameters:
  • reference_data (VS_ColorimetryData) – Reference colorimetry data.
  • XYZ_r (array_like) – CIE XYZ tristimulus values for reference.
Returns:

Correlated colour temperature factor.

Return type:

numeric

colour.quality.cqs.scale_conversion(D_E_ab, CCT_factor, scaling_factor=3.104)[source]

Returns the correlated colour temperature factor penalizing lamps with extremely low correlated colour temperatures.

Parameters:
  • reference_data (VS_ColorimetryData) – Reference colorimetry data.
  • spd_reference (SpectralPowerDistribution) – Reference spectral power distribution.
  • cmfs (XYZ_ColourMatchingFunctions) – Standard observer colour matching functions.
Returns:

Correlated colour temperature factor.

Return type:

numeric

colour.quality.cqs.delta_E_RMS(cqs_data, attribute)[source]

Computes the root-mean-square average for given CQS data.

Parameters:
  • cqs_data (VS_ColourQualityScaleData) – CQS data.
  • attribute (unicode) – Colorimetry data attribute to use to compute the root-mean-square average.
Returns:

Root-mean-square average.

Return type:

numeric

colour.quality.cqs.colour_quality_scales(test_data, reference_data, CCT_factor)[source]

Returns the VS test colour samples rendering scales.

Parameters:
  • test_data (list) – Test data.
  • reference_data (list) – Reference data.
  • CCT_factor (numeric) – Factor penalizing lamps with extremely low correlated colour temperatures.
Returns:

VS Test colour samples colour rendering scales.

Return type:

dict