def test_plot_single_colour_checker(self): """ Tests :func:`colour.plotting.colorimetry.plot_multi_sds` definition. """ sd_1 = SpectralDistribution( { 500: 0.004900, 510: 0.009300, 520: 0.063270, 530: 0.165500, 540: 0.290400, 550: 0.433450, 560: 0.594500 }, name='Custom 1') sd_2 = SpectralDistribution( { 500: 0.323000, 510: 0.503000, 520: 0.710000, 530: 0.862000, 540: 0.954000, 550: 0.994950, 560: 0.995000 }, name='Custom 2') figure, axes = plot_multi_sds([sd_1, sd_2], use_sds_colours=True, normalise_sds_colours=True) self.assertIsInstance(figure, Figure) self.assertIsInstance(axes, Axes)
def test_plot_multi_sds(self): """Test :func:`colour.plotting.colorimetry.plot_multi_sds` definition.""" sd_1 = SpectralDistribution( { 500: 0.004900, 510: 0.009300, 520: 0.063270, 530: 0.165500, 540: 0.290400, 550: 0.433450, 560: 0.594500, }, name="Custom 1", ) sd_2 = SpectralDistribution( { 500: 0.323000, 510: 0.503000, 520: 0.710000, 530: 0.862000, 540: 0.954000, 550: 0.994950, 560: 0.995000, }, name="Custom 2", ) figure, axes = plot_multi_sds( [sd_1, sd_2], plot_kwargs={ "use_sd_colours": True, "normalise_sd_colours": True }, ) self.assertIsInstance(figure, Figure) self.assertIsInstance(axes, Axes) figure, axes = plot_multi_sds( [sd_1, sd_2], plot_kwargs=[{ "use_sd_colours": True, "normalise_sd_colours": True }] * 2, ) self.assertIsInstance(figure, Figure) self.assertIsInstance(axes, Axes)
def test_read(self, sd=None): """ Tests :attr:`colour.io.iestm2714.SpectralDistribution_IESTM2714.read` method. Parameters ---------- sd : SpectralDistribution_IESTM2714, optional Optional *IES TM-27-14* spectral distribution for read tests. """ if sd is None: sd = SpectralDistribution_IESTM2714( os.path.join(RESOURCES_DIRECTORY, 'Fluorescent.spdx')) self.assertTrue(sd.read()) sd_r = SpectralDistribution(FLUORESCENT_FILE_SPECTRAL_DATA) np.testing.assert_array_equal(sd_r.domain, sd.domain) np.testing.assert_almost_equal(sd_r.values, sd.values, decimal=7) for test, read in ((FLUORESCENT_FILE_HEADER, sd.header), (FLUORESCENT_FILE_SPECTRAL_DESCRIPTION, sd)): for key, value in test.items(): for specification in read.mapping.elements: if key == specification.element: self.assertEquals( getattr(read, specification.attribute), value)
def test_plot_single_colour_checker(self): """ Tests :func:`colour.plotting.colorimetry.plot_single_sd` definition. """ sd = SpectralDistribution( { 500: 0.004900, 510: 0.009300, 520: 0.063270, 530: 0.165500, 540: 0.290400, 550: 0.433450, 560: 0.594500 }, name='Custom 1') figure, axes = plot_single_sd( sd, out_of_gamut_clipping=False, modulate_colours_with_sd_amplitude=True, equalize_sd_amplitude=True) self.assertIsInstance(figure, Figure) self.assertIsInstance(axes, Axes)
def test_read(self): """ Test :meth:`colour.SpectralDistribution_UPRTek.read` and :meth:`colour.SpectralDistribution_Sekonic.read` methods. """ if self._sd_factory is None: return sd = self._sd_factory(os.path.join(RESOURCES_DIRECTORY, self._path)).read() sd_r = SpectralDistribution(self._spectral_data) np.testing.assert_array_equal(sd_r.domain, sd.domain) np.testing.assert_almost_equal(sd_r.values, sd.values, decimal=6) for key, value in self._header.items(): for specification in sd.header.mapping.elements: if key == specification.element: if key == "Comments": self.assertDictEqual(json.loads(sd.header.comments), value) else: self.assertEqual( getattr(sd.header, specification.attribute), value)
def bandpass_correction_Stearns1988( sd: SpectralDistribution, ) -> SpectralDistribution: """ Implement spectral bandpass dependence correction on given spectral distribution using *Stearns and Stearns (1988)* method. Parameters ---------- sd Spectral distribution. Returns ------- :class:`colour.SpectralDistribution` Spectral bandpass dependence corrected spectral distribution. References ---------- :cite:`Stearns1988a`, :cite:`Westland2012f` Examples -------- >>> from colour import SpectralDistribution >>> from colour.utilities import numpy_print_options >>> data = { ... 500: 0.0651, ... 520: 0.0705, ... 540: 0.0772, ... 560: 0.0870, ... 580: 0.1128, ... 600: 0.1360 ... } >>> with numpy_print_options(suppress=True): ... bandpass_correction_Stearns1988(SpectralDistribution(data)) ... # doctest: +ELLIPSIS SpectralDistribution([[ 500. , 0.0646518...], [ 520. , 0.0704293...], [ 540. , 0.0769485...], [ 560. , 0.0856928...], [ 580. , 0.1129644...], [ 600. , 0.1379256...]], interpolator=SpragueInterpolator, interpolator_kwargs={}, extrapolator=Extrapolator, extrapolator_kwargs={...}) """ values = np.copy(sd.values) values[0] = (1 + CONSTANT_ALPHA_STEARNS ) * values[0] - CONSTANT_ALPHA_STEARNS * values[1] values[-1] = (1 + CONSTANT_ALPHA_STEARNS ) * values[-1] - CONSTANT_ALPHA_STEARNS * values[-2] for i in range(1, len(values) - 1): values[i] = (-CONSTANT_ALPHA_STEARNS * values[i - 1] + (1 + 2 * CONSTANT_ALPHA_STEARNS) * values[i] - CONSTANT_ALPHA_STEARNS * values[i + 1]) sd.values = values return sd
def sd_Jakob2019( coefficients: ArrayLike, shape: SpectralShape = SPECTRAL_SHAPE_JAKOB2019 ) -> SpectralDistribution: """ Return a spectral distribution following the spectral model given by *Jakob and Hanika (2019)*. Parameters ---------- coefficients Dimensionless coefficients for *Jakob and Hanika (2019)* reflectance spectral model. shape Shape used by the spectral distribution. Returns ------- :class:`colour.SpectralDistribution` *Jakob and Hanika (2019)* spectral distribution. References ---------- :cite:`Jakob2019` Examples -------- >>> from colour.utilities import numpy_print_options >>> with numpy_print_options(suppress=True): ... sd_Jakob2019([-9e-05, 8.5e-02, -20], SpectralShape(400, 700, 20)) ... # doctest: +ELLIPSIS SpectralDistribution([[ 400. , 0.3143046...], [ 420. , 0.4133320...], [ 440. , 0.4880034...], [ 460. , 0.5279562...], [ 480. , 0.5319346...], [ 500. , 0.5 ...], [ 520. , 0.4326202...], [ 540. , 0.3373544...], [ 560. , 0.2353056...], [ 580. , 0.1507665...], [ 600. , 0.0931332...], [ 620. , 0.0577434...], [ 640. , 0.0367011...], [ 660. , 0.0240879...], [ 680. , 0.0163316...], [ 700. , 0.0114118...]], interpolator=SpragueInterpolator, interpolator_kwargs={}, extrapolator=Extrapolator, extrapolator_kwargs={...}) """ c_0, c_1, c_2 = as_float_array(coefficients) wl = shape.range() U = c_0 * wl**2 + c_1 * wl + c_2 R = 1 / 2 + U / (2 * np.sqrt(1 + U**2)) name = f"{coefficients!r} (COEFF) - Jakob (2019)" return SpectralDistribution(R, wl, name=name)
def sd_gaussian_fwhm( peak_wavelength: Floating, fwhm: Floating, shape: SpectralShape = SPECTRAL_SHAPE_DEFAULT, **kwargs: Any, ) -> SpectralDistribution: """ Return a gaussian spectral distribution of given spectral shape at given peak wavelength and full width at half maximum. Parameters ---------- peak_wavelength Wavelength the gaussian spectral distribution will peak at. fwhm Full width at half maximum, i.e. width of the gaussian spectral distribution measured between those points on the *y* axis which are half the maximum amplitude. shape Spectral shape used to create the spectral distribution. Other Parameters ---------------- kwargs {:class:`colour.SpectralDistribution`}, See the documentation of the previously listed class. Returns ------- :class:`colour.SpectralDistribution` Gaussian spectral distribution. Notes ----- - By default, the spectral distribution will use the shape given by :attr:`colour.SPECTRAL_SHAPE_DEFAULT` attribute. Examples -------- >>> sd = sd_gaussian_fwhm(555, 25) >>> sd.shape SpectralShape(360.0, 780.0, 1.0) >>> sd[555] 1.0 >>> sd[530] # doctest: +ELLIPSIS 0.3678794... """ settings = {"name": f"{peak_wavelength}nm - {fwhm} FWHM - Gaussian"} settings.update(kwargs) wavelengths = shape.range() values = np.exp(-(((wavelengths - peak_wavelength) / fwhm)**2)) return SpectralDistribution(values, wavelengths, **settings)
def sd_gaussian_normal( mu: Floating, sigma: Floating, shape: SpectralShape = SPECTRAL_SHAPE_DEFAULT, **kwargs: Any, ) -> SpectralDistribution: """ Return a gaussian spectral distribution of given spectral shape at given mean wavelength :math:`\\mu` and standard deviation :math:`sigma`. Parameters ---------- mu Mean wavelength :math:`\\mu` the gaussian spectral distribution will peak at. sigma Standard deviation :math:`sigma` of the gaussian spectral distribution. shape Spectral shape used to create the spectral distribution. Other Parameters ---------------- kwargs {:class:`colour.SpectralDistribution`}, See the documentation of the previously listed class. Returns ------- :class:`colour.SpectralDistribution` Gaussian spectral distribution. Notes ----- - By default, the spectral distribution will use the shape given by :attr:`colour.SPECTRAL_SHAPE_DEFAULT` attribute. Examples -------- >>> sd = sd_gaussian_normal(555, 25) >>> sd.shape SpectralShape(360.0, 780.0, 1.0) >>> sd[555] # doctest: +ELLIPSIS 1.0000000... >>> sd[530] # doctest: +ELLIPSIS 0.6065306... """ settings = {"name": f"{mu}nm - {sigma} Sigma - Gaussian"} settings.update(kwargs) wavelengths = shape.range() values = np.exp(-((wavelengths - mu)**2) / (2 * sigma**2)) return SpectralDistribution(values, wavelengths, **settings)
def test_bandpass_correction_Stearns1988(self): """ Tests :func:`colour.colorimetry.correction.\ bandpass_correction_Stearns1988` definition. """ sd = SpectralDistribution(dict(zip(range(len(SD_DATA)), SD_DATA))) np.testing.assert_almost_equal( bandpass_correction_Stearns1988(sd).values, BANDPASS_CORRECTED_STEARNS_SD_DATA)
def test_read_sds_from_csv_file(self): """Test :func:`colour.io.tabular.read_sds_from_csv_file` definition.""" colour_checker_n_ohta = os.path.join(RESOURCES_DIRECTORY, "colorchecker_n_ohta.csv") sds = read_sds_from_csv_file(colour_checker_n_ohta) for sd in sds.values(): self.assertIsInstance(sd, SpectralDistribution) self.assertEqual( sds["1"], SpectralDistribution(COLOURCHECKER_N_OHTA_1, name="1"))
def test_read_sds_from_xrite_file(self): """Test :func:`colour.io.xrite.read_sds_from_xrite_file` definition.""" colour_checker_xrite = os.path.join( RESOURCES_DIRECTORY, "X-Rite_Digital_Colour_Checker.txt") sds = read_sds_from_xrite_file(colour_checker_xrite) for sd in sds.values(): self.assertIsInstance(sd, SpectralDistribution) self.assertEqual( sds["X1"], SpectralDistribution(COLOURCHECKER_XRITE_1, name="X1"))
def test_spectral_similarity_index(self): """ Tests :func:`colour.quality.ssi.spectral_similarity_index` definition. """ self.assertEqual( spectral_similarity_index(SDS_ILLUMINANTS['C'], SDS_ILLUMINANTS['D65']), 94.0) self.assertEqual( spectral_similarity_index(SpectralDistribution(DATA_HMI), SDS_ILLUMINANTS['D50']), 72.0)
def load_d65_spd_1nmdata(interval): """ CIE S 014-2 に記載の D65 の SPD をLoadする。 """ base_dir = os.path.dirname(os.path.abspath(__file__)) cie_file = base_dir + "./data/d65_CIE_S_014-2.csv" cie = np.loadtxt(cie_file, delimiter=',') m_data = _make_multispectral_format_data( cie[::interval, 0], cie[::interval, 2]) d65_spd = SpectralDistribution(m_data) return d65_spd
def sd_constant(k: Floating, shape: SpectralShape = SPECTRAL_SHAPE_DEFAULT, **kwargs: Any) -> SpectralDistribution: """ Return a spectral distribution of given spectral shape filled with constant :math:`k` values. Parameters ---------- k Constant :math:`k` to fill the spectral distribution with. shape Spectral shape used to create the spectral distribution. Other Parameters ---------------- kwargs {:class:`colour.SpectralDistribution`}, See the documentation of the previously listed class. Returns ------- :class:`colour.SpectralDistribution` Constant :math:`k` filled spectral distribution. Notes ----- - By default, the spectral distribution will use the shape given by :attr:`colour.SPECTRAL_SHAPE_DEFAULT` attribute. Examples -------- >>> sd = sd_constant(100) >>> sd.shape SpectralShape(360.0, 780.0, 1.0) >>> sd[400] 100.0 """ settings = {"name": f"{k} Constant"} settings.update(kwargs) wavelengths = shape.range() values = full(len(wavelengths), k) return SpectralDistribution(values, wavelengths, **settings)
def sd_gaussian_fwhm(peak_wavelength, fwhm, shape=DEFAULT_SPECTRAL_SHAPE): """ Returns a gaussian spectral distribution of given spectral shape at given peak wavelength and full width at half maximum. Parameters ---------- peak_wavelength : numeric Wavelength the gaussian spectral distribution will peak at. fwhm : numeric Full width at half maximum, i.e. width of the gaussian spectral distribution measured between those points on the *y* axis which are half the maximum amplitude. shape : SpectralShape, optional Spectral shape used to create the spectral distribution. Returns ------- SpectralDistribution Gaussian spectral distribution. Notes ----- - By default, the spectral distribution will use the shape given by :attr:`colour.DEFAULT_SPECTRAL_SHAPE` attribute. Examples -------- >>> sd = sd_gaussian_fwhm(555, 25) >>> sd.shape SpectralShape(360.0, 780.0, 1.0) >>> sd[555] 1.0 >>> sd[530] # doctest: +ELLIPSIS 0.3678794... """ wavelengths = shape.range() values = np.exp(-((wavelengths - peak_wavelength) / fwhm)**2) name = '{0}nm - {1} FWHM - Gaussian'.format(peak_wavelength, fwhm) return SpectralDistribution(values, wavelengths, name=name)
def sd_gaussian_normal(mu, sigma, shape=DEFAULT_SPECTRAL_SHAPE): """ Returns a gaussian spectral distribution of given spectral shape at given mean wavelength :math:`\\mu` and standard deviation :math:`sigma`. Parameters ---------- mu : numeric Mean wavelength :math:`\\mu` the gaussian spectral distribution will peak at. sigma : numeric Standard deviation :math:`sigma` of the gaussian spectral distribution. shape : SpectralShape, optional Spectral shape used to create the spectral distribution. Returns ------- SpectralDistribution Gaussian spectral distribution. Notes ----- - By default, the spectral distribution will use the shape given by :attr:`colour.DEFAULT_SPECTRAL_SHAPE` attribute. Examples -------- >>> sd = sd_gaussian_normal(555, 25) >>> sd.shape SpectralShape(360.0, 780.0, 1.0) >>> sd[555] # doctest: +ELLIPSIS 1.0000000... >>> sd[530] # doctest: +ELLIPSIS 0.6065306... """ wavelengths = shape.range() values = np.exp(-(wavelengths - mu)**2 / (2 * sigma**2.)) name = '{0}nm - {1} Sigma - Gaussian'.format(mu, sigma) return SpectralDistribution(values, wavelengths, name=name)
def test_colour_rendering_index(self): """ Tests :func:`colour.quality.cri.colour_rendering_index` definition. """ self.assertAlmostEqual( colour_rendering_index(ILLUMINANTS_SDS['FL2']), 64.151520202968015, places=7) self.assertAlmostEqual( colour_rendering_index(ILLUMINANTS_SDS['A']), 99.996732643006169, places=7) self.assertAlmostEqual( colour_rendering_index(SpectralDistribution(SAMPLE_SD_DATA)), 70.813839034481575, places=7)
def sd_constant(k, shape=SPECTRAL_SHAPE_DEFAULT, dtype=None): """ Returns a spectral distribution of given spectral shape filled with constant :math:`k` values. Parameters ---------- k : numeric Constant :math:`k` to fill the spectral distribution with. shape : SpectralShape, optional Spectral shape used to create the spectral distribution. dtype : type Data type used for the spectral distribution. Returns ------- SpectralDistribution Constant :math:`k` filled spectral distribution. Notes ----- - By default, the spectral distribution will use the shape given by :attr:`colour.SPECTRAL_SHAPE_DEFAULT` attribute. Examples -------- >>> sd = sd_constant(100) >>> sd.shape SpectralShape(360.0, 780.0, 1.0) >>> sd[400] 100.0 """ if dtype is None: dtype = DEFAULT_FLOAT_DTYPE wavelengths = shape.range(dtype) values = full(len(wavelengths), k, dtype) name = '{0} Constant'.format(k) return SpectralDistribution(values, wavelengths, name=name, dtype=dtype)
def test_read(self, sd: Optional[SpectralDistribution] = None): """ Test :meth:`colour.io.tm2714.SpectralDistribution_IESTM2714.read` method. Parameters ---------- sd Optional *IES TM-27-14* spectral distribution for read tests. """ sd = cast( SpectralDistribution_IESTM2714, optional( sd, SpectralDistribution_IESTM2714( os.path.join(RESOURCES_DIRECTORY, "Fluorescent.spdx")).read(), ), ) sd_r = SpectralDistribution(FLUORESCENT_FILE_SPECTRAL_DATA) np.testing.assert_array_equal(sd_r.domain, sd.domain) np.testing.assert_almost_equal(sd_r.values, sd.values, decimal=7) test_read: List[Tuple[Dict, Union[Header_IESTM2714, SpectralDistribution_IESTM2714]]] = [ (FLUORESCENT_FILE_HEADER, sd.header), (FLUORESCENT_FILE_SPECTRAL_DESCRIPTION, sd), ] for test, read in test_read: for key, value in test.items(): for specification in read.mapping.elements: if key == specification.element: self.assertEqual( getattr(read, specification.attribute), value)
def generate_documentation_plots(output_directory): """ Generates documentation plots. Parameters ---------- output_directory : unicode Output directory. """ filter_warnings() colour_style() np.random.seed(0) # ************************************************************************* # "README.rst" # ************************************************************************* filename = os.path.join(output_directory, 'Examples_Colour_Automatic_Conversion_Graph.png') plot_automatic_colour_conversion_graph(filename) arguments = { 'tight_layout': True, 'transparent_background': True, 'filename': os.path.join(output_directory, 'Examples_Plotting_Visible_Spectrum.png') } plt.close( plot_visible_spectrum('CIE 1931 2 Degree Standard Observer', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Illuminant_F1_SD.png') plt.close(plot_single_illuminant_sd('FL1', **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Examples_Plotting_Blackbodies.png') blackbody_sds = [ sd_blackbody(i, SpectralShape(0, 10000, 10)) for i in range(1000, 15000, 1000) ] plt.close( plot_multi_sds(blackbody_sds, y_label='W / (sr m$^2$) / m', use_sds_colours=True, normalise_sds_colours=True, legend_location='upper right', bounding_box=(0, 1250, 0, 2.5e15), **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Cone_Fundamentals.png') plt.close( plot_single_cmfs('Stockman & Sharpe 2 Degree Cone Fundamentals', y_label='Sensitivity', bounding_box=(390, 870, 0, 1.1), **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Luminous_Efficiency.png') plt.close( plot_multi_sds((sd_mesopic_luminous_efficiency_function(0.2), PHOTOPIC_LEFS['CIE 1924 Photopic Standard Observer'], SCOTOPIC_LEFS['CIE 1951 Scotopic Standard Observer']), y_label='Luminous Efficiency', legend_location='upper right', y_tighten=True, margins=(0, 0, 0, .1), **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_BabelColor_Average.png') plt.close( plot_multi_sds(COLOURCHECKERS_SDS['BabelColor Average'].values(), use_sds_colours=True, title=('BabelColor Average - ' 'Spectral Distributions'), **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_ColorChecker_2005.png') plt.close( plot_single_colour_checker('ColorChecker 2005', text_parameters={'visible': False}, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Chromaticities_Prediction.png') plt.close( plot_corresponding_chromaticities_prediction(2, 'Von Kries', 'Bianco', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_CCT_CIE_1960_UCS_Chromaticity_Diagram.png') plt.close( plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( ['A', 'B', 'C'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Examples_Plotting_Chromaticities_CIE_1931_Chromaticity_Diagram.png') RGB = np.random.random((32, 32, 3)) plt.close( plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( RGB, 'ITU-R BT.709', colourspaces=['ACEScg', 'S-Gamut'], show_pointer_gamut=True, **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Examples_Plotting_CRI.png') plt.close( plot_single_sd_colour_rendering_index_bars(ILLUMINANTS_SDS['FL2'], **arguments)[0]) # ************************************************************************* # Documentation # ************************************************************************* arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_CVD_Simulation_Machado2009.png') plt.close(plot_cvd_simulation_Machado2009(RGB, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Colour_Checker.png') plt.close(plot_single_colour_checker('ColorChecker 2005', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Colour_Checkers.png') plt.close( plot_multi_colour_checkers(['ColorChecker 1976', 'ColorChecker 2005'], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Single_SD.png') data = { 500: 0.0651, 520: 0.0705, 540: 0.0772, 560: 0.0870, 580: 0.1128, 600: 0.1360 } sd = SpectralDistribution(data, name='Custom') plt.close(plot_single_sd(sd, **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Multi_SDS.png') data_1 = { 500: 0.004900, 510: 0.009300, 520: 0.063270, 530: 0.165500, 540: 0.290400, 550: 0.433450, 560: 0.594500 } data_2 = { 500: 0.323000, 510: 0.503000, 520: 0.710000, 530: 0.862000, 540: 0.954000, 550: 0.994950, 560: 0.995000 } spd1 = SpectralDistribution(data_1, name='Custom 1') spd2 = SpectralDistribution(data_2, name='Custom 2') plt.close(plot_multi_sds([spd1, spd2], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Single_CMFS.png') plt.close( plot_single_cmfs('CIE 1931 2 Degree Standard Observer', **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Multi_CMFS.png') cmfs = ('CIE 1931 2 Degree Standard Observer', 'CIE 1964 10 Degree Standard Observer') plt.close(plot_multi_cmfs(cmfs, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Illuminant_SD.png') plt.close(plot_single_illuminant_sd('A', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Illuminant_SDS.png') plt.close(plot_multi_illuminant_sds(['A', 'B', 'C'], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Visible_Spectrum.png') plt.close(plot_visible_spectrum(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Lightness_Function.png') plt.close(plot_single_lightness_function('CIE 1976', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Lightness_Functions.png') plt.close( plot_multi_lightness_functions(['CIE 1976', 'Wyszecki 1963'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Luminance_Function.png') plt.close(plot_single_luminance_function('CIE 1976', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Luminance_Functions.png') plt.close( plot_multi_luminance_functions(['CIE 1976', 'Newhall 1943'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Blackbody_Spectral_Radiance.png') plt.close( plot_blackbody_spectral_radiance(3500, blackbody='VY Canis Major', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Blackbody_Colours.png') plt.close( plot_blackbody_colours(SpectralShape(150, 12500, 50), **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Colour_Swatch.png') RGB = ColourSwatch(RGB=(0.45620519, 0.03081071, 0.04091952)) plt.close(plot_single_colour_swatch(RGB, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Colour_Swatches.png') RGB_1 = ColourSwatch(RGB=(0.45293517, 0.31732158, 0.26414773)) RGB_2 = ColourSwatch(RGB=(0.77875824, 0.57726450, 0.50453169)) plt.close(plot_multi_colour_swatches([RGB_1, RGB_2], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Single_Function.png') plt.close(plot_single_function(lambda x: x**(1 / 2.2), **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Multi_Functions.png') functions = { 'Gamma 2.2': lambda x: x**(1 / 2.2), 'Gamma 2.4': lambda x: x**(1 / 2.4), 'Gamma 2.6': lambda x: x**(1 / 2.6), } plt.close(plot_multi_functions(functions, **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Image.png') path = os.path.join(output_directory, 'Logo_Medium_001.png') plt.close(plot_image(read_image(str(path)), **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Corresponding_Chromaticities_Prediction.png') plt.close( plot_corresponding_chromaticities_prediction(1, 'Von Kries', 'CAT02', **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Spectral_Locus.png') plt.close( plot_spectral_locus(spectral_locus_colours='RGB', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram_Colours.png') plt.close(plot_chromaticity_diagram_colours(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram.png') plt.close(plot_chromaticity_diagram(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram_CIE1931.png') plt.close(plot_chromaticity_diagram_CIE1931(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram_CIE1960UCS.png') plt.close(plot_chromaticity_diagram_CIE1960UCS(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Chromaticity_Diagram_CIE1976UCS.png') plt.close(plot_chromaticity_diagram_CIE1976UCS(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_SDS_In_Chromaticity_Diagram.png') A = ILLUMINANTS_SDS['A'] D65 = ILLUMINANTS_SDS['D65'] plt.close(plot_sds_in_chromaticity_diagram([A, D65], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_SDS_In_Chromaticity_Diagram_CIE1931.png') plt.close( plot_sds_in_chromaticity_diagram_CIE1931([A, D65], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_SDS_In_Chromaticity_Diagram_CIE1960UCS.png') plt.close( plot_sds_in_chromaticity_diagram_CIE1960UCS([A, D65], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_SDS_In_Chromaticity_Diagram_CIE1976UCS.png') plt.close( plot_sds_in_chromaticity_diagram_CIE1976UCS([A, D65], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Pointer_Gamut.png') plt.close(plot_pointer_gamut(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram.png') plt.close( plot_RGB_colourspaces_in_chromaticity_diagram( ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_In_Chromaticity_Diagram_CIE1931.png') plt.close( plot_RGB_colourspaces_in_chromaticity_diagram_CIE1931( ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_In_' 'Chromaticity_Diagram_CIE1960UCS.png') plt.close( plot_RGB_colourspaces_in_chromaticity_diagram_CIE1960UCS( ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_In_' 'Chromaticity_Diagram_CIE1976UCS.png') plt.close( plot_RGB_colourspaces_in_chromaticity_diagram_CIE1976UCS( ['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Chromaticities_In_' 'Chromaticity_Diagram.png') RGB = np.random.random((128, 128, 3)) plt.close( plot_RGB_chromaticities_in_chromaticity_diagram( RGB, 'ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Chromaticities_In_' 'Chromaticity_Diagram_CIE1931.png') plt.close( plot_RGB_chromaticities_in_chromaticity_diagram_CIE1931( RGB, 'ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Chromaticities_In_' 'Chromaticity_Diagram_CIE1960UCS.png') plt.close( plot_RGB_chromaticities_in_chromaticity_diagram_CIE1960UCS( RGB, 'ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Chromaticities_In_' 'Chromaticity_Diagram_CIE1976UCS.png') plt.close( plot_RGB_chromaticities_in_chromaticity_diagram_CIE1976UCS( RGB, 'ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Ellipses_MacAdam1942_In_Chromaticity_Diagram.png') plt.close( plot_ellipses_MacAdam1942_in_chromaticity_diagram(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Ellipses_MacAdam1942_In_' 'Chromaticity_Diagram_CIE1931.png') plt.close( plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1931( **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Ellipses_MacAdam1942_In_' 'Chromaticity_Diagram_CIE1960UCS.png') plt.close( plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1960UCS( **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Ellipses_MacAdam1942_In_' 'Chromaticity_Diagram_CIE1976UCS.png') plt.close( plot_ellipses_MacAdam1942_in_chromaticity_diagram_CIE1976UCS( **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Single_CCTF.png') plt.close(plot_single_cctf('ITU-R BT.709', **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Multi_CCTFs.png') plt.close(plot_multi_cctfs(['ITU-R BT.709', 'sRGB'], **arguments)[0]) data = np.array([ [ None, np.array([0.95010000, 1.00000000, 1.08810000]), np.array([0.40920000, 0.28120000, 0.30600000]), np.array([ [0.02495100, 0.01908600, 0.02032900], [0.10944300, 0.06235900, 0.06788100], [0.27186500, 0.18418700, 0.19565300], [0.48898900, 0.40749400, 0.44854600], ]), None, ], [ None, np.array([0.95010000, 1.00000000, 1.08810000]), np.array([0.30760000, 0.48280000, 0.42770000]), np.array([ [0.02108000, 0.02989100, 0.02790400], [0.06194700, 0.11251000, 0.09334400], [0.15255800, 0.28123300, 0.23234900], [0.34157700, 0.56681300, 0.47035300], ]), None, ], [ None, np.array([0.95010000, 1.00000000, 1.08810000]), np.array([0.39530000, 0.28120000, 0.18450000]), np.array([ [0.02436400, 0.01908600, 0.01468800], [0.10331200, 0.06235900, 0.02854600], [0.26311900, 0.18418700, 0.12109700], [0.43158700, 0.40749400, 0.39008600], ]), None, ], [ None, np.array([0.95010000, 1.00000000, 1.08810000]), np.array([0.20510000, 0.18420000, 0.57130000]), np.array([ [0.03039800, 0.02989100, 0.06123300], [0.08870000, 0.08498400, 0.21843500], [0.18405800, 0.18418700, 0.40111400], [0.32550100, 0.34047200, 0.50296900], [0.53826100, 0.56681300, 0.80010400], ]), None, ], [ None, np.array([0.95010000, 1.00000000, 1.08810000]), np.array([0.35770000, 0.28120000, 0.11250000]), np.array([ [0.03678100, 0.02989100, 0.01481100], [0.17127700, 0.11251000, 0.01229900], [0.30080900, 0.28123300, 0.21229800], [0.52976000, 0.40749400, 0.11720000], ]), None, ], ]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Constant_Hue_Loci.png') plt.close(plot_constant_hue_loci(data, 'IPT', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_Munsell_Value_Function.png') plt.close(plot_single_munsell_value_function('ASTM D1535', **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_Munsell_Value_Functions.png') plt.close( plot_multi_munsell_value_functions(['ASTM D1535', 'McCamy 1987'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_SD_Rayleigh_Scattering.png') plt.close(plot_single_sd_rayleigh_scattering(**arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_The_Blue_Sky.png') plt.close(plot_the_blue_sky(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Colour_Quality_Bars.png') illuminant = ILLUMINANTS_SDS['FL2'] light_source = LIGHT_SOURCES_SDS['Kinoton 75P'] light_source = light_source.copy().align(SpectralShape(360, 830, 1)) cqs_i = colour_quality_scale(illuminant, additional_data=True) cqs_l = colour_quality_scale(light_source, additional_data=True) plt.close(plot_colour_quality_bars([cqs_i, cqs_l], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_SD_Colour_Rendering_Index_Bars.png') illuminant = ILLUMINANTS_SDS['FL2'] plt.close( plot_single_sd_colour_rendering_index_bars(illuminant, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_SDS_Colour_Rendering_Indexes_Bars.png') light_source = LIGHT_SOURCES_SDS['Kinoton 75P'] plt.close( plot_multi_sds_colour_rendering_indexes_bars( [illuminant, light_source], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Single_SD_Colour_Quality_Scale_Bars.png') illuminant = ILLUMINANTS_SDS['FL2'] plt.close( plot_single_sd_colour_quality_scale_bars(illuminant, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Multi_SDS_Colour_Quality_Scales_Bars.png') light_source = LIGHT_SOURCES_SDS['Kinoton 75P'] plt.close( plot_multi_sds_colour_quality_scales_bars([illuminant, light_source], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_Planckian_Locus.png') plt.close(plot_planckian_locus(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Planckian_Locus_CIE1931.png') plt.close(plot_planckian_locus_CIE1931(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Planckian_Locus_CIE1960UCS.png') plt.close(plot_planckian_locus_CIE1960UCS(**arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram.png') plt.close( plot_planckian_locus_in_chromaticity_diagram(['A', 'B', 'C'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1931.png') plt.close( plot_planckian_locus_in_chromaticity_diagram_CIE1931(['A', 'B', 'C'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_Planckian_Locus_In_Chromaticity_Diagram_CIE1960UCS.png') plt.close( plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS( ['A', 'B', 'C'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_Gamuts.png') plt.close( plot_RGB_colourspaces_gamuts(['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Plotting_Plot_RGB_Colourspaces_Gamuts.png') plt.close( plot_RGB_colourspaces_gamuts(['ITU-R BT.709', 'ACEScg', 'S-Gamut'], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Plotting_Plot_RGB_Scatter.png') plt.close(plot_RGB_scatter(RGB, 'ITU-R BT.709', **arguments)[0]) filename = os.path.join( output_directory, 'Plotting_Plot_Colour_Automatic_Conversion_Graph.png') plot_automatic_colour_conversion_graph(filename) # ************************************************************************* # "tutorial.rst" # ************************************************************************* arguments['filename'] = os.path.join(output_directory, 'Tutorial_Visible_Spectrum.png') plt.close(plot_visible_spectrum(**arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_Sample_SD.png') sample_sd_data = { 380: 0.048, 385: 0.051, 390: 0.055, 395: 0.060, 400: 0.065, 405: 0.068, 410: 0.068, 415: 0.067, 420: 0.064, 425: 0.062, 430: 0.059, 435: 0.057, 440: 0.055, 445: 0.054, 450: 0.053, 455: 0.053, 460: 0.052, 465: 0.052, 470: 0.052, 475: 0.053, 480: 0.054, 485: 0.055, 490: 0.057, 495: 0.059, 500: 0.061, 505: 0.062, 510: 0.065, 515: 0.067, 520: 0.070, 525: 0.072, 530: 0.074, 535: 0.075, 540: 0.076, 545: 0.078, 550: 0.079, 555: 0.082, 560: 0.087, 565: 0.092, 570: 0.100, 575: 0.107, 580: 0.115, 585: 0.122, 590: 0.129, 595: 0.134, 600: 0.138, 605: 0.142, 610: 0.146, 615: 0.150, 620: 0.154, 625: 0.158, 630: 0.163, 635: 0.167, 640: 0.173, 645: 0.180, 650: 0.188, 655: 0.196, 660: 0.204, 665: 0.213, 670: 0.222, 675: 0.231, 680: 0.242, 685: 0.251, 690: 0.261, 695: 0.271, 700: 0.282, 705: 0.294, 710: 0.305, 715: 0.318, 720: 0.334, 725: 0.354, 730: 0.372, 735: 0.392, 740: 0.409, 745: 0.420, 750: 0.436, 755: 0.450, 760: 0.462, 765: 0.465, 770: 0.448, 775: 0.432, 780: 0.421 } sd = SpectralDistribution(sample_sd_data, name='Sample') plt.close(plot_single_sd(sd, **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_SD_Interpolation.png') sd_copy = sd.copy() sd_copy.interpolate(SpectralShape(400, 770, 1)) plt.close( plot_multi_sds([sd, sd_copy], bounding_box=[730, 780, 0.25, 0.5], **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_Sample_Swatch.png') sd = SpectralDistribution(sample_sd_data) cmfs = STANDARD_OBSERVERS_CMFS['CIE 1931 2 Degree Standard Observer'] illuminant = ILLUMINANTS_SDS['D65'] with domain_range_scale('1'): XYZ = sd_to_XYZ(sd, cmfs, illuminant) RGB = XYZ_to_sRGB(XYZ) plt.close( plot_single_colour_swatch(ColourSwatch('Sample', RGB), text_parameters={'size': 'x-large'}, **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_Neutral5.png') patch_name = 'neutral 5 (.70 D)' patch_sd = COLOURCHECKERS_SDS['ColorChecker N Ohta'][patch_name] with domain_range_scale('1'): XYZ = sd_to_XYZ(patch_sd, cmfs, illuminant) RGB = XYZ_to_sRGB(XYZ) plt.close( plot_single_colour_swatch(ColourSwatch(patch_name.title(), RGB), text_parameters={'size': 'x-large'}, **arguments)[0]) arguments['filename'] = os.path.join(output_directory, 'Tutorial_Colour_Checker.png') plt.close( plot_single_colour_checker(colour_checker='ColorChecker 2005', text_parameters={'visible': False}, **arguments)[0]) arguments['filename'] = os.path.join( output_directory, 'Tutorial_CIE_1931_Chromaticity_Diagram.png') xy = XYZ_to_xy(XYZ) plot_chromaticity_diagram_CIE1931(standalone=False) x, y = xy plt.plot(x, y, 'o-', color='white') # Annotating the plot. plt.annotate(patch_sd.name.title(), xy=xy, xytext=(-50, 30), textcoords='offset points', arrowprops=dict(arrowstyle='->', connectionstyle='arc3, rad=-0.2')) plt.close( render(standalone=True, limits=(-0.1, 0.9, -0.1, 0.9), x_tighten=True, y_tighten=True, **arguments)[0]) # ************************************************************************* # "basics.rst" # ************************************************************************* arguments['filename'] = os.path.join(output_directory, 'Basics_Logo_Small_001_CIE_XYZ.png') RGB = read_image(os.path.join(output_directory, 'Logo_Small_001.png'))[..., 0:3] XYZ = sRGB_to_XYZ(RGB) plt.close( plot_image(XYZ, text_parameters={'text': 'sRGB to XYZ'}, **arguments)[0])
def sd_CIE_standard_illuminant_A(shape=DEFAULT_SPECTRAL_SHAPE): """ *CIE Standard Illuminant A* is intended to represent typical, domestic, tungsten-filament lighting. Its spectral distribution is that of a Planckian radiator at a temperature of approximately 2856 K. *CIE Standard Illuminant A* should be used in all applications of colorimetry involving the use of incandescent lighting, unless there are specific reasons for using a different illuminant. Parameters ---------- shape : SpectralShape, optional Spectral shape used to create the spectral distribution of the *CIE Standard Illuminant A*. Returns ------- SpectralDistribution *CIE Standard Illuminant A*. spectral distribution. References ---------- :cite:`CIETC1-482004n` Examples -------- >>> from colour import SpectralShape >>> sd_CIE_standard_illuminant_A(SpectralShape(400, 700, 10)) ... # doctest: +ELLIPSIS SpectralDistribution([[ 400. , 14.7080384...], [ 410. , 17.6752521...], [ 420. , 20.9949572...], [ 430. , 24.6709226...], [ 440. , 28.7027304...], [ 450. , 33.0858929...], [ 460. , 37.8120566...], [ 470. , 42.8692762...], [ 480. , 48.2423431...], [ 490. , 53.9131532...], [ 500. , 59.8610989...], [ 510. , 66.0634727...], [ 520. , 72.4958719...], [ 530. , 79.1325945...], [ 540. , 85.9470183...], [ 550. , 92.9119589...], [ 560. , 100. ...], [ 570. , 107.1837952...], [ 580. , 114.4363383...], [ 590. , 121.7312009...], [ 600. , 129.0427389...], [ 610. , 136.3462674...], [ 620. , 143.6182057...], [ 630. , 150.8361944...], [ 640. , 157.9791857...], [ 650. , 165.0275098...], [ 660. , 171.9629200...], [ 670. , 178.7686175...], [ 680. , 185.4292591...], [ 690. , 191.9309499...], [ 700. , 198.2612232...]], interpolator=SpragueInterpolator, interpolator_args={}, extrapolator=Extrapolator, extrapolator_args={...}) """ wavelengths = shape.range() values = (100 * (560 / wavelengths)**5 * (((np.exp( (1.435 * 10**7) / (2848 * 560)) - 1) / (np.exp( (1.435 * 10**7) / (2848 * wavelengths)) - 1)))) return SpectralDistribution(values, wavelengths, name='CIE Standard Illuminant A')
def sd_CIE_illuminant_D_series(xy, M1_M2_rounding=True): """ Returns the spectral distribution of given *CIE Illuminant D Series* using given *CIE xy* chromaticity coordinates. Parameters ---------- xy : array_like *CIE xy* chromaticity coordinates. M1_M2_rounding : bool, optional Whether to round :math:`M1` and :math:`M2` variables to 3 decimal places in order to yield the internationally agreed values. Returns ------- SpectralDistribution *CIE Illuminant D Series* spectral distribution. Notes ----- - The nominal *CIE xy* chromaticity coordinates which have been computed with :func:`colour.temperature.CCT_to_xy_CIE_D` must be given according to *CIE 015:2004* recommendation and thus multiplied by 1.4388 / 1.4380. - :math:`M1` and :math:`M2` variables are rounded to 3 decimal places according to *CIE 015:2004* recommendation. References ---------- :cite:`CIETC1-482004`, :cite:`Wyszecki2000z` Examples -------- >>> from colour.utilities import numpy_print_options >>> from colour.temperature import CCT_to_xy_CIE_D >>> CCT_D65 = 6500 * 1.4388 / 1.4380 >>> xy = CCT_to_xy_CIE_D(CCT_D65) >>> with numpy_print_options(suppress=True): ... sd_CIE_illuminant_D_series(xy) # doctest: +ELLIPSIS SpectralDistribution([[ 300. , 0.0341...], [ 305. , 1.6643...], [ 310. , 3.2945...], [ 315. , 11.7652...], [ 320. , 20.236 ...], [ 325. , 28.6447...], [ 330. , 37.0535...], [ 335. , 38.5011...], [ 340. , 39.9488...], [ 345. , 42.4302...], [ 350. , 44.9117...], [ 355. , 45.775 ...], [ 360. , 46.6383...], [ 365. , 49.3637...], [ 370. , 52.0891...], [ 375. , 51.0323...], [ 380. , 49.9755...], [ 385. , 52.3118...], [ 390. , 54.6482...], [ 395. , 68.7015...], [ 400. , 82.7549...], [ 405. , 87.1204...], [ 410. , 91.486 ...], [ 415. , 92.4589...], [ 420. , 93.4318...], [ 425. , 90.0570...], [ 430. , 86.6823...], [ 435. , 95.7736...], [ 440. , 104.8649...], [ 445. , 110.9362...], [ 450. , 117.0076...], [ 455. , 117.4099...], [ 460. , 117.8122...], [ 465. , 116.3365...], [ 470. , 114.8609...], [ 475. , 115.3919...], [ 480. , 115.9229...], [ 485. , 112.3668...], [ 490. , 108.8107...], [ 495. , 109.0826...], [ 500. , 109.3545...], [ 505. , 108.5781...], [ 510. , 107.8017...], [ 515. , 106.2957...], [ 520. , 104.7898...], [ 525. , 106.2396...], [ 530. , 107.6895...], [ 535. , 106.0475...], [ 540. , 104.4055...], [ 545. , 104.2258...], [ 550. , 104.0462...], [ 555. , 102.0231...], [ 560. , 100. ...], [ 565. , 98.1671...], [ 570. , 96.3342...], [ 575. , 96.0611...], [ 580. , 95.788 ...], [ 585. , 92.2368...], [ 590. , 88.6856...], [ 595. , 89.3459...], [ 600. , 90.0062...], [ 605. , 89.8026...], [ 610. , 89.5991...], [ 615. , 88.6489...], [ 620. , 87.6987...], [ 625. , 85.4936...], [ 630. , 83.2886...], [ 635. , 83.4939...], [ 640. , 83.6992...], [ 645. , 81.863 ...], [ 650. , 80.0268...], [ 655. , 80.1207...], [ 660. , 80.2146...], [ 665. , 81.2462...], [ 670. , 82.2778...], [ 675. , 80.281 ...], [ 680. , 78.2842...], [ 685. , 74.0027...], [ 690. , 69.7213...], [ 695. , 70.6652...], [ 700. , 71.6091...], [ 705. , 72.9790...], [ 710. , 74.349 ...], [ 715. , 67.9765...], [ 720. , 61.604 ...], [ 725. , 65.7448...], [ 730. , 69.8856...], [ 735. , 72.4863...], [ 740. , 75.087 ...], [ 745. , 69.3398...], [ 750. , 63.5927...], [ 755. , 55.0054...], [ 760. , 46.4182...], [ 765. , 56.6118...], [ 770. , 66.8054...], [ 775. , 65.0941...], [ 780. , 63.3828...], [ 785. , 63.8434...], [ 790. , 64.304 ...], [ 795. , 61.8779...], [ 800. , 59.4519...], [ 805. , 55.7054...], [ 810. , 51.959 ...], [ 815. , 54.6998...], [ 820. , 57.4406...], [ 825. , 58.8765...], [ 830. , 60.3125...]], interpolator=SpragueInterpolator, interpolator_args={}, extrapolator=Extrapolator, extrapolator_args={...}) """ x, y = tsplit(xy) M = 0.0241 + 0.2562 * x - 0.7341 * y M1 = (-1.3515 - 1.7703 * x + 5.9114 * y) / M M2 = (0.0300 - 31.4424 * x + 30.0717 * y) / M if M1_M2_rounding: M1 = np.around(M1, 3) M2 = np.around(M2, 3) S0 = D_ILLUMINANTS_S_SDS['S0'] S1 = D_ILLUMINANTS_S_SDS['S1'] S2 = D_ILLUMINANTS_S_SDS['S2'] distribution = S0.values + M1 * S1.values + M2 * S2.values return SpectralDistribution(distribution, S0.wavelengths, name='CIE Illuminant D Series')
SD_SAMPLE: SpectralDistribution = SpectralDistribution({ 340: 0.0000, 345: 0.0000, 350: 0.0000, 355: 0.0000, 360: 0.0000, 365: 0.0000, 370: 0.0000, 375: 0.0000, 380: 0.0000, 385: 0.0000, 390: 0.0000, 395: 0.0000, 400: 0.0641, 405: 0.0650, 410: 0.0654, 415: 0.0652, 420: 0.0645, 425: 0.0629, 430: 0.0605, 435: 0.0581, 440: 0.0562, 445: 0.0551, 450: 0.0543, 455: 0.0539, 460: 0.0537, 465: 0.0538, 470: 0.0541, 475: 0.0547, 480: 0.0559, 485: 0.0578, 490: 0.0603, 495: 0.0629, 500: 0.0651, 505: 0.0667, 510: 0.0680, 515: 0.0691, 520: 0.0705, 525: 0.0720, 530: 0.0736, 535: 0.0753, 540: 0.0772, 545: 0.0791, 550: 0.0809, 555: 0.0833, 560: 0.0870, 565: 0.0924, 570: 0.0990, 575: 0.1061, 580: 0.1128, 585: 0.1190, 590: 0.1251, 595: 0.1308, 600: 0.1360, 605: 0.1403, 610: 0.1439, 615: 0.1473, 620: 0.1511, 625: 0.1550, 630: 0.1590, 635: 0.1634, 640: 0.1688, 645: 0.1753, 650: 0.1828, 655: 0.1909, 660: 0.1996, 665: 0.2088, 670: 0.2187, 675: 0.2291, 680: 0.2397, 685: 0.2505, 690: 0.2618, 695: 0.2733, 700: 0.2852, 705: 0.0000, 710: 0.0000, 715: 0.0000, 720: 0.0000, 725: 0.0000, 730: 0.0000, 735: 0.0000, 740: 0.0000, 745: 0.0000, 750: 0.0000, 755: 0.0000, 760: 0.0000, 765: 0.0000, 770: 0.0000, 775: 0.0000, 780: 0.0000, 785: 0.0000, 790: 0.0000, 795: 0.0000, 800: 0.0000, 805: 0.0000, 810: 0.0000, 815: 0.0000, 820: 0.0000, 825: 0.0000, 830: 0.0000, })
760: 0.6874, 765: 0.6955, 770: 0.7012, 775: 0.6996, 780: 0.7023, 785: 0.7022, 790: 0.7144, 795: 0.7062, 800: 0.7075, 805: 0.7075, 810: 0.7075, 815: 0.7075, 820: 0.7075, 825: 0.7075, 830: 0.7075 } } VS_SDS = CaseInsensitiveMapping( dict((key, SpectralDistribution(value, name=key)) for key, value in VS_SDS_DATA.items())) """ CQS test colour samples spectral distributions. References ---------- :cite:`Ohno2008a` VS_SDS : CaseInsensitiveMapping """
755: 0.339, 760: 0.353, 765: 0.366, 770: 0.379, 775: 0.390, 780: 0.399, 785: 0.408, 790: 0.416, 795: 0.422, 800: 0.428, 805: 0.434, 810: 0.439, 815: 0.444, 820: 0.448, 825: 0.451, 830: 0.454, }, } SDS_TCS: CaseInsensitiveMapping = CaseInsensitiveMapping({ key: SpectralDistribution(value, name=key) for key, value in DATA_TCS.items() }) """ Test colour samples spectral distributions. References ---------- :cite:`Ohno2008a` """
def sd_blackbody(temperature, shape=DEFAULT_SPECTRAL_SHAPE, c1=C1, c2=C2, n=N): """ Returns the spectral distribution of the planckian radiator for given temperature :math:`T[K]`. Parameters ---------- temperature : numeric Temperature :math:`T[K]` in kelvin degrees. shape : SpectralShape, optional Spectral shape used to create the spectral distribution of the planckian radiator. c1 : numeric, optional The official value of :math:`c1` is provided by the Committee on Data for Science and Technology (CODATA) and is :math:`c1=3,741771x10.16\\ W/m_2` *(Mohr and Taylor, 2000)*. c2 : numeric, optional Since :math:`T` is measured on the International Temperature Scale, the value of :math:`c2` used in colorimetry should follow that adopted in the current International Temperature Scale (ITS-90) *(Preston-Thomas, 1990; Mielenz et aI., 1991)*, namely :math:`c2=1,4388x10.2\\ m/K`. n : numeric, optional Medium index of refraction. For dry air at 15C and 101 325 Pa, containing 0,03 percent by volume of carbon dioxide, it is approximately 1,00028 throughout the visible region although *CIE 15:2004* recommends using :math:`n=1`. Returns ------- SpectralDistribution Blackbody spectral distribution. Examples -------- >>> from colour.utilities import numpy_print_options >>> with numpy_print_options(suppress=True): ... sd_blackbody(5000) # doctest: +ELLIPSIS SpectralDistribution([[ 3.60000000e+02, 6.65427827e+12], [ 3.61000000e+02, 6.70960528e+12], [ 3.62000000e+02, 6.76482512e+12], [ 3.63000000e+02, 6.81993308e+12], [ 3.64000000e+02, 6.87492449e+12], [ 3.65000000e+02, 6.92979475e+12], [ 3.66000000e+02, 6.98453932e+12], [ 3.67000000e+02, 7.03915372e+12], [ 3.68000000e+02, 7.09363351e+12], [ 3.69000000e+02, 7.14797433e+12], [ 3.70000000e+02, 7.20217187e+12], [ 3.71000000e+02, 7.25622190e+12], [ 3.72000000e+02, 7.31012021e+12], [ 3.73000000e+02, 7.36386268e+12], [ 3.74000000e+02, 7.41744525e+12], [ 3.75000000e+02, 7.47086391e+12], [ 3.76000000e+02, 7.52411471e+12], [ 3.77000000e+02, 7.57719377e+12], [ 3.78000000e+02, 7.63009726e+12], [ 3.79000000e+02, 7.68282141e+12], [ 3.80000000e+02, 7.73536252e+12], [ 3.81000000e+02, 7.78771695e+12], [ 3.82000000e+02, 7.83988111e+12], [ 3.83000000e+02, 7.89185148e+12], [ 3.84000000e+02, 7.94362458e+12], [ 3.85000000e+02, 7.99519703e+12], [ 3.86000000e+02, 8.04656547e+12], [ 3.87000000e+02, 8.09772662e+12], [ 3.88000000e+02, 8.14867726e+12], [ 3.89000000e+02, 8.19941421e+12], [ 3.90000000e+02, 8.24993438e+12], [ 3.91000000e+02, 8.30023471e+12], [ 3.92000000e+02, 8.35031222e+12], [ 3.93000000e+02, 8.40016398e+12], [ 3.94000000e+02, 8.44978711e+12], [ 3.95000000e+02, 8.49917881e+12], [ 3.96000000e+02, 8.54833632e+12], [ 3.97000000e+02, 8.59725693e+12], [ 3.98000000e+02, 8.64593802e+12], [ 3.99000000e+02, 8.69437700e+12], [ 4.00000000e+02, 8.74257133e+12], [ 4.01000000e+02, 8.79051856e+12], [ 4.02000000e+02, 8.83821626e+12], [ 4.03000000e+02, 8.88566209e+12], [ 4.04000000e+02, 8.93285373e+12], [ 4.05000000e+02, 8.97978893e+12], [ 4.06000000e+02, 9.02646551e+12], [ 4.07000000e+02, 9.07288133e+12], [ 4.08000000e+02, 9.11903431e+12], [ 4.09000000e+02, 9.16492240e+12], [ 4.10000000e+02, 9.21054364e+12], [ 4.11000000e+02, 9.25589609e+12], [ 4.12000000e+02, 9.30097789e+12], [ 4.13000000e+02, 9.34578722e+12], [ 4.14000000e+02, 9.39032230e+12], [ 4.15000000e+02, 9.43458143e+12], [ 4.16000000e+02, 9.47856292e+12], [ 4.17000000e+02, 9.52226517e+12], [ 4.18000000e+02, 9.56568661e+12], [ 4.19000000e+02, 9.60882571e+12], [ 4.20000000e+02, 9.65168102e+12], [ 4.21000000e+02, 9.69425111e+12], [ 4.22000000e+02, 9.73653461e+12], [ 4.23000000e+02, 9.77853020e+12], [ 4.24000000e+02, 9.82023659e+12], [ 4.25000000e+02, 9.86165257e+12], [ 4.26000000e+02, 9.90277693e+12], [ 4.27000000e+02, 9.94360856e+12], [ 4.28000000e+02, 9.98414634e+12], [ 4.29000000e+02, 1.00243892e+13], [ 4.30000000e+02, 1.00643363e+13], [ 4.31000000e+02, 1.01039864e+13], [ 4.32000000e+02, 1.01433388e+13], [ 4.33000000e+02, 1.01823926e+13], [ 4.34000000e+02, 1.02211468e+13], [ 4.35000000e+02, 1.02596009e+13], [ 4.36000000e+02, 1.02977539e+13], [ 4.37000000e+02, 1.03356052e+13], [ 4.38000000e+02, 1.03731541e+13], [ 4.39000000e+02, 1.04104000e+13], [ 4.40000000e+02, 1.04473423e+13], [ 4.41000000e+02, 1.04839805e+13], [ 4.42000000e+02, 1.05203140e+13], [ 4.43000000e+02, 1.05563424e+13], [ 4.44000000e+02, 1.05920652e+13], [ 4.45000000e+02, 1.06274821e+13], [ 4.46000000e+02, 1.06625927e+13], [ 4.47000000e+02, 1.06973967e+13], [ 4.48000000e+02, 1.07318937e+13], [ 4.49000000e+02, 1.07660835e+13], [ 4.50000000e+02, 1.07999660e+13], [ 4.51000000e+02, 1.08335408e+13], [ 4.52000000e+02, 1.08668080e+13], [ 4.53000000e+02, 1.08997673e+13], [ 4.54000000e+02, 1.09324187e+13], [ 4.55000000e+02, 1.09647621e+13], [ 4.56000000e+02, 1.09967975e+13], [ 4.57000000e+02, 1.10285249e+13], [ 4.58000000e+02, 1.10599443e+13], [ 4.59000000e+02, 1.10910559e+13], [ 4.60000000e+02, 1.11218598e+13], [ 4.61000000e+02, 1.11523560e+13], [ 4.62000000e+02, 1.11825447e+13], [ 4.63000000e+02, 1.12124262e+13], [ 4.64000000e+02, 1.12420006e+13], [ 4.65000000e+02, 1.12712681e+13], [ 4.66000000e+02, 1.13002292e+13], [ 4.67000000e+02, 1.13288840e+13], [ 4.68000000e+02, 1.13572329e+13], [ 4.69000000e+02, 1.13852762e+13], [ 4.70000000e+02, 1.14130144e+13], [ 4.71000000e+02, 1.14404478e+13], [ 4.72000000e+02, 1.14675768e+13], [ 4.73000000e+02, 1.14944020e+13], [ 4.74000000e+02, 1.15209237e+13], [ 4.75000000e+02, 1.15471425e+13], [ 4.76000000e+02, 1.15730590e+13], [ 4.77000000e+02, 1.15986736e+13], [ 4.78000000e+02, 1.16239869e+13], [ 4.79000000e+02, 1.16489996e+13], [ 4.80000000e+02, 1.16737122e+13], [ 4.81000000e+02, 1.16981253e+13], [ 4.82000000e+02, 1.17222397e+13], [ 4.83000000e+02, 1.17460559e+13], [ 4.84000000e+02, 1.17695747e+13], [ 4.85000000e+02, 1.17927969e+13], [ 4.86000000e+02, 1.18157230e+13], [ 4.87000000e+02, 1.18383540e+13], [ 4.88000000e+02, 1.18606904e+13], [ 4.89000000e+02, 1.18827333e+13], [ 4.90000000e+02, 1.19044832e+13], [ 4.91000000e+02, 1.19259412e+13], [ 4.92000000e+02, 1.19471079e+13], [ 4.93000000e+02, 1.19679843e+13], [ 4.94000000e+02, 1.19885712e+13], [ 4.95000000e+02, 1.20088695e+13], [ 4.96000000e+02, 1.20288802e+13], [ 4.97000000e+02, 1.20486041e+13], [ 4.98000000e+02, 1.20680421e+13], [ 4.99000000e+02, 1.20871953e+13], [ 5.00000000e+02, 1.21060645e+13], [ 5.01000000e+02, 1.21246508e+13], [ 5.02000000e+02, 1.21429552e+13], [ 5.03000000e+02, 1.21609785e+13], [ 5.04000000e+02, 1.21787220e+13], [ 5.05000000e+02, 1.21961865e+13], [ 5.06000000e+02, 1.22133731e+13], [ 5.07000000e+02, 1.22302829e+13], [ 5.08000000e+02, 1.22469170e+13], [ 5.09000000e+02, 1.22632763e+13], [ 5.10000000e+02, 1.22793620e+13], [ 5.11000000e+02, 1.22951752e+13], [ 5.12000000e+02, 1.23107171e+13], [ 5.13000000e+02, 1.23259886e+13], [ 5.14000000e+02, 1.23409909e+13], [ 5.15000000e+02, 1.23557252e+13], [ 5.16000000e+02, 1.23701926e+13], [ 5.17000000e+02, 1.23843943e+13], [ 5.18000000e+02, 1.23983314e+13], [ 5.19000000e+02, 1.24120051e+13], [ 5.20000000e+02, 1.24254166e+13], [ 5.21000000e+02, 1.24385670e+13], [ 5.22000000e+02, 1.24514576e+13], [ 5.23000000e+02, 1.24640896e+13], [ 5.24000000e+02, 1.24764641e+13], [ 5.25000000e+02, 1.24885824e+13], [ 5.26000000e+02, 1.25004457e+13], [ 5.27000000e+02, 1.25120552e+13], [ 5.28000000e+02, 1.25234122e+13], [ 5.29000000e+02, 1.25345178e+13], [ 5.30000000e+02, 1.25453735e+13], [ 5.31000000e+02, 1.25559803e+13], [ 5.32000000e+02, 1.25663396e+13], [ 5.33000000e+02, 1.25764527e+13], [ 5.34000000e+02, 1.25863207e+13], [ 5.35000000e+02, 1.25959449e+13], [ 5.36000000e+02, 1.26053268e+13], [ 5.37000000e+02, 1.26144674e+13], [ 5.38000000e+02, 1.26233681e+13], [ 5.39000000e+02, 1.26320302e+13], [ 5.40000000e+02, 1.26404551e+13], [ 5.41000000e+02, 1.26486438e+13], [ 5.42000000e+02, 1.26565979e+13], [ 5.43000000e+02, 1.26643185e+13], [ 5.44000000e+02, 1.26718071e+13], [ 5.45000000e+02, 1.26790648e+13], [ 5.46000000e+02, 1.26860930e+13], [ 5.47000000e+02, 1.26928930e+13], [ 5.48000000e+02, 1.26994662e+13], [ 5.49000000e+02, 1.27058138e+13], [ 5.50000000e+02, 1.27119372e+13], [ 5.51000000e+02, 1.27178376e+13], [ 5.52000000e+02, 1.27235164e+13], [ 5.53000000e+02, 1.27289750e+13], [ 5.54000000e+02, 1.27342146e+13], [ 5.55000000e+02, 1.27392366e+13], [ 5.56000000e+02, 1.27440423e+13], [ 5.57000000e+02, 1.27486330e+13], [ 5.58000000e+02, 1.27530100e+13], [ 5.59000000e+02, 1.27571748e+13], [ 5.60000000e+02, 1.27611285e+13], [ 5.61000000e+02, 1.27648725e+13], [ 5.62000000e+02, 1.27684083e+13], [ 5.63000000e+02, 1.27717370e+13], [ 5.64000000e+02, 1.27748600e+13], [ 5.65000000e+02, 1.27777787e+13], [ 5.66000000e+02, 1.27804943e+13], [ 5.67000000e+02, 1.27830082e+13], [ 5.68000000e+02, 1.27853217e+13], [ 5.69000000e+02, 1.27874362e+13], [ 5.70000000e+02, 1.27893529e+13], [ 5.71000000e+02, 1.27910732e+13], [ 5.72000000e+02, 1.27925984e+13], [ 5.73000000e+02, 1.27939299e+13], [ 5.74000000e+02, 1.27950689e+13], [ 5.75000000e+02, 1.27960167e+13], [ 5.76000000e+02, 1.27967747e+13], [ 5.77000000e+02, 1.27973442e+13], [ 5.78000000e+02, 1.27977264e+13], [ 5.79000000e+02, 1.27979228e+13], [ 5.80000000e+02, 1.27979346e+13], [ 5.81000000e+02, 1.27977630e+13], [ 5.82000000e+02, 1.27974095e+13], [ 5.83000000e+02, 1.27968753e+13], [ 5.84000000e+02, 1.27961617e+13], [ 5.85000000e+02, 1.27952700e+13], [ 5.86000000e+02, 1.27942015e+13], [ 5.87000000e+02, 1.27929575e+13], [ 5.88000000e+02, 1.27915392e+13], [ 5.89000000e+02, 1.27899480e+13], [ 5.90000000e+02, 1.27881852e+13], [ 5.91000000e+02, 1.27862519e+13], [ 5.92000000e+02, 1.27841495e+13], [ 5.93000000e+02, 1.27818793e+13], [ 5.94000000e+02, 1.27794424e+13], [ 5.95000000e+02, 1.27768403e+13], [ 5.96000000e+02, 1.27740741e+13], [ 5.97000000e+02, 1.27711451e+13], [ 5.98000000e+02, 1.27680546e+13], [ 5.99000000e+02, 1.27648037e+13], [ 6.00000000e+02, 1.27613938e+13], [ 6.01000000e+02, 1.27578261e+13], [ 6.02000000e+02, 1.27541018e+13], [ 6.03000000e+02, 1.27502222e+13], [ 6.04000000e+02, 1.27461885e+13], [ 6.05000000e+02, 1.27420020e+13], [ 6.06000000e+02, 1.27376637e+13], [ 6.07000000e+02, 1.27331750e+13], [ 6.08000000e+02, 1.27285371e+13], [ 6.09000000e+02, 1.27237512e+13], [ 6.10000000e+02, 1.27188185e+13], [ 6.11000000e+02, 1.27137402e+13], [ 6.12000000e+02, 1.27085175e+13], [ 6.13000000e+02, 1.27031516e+13], [ 6.14000000e+02, 1.26976436e+13], [ 6.15000000e+02, 1.26919949e+13], [ 6.16000000e+02, 1.26862064e+13], [ 6.17000000e+02, 1.26802795e+13], [ 6.18000000e+02, 1.26742153e+13], [ 6.19000000e+02, 1.26680149e+13], [ 6.20000000e+02, 1.26616795e+13], [ 6.21000000e+02, 1.26552103e+13], [ 6.22000000e+02, 1.26486085e+13], [ 6.23000000e+02, 1.26418751e+13], [ 6.24000000e+02, 1.26350113e+13], [ 6.25000000e+02, 1.26280183e+13], [ 6.26000000e+02, 1.26208972e+13], [ 6.27000000e+02, 1.26136491e+13], [ 6.28000000e+02, 1.26062751e+13], [ 6.29000000e+02, 1.25987764e+13], [ 6.30000000e+02, 1.25911540e+13], [ 6.31000000e+02, 1.25834092e+13], [ 6.32000000e+02, 1.25755429e+13], [ 6.33000000e+02, 1.25675563e+13], [ 6.34000000e+02, 1.25594505e+13], [ 6.35000000e+02, 1.25512265e+13], [ 6.36000000e+02, 1.25428855e+13], [ 6.37000000e+02, 1.25344285e+13], [ 6.38000000e+02, 1.25258566e+13], [ 6.39000000e+02, 1.25171709e+13], [ 6.40000000e+02, 1.25083724e+13], [ 6.41000000e+02, 1.24994622e+13], [ 6.42000000e+02, 1.24904413e+13], [ 6.43000000e+02, 1.24813108e+13], [ 6.44000000e+02, 1.24720718e+13], [ 6.45000000e+02, 1.24627252e+13], [ 6.46000000e+02, 1.24532721e+13], [ 6.47000000e+02, 1.24437136e+13], [ 6.48000000e+02, 1.24340506e+13], [ 6.49000000e+02, 1.24242842e+13], [ 6.50000000e+02, 1.24144153e+13], [ 6.51000000e+02, 1.24044450e+13], [ 6.52000000e+02, 1.23943743e+13], [ 6.53000000e+02, 1.23842042e+13], [ 6.54000000e+02, 1.23739356e+13], [ 6.55000000e+02, 1.23635696e+13], [ 6.56000000e+02, 1.23531072e+13], [ 6.57000000e+02, 1.23425492e+13], [ 6.58000000e+02, 1.23318967e+13], [ 6.59000000e+02, 1.23211506e+13], [ 6.60000000e+02, 1.23103120e+13], [ 6.61000000e+02, 1.22993816e+13], [ 6.62000000e+02, 1.22883606e+13], [ 6.63000000e+02, 1.22772498e+13], [ 6.64000000e+02, 1.22660502e+13], [ 6.65000000e+02, 1.22547627e+13], [ 6.66000000e+02, 1.22433883e+13], [ 6.67000000e+02, 1.22319278e+13], [ 6.68000000e+02, 1.22203821e+13], [ 6.69000000e+02, 1.22087523e+13], [ 6.70000000e+02, 1.21970391e+13], [ 6.71000000e+02, 1.21852435e+13], [ 6.72000000e+02, 1.21733664e+13], [ 6.73000000e+02, 1.21614087e+13], [ 6.74000000e+02, 1.21493712e+13], [ 6.75000000e+02, 1.21372548e+13], [ 6.76000000e+02, 1.21250605e+13], [ 6.77000000e+02, 1.21127890e+13], [ 6.78000000e+02, 1.21004413e+13], [ 6.79000000e+02, 1.20880182e+13], [ 6.80000000e+02, 1.20755205e+13], [ 6.81000000e+02, 1.20629491e+13], [ 6.82000000e+02, 1.20503049e+13], [ 6.83000000e+02, 1.20375887e+13], [ 6.84000000e+02, 1.20248012e+13], [ 6.85000000e+02, 1.20119434e+13], [ 6.86000000e+02, 1.19990161e+13], [ 6.87000000e+02, 1.19860200e+13], [ 6.88000000e+02, 1.19729560e+13], [ 6.89000000e+02, 1.19598249e+13], [ 6.90000000e+02, 1.19466275e+13], [ 6.91000000e+02, 1.19333646e+13], [ 6.92000000e+02, 1.19200370e+13], [ 6.93000000e+02, 1.19066454e+13], [ 6.94000000e+02, 1.18931907e+13], [ 6.95000000e+02, 1.18796736e+13], [ 6.96000000e+02, 1.18660949e+13], [ 6.97000000e+02, 1.18524554e+13], [ 6.98000000e+02, 1.18387558e+13], [ 6.99000000e+02, 1.18249969e+13], [ 7.00000000e+02, 1.18111794e+13], [ 7.01000000e+02, 1.17973040e+13], [ 7.02000000e+02, 1.17833716e+13], [ 7.03000000e+02, 1.17693829e+13], [ 7.04000000e+02, 1.17553385e+13], [ 7.05000000e+02, 1.17412392e+13], [ 7.06000000e+02, 1.17270858e+13], [ 7.07000000e+02, 1.17128789e+13], [ 7.08000000e+02, 1.16986192e+13], [ 7.09000000e+02, 1.16843075e+13], [ 7.10000000e+02, 1.16699445e+13], [ 7.11000000e+02, 1.16555309e+13], [ 7.12000000e+02, 1.16410673e+13], [ 7.13000000e+02, 1.16265544e+13], [ 7.14000000e+02, 1.16119930e+13], [ 7.15000000e+02, 1.15973836e+13], [ 7.16000000e+02, 1.15827271e+13], [ 7.17000000e+02, 1.15680240e+13], [ 7.18000000e+02, 1.15532749e+13], [ 7.19000000e+02, 1.15384807e+13], [ 7.20000000e+02, 1.15236419e+13], [ 7.21000000e+02, 1.15087591e+13], [ 7.22000000e+02, 1.14938331e+13], [ 7.23000000e+02, 1.14788644e+13], [ 7.24000000e+02, 1.14638537e+13], [ 7.25000000e+02, 1.14488017e+13], [ 7.26000000e+02, 1.14337088e+13], [ 7.27000000e+02, 1.14185759e+13], [ 7.28000000e+02, 1.14034034e+13], [ 7.29000000e+02, 1.13881921e+13], [ 7.30000000e+02, 1.13729424e+13], [ 7.31000000e+02, 1.13576551e+13], [ 7.32000000e+02, 1.13423307e+13], [ 7.33000000e+02, 1.13269698e+13], [ 7.34000000e+02, 1.13115730e+13], [ 7.35000000e+02, 1.12961409e+13], [ 7.36000000e+02, 1.12806741e+13], [ 7.37000000e+02, 1.12651731e+13], [ 7.38000000e+02, 1.12496385e+13], [ 7.39000000e+02, 1.12340710e+13], [ 7.40000000e+02, 1.12184710e+13], [ 7.41000000e+02, 1.12028391e+13], [ 7.42000000e+02, 1.11871759e+13], [ 7.43000000e+02, 1.11714819e+13], [ 7.44000000e+02, 1.11557577e+13], [ 7.45000000e+02, 1.11400038e+13], [ 7.46000000e+02, 1.11242208e+13], [ 7.47000000e+02, 1.11084092e+13], [ 7.48000000e+02, 1.10925695e+13], [ 7.49000000e+02, 1.10767023e+13], [ 7.50000000e+02, 1.10608080e+13], [ 7.51000000e+02, 1.10448872e+13], [ 7.52000000e+02, 1.10289405e+13], [ 7.53000000e+02, 1.10129683e+13], [ 7.54000000e+02, 1.09969711e+13], [ 7.55000000e+02, 1.09809495e+13], [ 7.56000000e+02, 1.09649039e+13], [ 7.57000000e+02, 1.09488348e+13], [ 7.58000000e+02, 1.09327427e+13], [ 7.59000000e+02, 1.09166282e+13], [ 7.60000000e+02, 1.09004917e+13], [ 7.61000000e+02, 1.08843336e+13], [ 7.62000000e+02, 1.08681545e+13], [ 7.63000000e+02, 1.08519548e+13], [ 7.64000000e+02, 1.08357350e+13], [ 7.65000000e+02, 1.08194956e+13], [ 7.66000000e+02, 1.08032370e+13], [ 7.67000000e+02, 1.07869596e+13], [ 7.68000000e+02, 1.07706640e+13], [ 7.69000000e+02, 1.07543506e+13], [ 7.70000000e+02, 1.07380198e+13], [ 7.71000000e+02, 1.07216721e+13], [ 7.72000000e+02, 1.07053078e+13], [ 7.73000000e+02, 1.06889276e+13], [ 7.74000000e+02, 1.06725317e+13], [ 7.75000000e+02, 1.06561206e+13], [ 7.76000000e+02, 1.06396947e+13], [ 7.77000000e+02, 1.06232545e+13], [ 7.78000000e+02, 1.06068004e+13], [ 7.79000000e+02, 1.05903327e+13], [ 7.80000000e+02, 1.05738520e+13]], interpolator=SpragueInterpolator, interpolator_args={}, extrapolator=Extrapolator, extrapolator_args={...}) """ wavelengths = shape.range() return SpectralDistribution( data=dict( zip(wavelengths, planck_law(wavelengths * 1e-9, temperature, c1, c2, n))), name='{0}K Blackbody'.format(temperature))
def read_sds_from_csv_file(path, delimiter=',', fields=None, default=0): """ Reads the spectral data from given *CSV* file and return its content as an *OrderedDict* of :class:`colour.SpectralDistribution` classes. Parameters ---------- path : unicode Absolute *CSV* file path. delimiter : unicode, optional *CSV* file content delimiter. fields : array_like, optional *CSV* file spectral data fields names. If no value is provided the first line of the file will be used for as spectral data fields names. default : numeric Default value for fields row with missing value. Returns ------- OrderedDict :class:`colour.SpectralDistribution` classes of given *CSV* file. Examples -------- >>> from colour.utilities import numpy_print_options >>> import os >>> csv_file = os.path.join(os.path.dirname(__file__), 'tests', ... 'resources', 'colorchecker_n_ohta.csv') >>> sds = read_sds_from_csv_file(csv_file) >>> print(tuple(sds.keys())) ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', \ '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24') >>> with numpy_print_options(suppress=True): ... sds['1'] # doctest: +ELLIPSIS SpectralDistribution([[ 380. , 0.048], [ 385. , 0.051], [ 390. , 0.055], [ 395. , 0.06 ], [ 400. , 0.065], [ 405. , 0.068], [ 410. , 0.068], [ 415. , 0.067], [ 420. , 0.064], [ 425. , 0.062], [ 430. , 0.059], [ 435. , 0.057], [ 440. , 0.055], [ 445. , 0.054], [ 450. , 0.053], [ 455. , 0.053], [ 460. , 0.052], [ 465. , 0.052], [ 470. , 0.052], [ 475. , 0.053], [ 480. , 0.054], [ 485. , 0.055], [ 490. , 0.057], [ 495. , 0.059], [ 500. , 0.061], [ 505. , 0.062], [ 510. , 0.065], [ 515. , 0.067], [ 520. , 0.07 ], [ 525. , 0.072], [ 530. , 0.074], [ 535. , 0.075], [ 540. , 0.076], [ 545. , 0.078], [ 550. , 0.079], [ 555. , 0.082], [ 560. , 0.087], [ 565. , 0.092], [ 570. , 0.1 ], [ 575. , 0.107], [ 580. , 0.115], [ 585. , 0.122], [ 590. , 0.129], [ 595. , 0.134], [ 600. , 0.138], [ 605. , 0.142], [ 610. , 0.146], [ 615. , 0.15 ], [ 620. , 0.154], [ 625. , 0.158], [ 630. , 0.163], [ 635. , 0.167], [ 640. , 0.173], [ 645. , 0.18 ], [ 650. , 0.188], [ 655. , 0.196], [ 660. , 0.204], [ 665. , 0.213], [ 670. , 0.222], [ 675. , 0.231], [ 680. , 0.242], [ 685. , 0.251], [ 690. , 0.261], [ 695. , 0.271], [ 700. , 0.282], [ 705. , 0.294], [ 710. , 0.305], [ 715. , 0.318], [ 720. , 0.334], [ 725. , 0.354], [ 730. , 0.372], [ 735. , 0.392], [ 740. , 0.409], [ 745. , 0.42 ], [ 750. , 0.436], [ 755. , 0.45 ], [ 760. , 0.462], [ 765. , 0.465], [ 770. , 0.448], [ 775. , 0.432], [ 780. , 0.421]], interpolator=SpragueInterpolator, interpolator_args={}, extrapolator=Extrapolator, extrapolator_args={...}) """ data = read_spectral_data_from_csv_file(path, delimiter, fields, default) sds = OrderedDict(((key, SpectralDistribution(value, name=key)) for key, value in data.items())) return sds
def sd_mesopic_luminous_efficiency_function( Lp, source='Blue Heavy', method='MOVE', photopic_lef=SDS_LEFS_PHOTOPIC['CIE 1924 Photopic Standard Observer'], scotopic_lef=SDS_LEFS_SCOTOPIC['CIE 1951 Scotopic Standard Observer']): """ Returns the mesopic luminous efficiency function :math:`V_m(\\lambda)` for given photopic luminance :math:`L_p`. Parameters ---------- Lp : numeric Photopic luminance :math:`L_p`. source : unicode, optional **{'Blue Heavy', 'Red Heavy'}**, Light source colour temperature. method : unicode, optional **{'MOVE', 'LRC'}**, Method to calculate the weighting factor. photopic_lef : SpectralDistribution, optional :math:`V(\\lambda)` photopic luminous efficiency function. scotopic_lef : SpectralDistribution, optional :math:`V^\\prime(\\lambda)` scotopic luminous efficiency function. Returns ------- SpectralDistribution Mesopic luminous efficiency function :math:`V_m(\\lambda)`. References ---------- :cite:`Wikipedia2005d` Examples -------- >>> from colour.utilities import numpy_print_options >>> with numpy_print_options(suppress=True): ... sd_mesopic_luminous_efficiency_function(0.2) # doctest: +ELLIPSIS SpectralDistribution([[ 380. , 0.000424 ...], [ 381. , 0.0004781...], [ 382. , 0.0005399...], [ 383. , 0.0006122...], [ 384. , 0.0006961...], [ 385. , 0.0007929...], [ 386. , 0.000907 ...], [ 387. , 0.0010389...], [ 388. , 0.0011923...], [ 389. , 0.0013703...], [ 390. , 0.0015771...], [ 391. , 0.0018167...], [ 392. , 0.0020942...], [ 393. , 0.0024160...], [ 394. , 0.0027888...], [ 395. , 0.0032196...], [ 396. , 0.0037222...], [ 397. , 0.0042957...], [ 398. , 0.0049531...], [ 399. , 0.0057143...], [ 400. , 0.0065784...], [ 401. , 0.0075658...], [ 402. , 0.0086912...], [ 403. , 0.0099638...], [ 404. , 0.0114058...], [ 405. , 0.0130401...], [ 406. , 0.0148750...], [ 407. , 0.0169310...], [ 408. , 0.0192211...], [ 409. , 0.0217511...], [ 410. , 0.0245342...], [ 411. , 0.0275773...], [ 412. , 0.0309172...], [ 413. , 0.0345149...], [ 414. , 0.0383998...], [ 415. , 0.0425744...], [ 416. , 0.0471074...], [ 417. , 0.0519322...], [ 418. , 0.0570541...], [ 419. , 0.0625466...], [ 420. , 0.0683463...], [ 421. , 0.0745255...], [ 422. , 0.0809440...], [ 423. , 0.0877344...], [ 424. , 0.0948915...], [ 425. , 0.1022731...], [ 426. , 0.109877 ...], [ 427. , 0.1178421...], [ 428. , 0.1260316...], [ 429. , 0.1343772...], [ 430. , 0.143017 ...], [ 431. , 0.1518128...], [ 432. , 0.1608328...], [ 433. , 0.1700088...], [ 434. , 0.1792726...], [ 435. , 0.1886934...], [ 436. , 0.1982041...], [ 437. , 0.2078032...], [ 438. , 0.2174184...], [ 439. , 0.2271147...], [ 440. , 0.2368196...], [ 441. , 0.2464623...], [ 442. , 0.2561153...], [ 443. , 0.2657160...], [ 444. , 0.2753387...], [ 445. , 0.2848520...], [ 446. , 0.2944648...], [ 447. , 0.3034902...], [ 448. , 0.3132347...], [ 449. , 0.3223257...], [ 450. , 0.3314513...], [ 451. , 0.3406129...], [ 452. , 0.3498117...], [ 453. , 0.3583617...], [ 454. , 0.3676377...], [ 455. , 0.3762670...], [ 456. , 0.3849392...], [ 457. , 0.3936540...], [ 458. , 0.4024077...], [ 459. , 0.4111965...], [ 460. , 0.4193298...], [ 461. , 0.4281803...], [ 462. , 0.4363804...], [ 463. , 0.4453117...], [ 464. , 0.4542949...], [ 465. , 0.4626509...], [ 466. , 0.4717570...], [ 467. , 0.4809300...], [ 468. , 0.4901776...], [ 469. , 0.4995075...], [ 470. , 0.5096145...], [ 471. , 0.5191293...], [ 472. , 0.5294259...], [ 473. , 0.5391316...], [ 474. , 0.5496217...], [ 475. , 0.5602103...], [ 476. , 0.5702197...], [ 477. , 0.5810207...], [ 478. , 0.5919093...], [ 479. , 0.6028683...], [ 480. , 0.6138806...], [ 481. , 0.6249373...], [ 482. , 0.6360619...], [ 483. , 0.6465989...], [ 484. , 0.6579538...], [ 485. , 0.6687841...], [ 486. , 0.6797939...], [ 487. , 0.6909887...], [ 488. , 0.7023827...], [ 489. , 0.7133032...], [ 490. , 0.7244513...], [ 491. , 0.7358470...], [ 492. , 0.7468118...], [ 493. , 0.7580294...], [ 494. , 0.7694964...], [ 495. , 0.7805225...], [ 496. , 0.7917805...], [ 497. , 0.8026123...], [ 498. , 0.8130793...], [ 499. , 0.8239297...], [ 500. , 0.8352251...], [ 501. , 0.8456342...], [ 502. , 0.8564818...], [ 503. , 0.8676921...], [ 504. , 0.8785021...], [ 505. , 0.8881489...], [ 506. , 0.8986405...], [ 507. , 0.9079322...], [ 508. , 0.9174255...], [ 509. , 0.9257739...], [ 510. , 0.9350656...], [ 511. , 0.9432365...], [ 512. , 0.9509063...], [ 513. , 0.9586931...], [ 514. , 0.9658413...], [ 515. , 0.9722825...], [ 516. , 0.9779924...], [ 517. , 0.9836106...], [ 518. , 0.9883465...], [ 519. , 0.9920964...], [ 520. , 0.9954436...], [ 521. , 0.9976202...], [ 522. , 0.9993457...], [ 523. , 1. ...], [ 524. , 0.9996498...], [ 525. , 0.9990487...], [ 526. , 0.9975356...], [ 527. , 0.9957615...], [ 528. , 0.9930143...], [ 529. , 0.9899559...], [ 530. , 0.9858741...], [ 531. , 0.9814453...], [ 532. , 0.9766885...], [ 533. , 0.9709363...], [ 534. , 0.9648947...], [ 535. , 0.9585832...], [ 536. , 0.952012 ...], [ 537. , 0.9444916...], [ 538. , 0.9367089...], [ 539. , 0.9293506...], [ 540. , 0.9210429...], [ 541. , 0.9124772...], [ 542. , 0.9036604...], [ 543. , 0.8945958...], [ 544. , 0.8845999...], [ 545. , 0.8750500...], [ 546. , 0.8659457...], [ 547. , 0.8559224...], [ 548. , 0.8456846...], [ 549. , 0.8352499...], [ 550. , 0.8253229...], [ 551. , 0.8152079...], [ 552. , 0.8042205...], [ 553. , 0.7944209...], [ 554. , 0.7837466...], [ 555. , 0.7735680...], [ 556. , 0.7627808...], [ 557. , 0.7522710...], [ 558. , 0.7417549...], [ 559. , 0.7312909...], [ 560. , 0.7207983...], [ 561. , 0.7101939...], [ 562. , 0.6996362...], [ 563. , 0.6890656...], [ 564. , 0.6785599...], [ 565. , 0.6680593...], [ 566. , 0.6575697...], [ 567. , 0.6471578...], [ 568. , 0.6368208...], [ 569. , 0.6264871...], [ 570. , 0.6161541...], [ 571. , 0.6058896...], [ 572. , 0.5957000...], [ 573. , 0.5855937...], [ 574. , 0.5754412...], [ 575. , 0.5653883...], [ 576. , 0.5553742...], [ 577. , 0.5454680...], [ 578. , 0.5355972...], [ 579. , 0.5258267...], [ 580. , 0.5160152...], [ 581. , 0.5062322...], [ 582. , 0.4965595...], [ 583. , 0.4868746...], [ 584. , 0.4773299...], [ 585. , 0.4678028...], [ 586. , 0.4583704...], [ 587. , 0.4489722...], [ 588. , 0.4397606...], [ 589. , 0.4306131...], [ 590. , 0.4215446...], [ 591. , 0.4125681...], [ 592. , 0.4037550...], [ 593. , 0.3950359...], [ 594. , 0.3864104...], [ 595. , 0.3778777...], [ 596. , 0.3694405...], [ 597. , 0.3611074...], [ 598. , 0.3528596...], [ 599. , 0.3447056...], [ 600. , 0.3366470...], [ 601. , 0.3286917...], [ 602. , 0.3208410...], [ 603. , 0.3130808...], [ 604. , 0.3054105...], [ 605. , 0.2978225...], [ 606. , 0.2903027...], [ 607. , 0.2828727...], [ 608. , 0.2755311...], [ 609. , 0.2682900...], [ 610. , 0.2611478...], [ 611. , 0.2541176...], [ 612. , 0.2471885...], [ 613. , 0.2403570...], [ 614. , 0.2336057...], [ 615. , 0.2269379...], [ 616. , 0.2203527...], [ 617. , 0.2138465...], [ 618. , 0.2073946...], [ 619. , 0.2009789...], [ 620. , 0.1945818...], [ 621. , 0.1881943...], [ 622. , 0.1818226...], [ 623. , 0.1754987...], [ 624. , 0.1692476...], [ 625. , 0.1630876...], [ 626. , 0.1570257...], [ 627. , 0.151071 ...], [ 628. , 0.1452469...], [ 629. , 0.1395845...], [ 630. , 0.1341087...], [ 631. , 0.1288408...], [ 632. , 0.1237666...], [ 633. , 0.1188631...], [ 634. , 0.1141075...], [ 635. , 0.1094766...], [ 636. , 0.1049613...], [ 637. , 0.1005679...], [ 638. , 0.0962924...], [ 639. , 0.0921296...], [ 640. , 0.0880778...], [ 641. , 0.0841306...], [ 642. , 0.0802887...], [ 643. , 0.0765559...], [ 644. , 0.0729367...], [ 645. , 0.0694345...], [ 646. , 0.0660491...], [ 647. , 0.0627792...], [ 648. , 0.0596278...], [ 649. , 0.0565970...], [ 650. , 0.0536896...], [ 651. , 0.0509068...], [ 652. , 0.0482444...], [ 653. , 0.0456951...], [ 654. , 0.0432510...], [ 655. , 0.0409052...], [ 656. , 0.0386537...], [ 657. , 0.0364955...], [ 658. , 0.0344285...], [ 659. , 0.0324501...], [ 660. , 0.0305579...], [ 661. , 0.0287496...], [ 662. , 0.0270233...], [ 663. , 0.0253776...], [ 664. , 0.0238113...], [ 665. , 0.0223226...], [ 666. , 0.0209086...], [ 667. , 0.0195688...], [ 668. , 0.0183056...], [ 669. , 0.0171216...], [ 670. , 0.0160192...], [ 671. , 0.0149986...], [ 672. , 0.0140537...], [ 673. , 0.0131784...], [ 674. , 0.0123662...], [ 675. , 0.0116107...], [ 676. , 0.0109098...], [ 677. , 0.0102587...], [ 678. , 0.0096476...], [ 679. , 0.0090665...], [ 680. , 0.0085053...], [ 681. , 0.0079567...], [ 682. , 0.0074229...], [ 683. , 0.0069094...], [ 684. , 0.0064213...], [ 685. , 0.0059637...], [ 686. , 0.0055377...], [ 687. , 0.0051402...], [ 688. , 0.00477 ...], [ 689. , 0.0044263...], [ 690. , 0.0041081...], [ 691. , 0.0038149...], [ 692. , 0.0035456...], [ 693. , 0.0032984...], [ 694. , 0.0030718...], [ 695. , 0.0028639...], [ 696. , 0.0026738...], [ 697. , 0.0025000...], [ 698. , 0.0023401...], [ 699. , 0.0021918...], [ 700. , 0.0020526...], [ 701. , 0.0019207...], [ 702. , 0.001796 ...], [ 703. , 0.0016784...], [ 704. , 0.0015683...], [ 705. , 0.0014657...], [ 706. , 0.0013702...], [ 707. , 0.001281 ...], [ 708. , 0.0011976...], [ 709. , 0.0011195...], [ 710. , 0.0010464...], [ 711. , 0.0009776...], [ 712. , 0.0009131...], [ 713. , 0.0008525...], [ 714. , 0.0007958...], [ 715. , 0.0007427...], [ 716. , 0.0006929...], [ 717. , 0.0006462...], [ 718. , 0.0006026...], [ 719. , 0.0005619...], [ 720. , 0.0005240...], [ 721. , 0.0004888...], [ 722. , 0.0004561...], [ 723. , 0.0004255...], [ 724. , 0.0003971...], [ 725. , 0.0003704...], [ 726. , 0.0003455...], [ 727. , 0.0003221...], [ 728. , 0.0003001...], [ 729. , 0.0002796...], [ 730. , 0.0002604...], [ 731. , 0.0002423...], [ 732. , 0.0002254...], [ 733. , 0.0002095...], [ 734. , 0.0001947...], [ 735. , 0.0001809...], [ 736. , 0.0001680...], [ 737. , 0.0001560...], [ 738. , 0.0001449...], [ 739. , 0.0001345...], [ 740. , 0.0001249...], [ 741. , 0.0001159...], [ 742. , 0.0001076...], [ 743. , 0.0000999...], [ 744. , 0.0000927...], [ 745. , 0.0000862...], [ 746. , 0.0000801...], [ 747. , 0.0000745...], [ 748. , 0.0000693...], [ 749. , 0.0000646...], [ 750. , 0.0000602...], [ 751. , 0.0000561...], [ 752. , 0.0000523...], [ 753. , 0.0000488...], [ 754. , 0.0000456...], [ 755. , 0.0000425...], [ 756. , 0.0000397...], [ 757. , 0.0000370...], [ 758. , 0.0000346...], [ 759. , 0.0000322...], [ 760. , 0.0000301...], [ 761. , 0.0000281...], [ 762. , 0.0000262...], [ 763. , 0.0000244...], [ 764. , 0.0000228...], [ 765. , 0.0000213...], [ 766. , 0.0000198...], [ 767. , 0.0000185...], [ 768. , 0.0000173...], [ 769. , 0.0000161...], [ 770. , 0.0000150...], [ 771. , 0.0000140...], [ 772. , 0.0000131...], [ 773. , 0.0000122...], [ 774. , 0.0000114...], [ 775. , 0.0000106...], [ 776. , 0.0000099...], [ 777. , 0.0000092...], [ 778. , 0.0000086...], [ 779. , 0.0000080...], [ 780. , 0.0000075...]], interpolator=SpragueInterpolator, interpolator_kwargs={}, extrapolator=Extrapolator, extrapolator_kwargs={...}) """ photopic_lef_shape = photopic_lef.shape scotopic_lef_shape = scotopic_lef.shape shape = SpectralShape( max(photopic_lef_shape.start, scotopic_lef_shape.start), min(photopic_lef_shape.end, scotopic_lef_shape.end), max(photopic_lef_shape.interval, scotopic_lef_shape.interval)) wavelengths = shape.range() sd_data = dict( zip( wavelengths, mesopic_weighting_function(wavelengths, Lp, source, method, photopic_lef, scotopic_lef))) sd = SpectralDistribution( sd_data, name='{0} Lp Mesopic Luminous Efficiency Function'.format(Lp)) return sd.normalise()
785: 6.90, 790: 7.00, 795: 6.70, 800: 6.40, 805: 5.95, 810: 5.50, 815: 5.80, 820: 6.10, 825: 6.30, 830: 6.50, } } SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES = CaseInsensitiveMapping({ 'S0': SpectralDistribution(DATA_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES['S0'], name='S0'), 'S1': SpectralDistribution(DATA_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES['S1'], name='S1'), 'S2': SpectralDistribution(DATA_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES['S2'], name='S2') }) SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES.__doc__ = """ *CIE Illuminant D Series* :math:`S_n(\\lambda)` spectral distributions. References ---------- :cite:`Lindbloom2007a`, :cite:`Wyszecki2000z` SDS_BASIS_FUNCTIONS_CIE_ILLUMINANT_D_SERIES : CaseInsensitiveMapping
def sd_mesopic_luminous_efficiency_function( Lp, source='Blue Heavy', method='MOVE', photopic_lef=PHOTOPIC_LEFS['CIE 1924 Photopic Standard Observer'], scotopic_lef=SCOTOPIC_LEFS['CIE 1951 Scotopic Standard Observer']): """ Returns the mesopic luminous efficiency function :math:`V_m(\\lambda)` for given photopic luminance :math:`L_p`. Parameters ---------- Lp : numeric Photopic luminance :math:`L_p`. source : unicode, optional **{'Blue Heavy', 'Red Heavy'}**, Light source colour temperature. method : unicode, optional **{'MOVE', 'LRC'}**, Method to calculate the weighting factor. photopic_lef : SpectralDistribution, optional :math:`V(\\lambda)` photopic luminous efficiency function. scotopic_lef : SpectralDistribution, optional :math:`V^\\prime(\\lambda)` scotopic luminous efficiency function. Returns ------- SpectralDistribution Mesopic luminous efficiency function :math:`V_m(\\lambda)`. References ---------- :cite:`Wikipedia2005d` Examples -------- >>> from colour.utilities import numpy_print_options >>> with numpy_print_options(suppress=True): ... sd_mesopic_luminous_efficiency_function(0.2) # doctest: +ELLIPSIS SpectralDistribution([[ 380. , 0.000424 ...], [ 381. , 0.0004781...], [ 382. , 0.0005399...], [ 383. , 0.0006122...], [ 384. , 0.0006961...], [ 385. , 0.0007929...], [ 386. , 0.000907 ...], [ 387. , 0.0010389...], [ 388. , 0.0011923...], [ 389. , 0.0013703...], [ 390. , 0.0015771...], [ 391. , 0.0018167...], [ 392. , 0.0020942...], [ 393. , 0.0024160...], [ 394. , 0.0027888...], [ 395. , 0.0032196...], [ 396. , 0.0037222...], [ 397. , 0.0042957...], [ 398. , 0.0049531...], [ 399. , 0.0057143...], [ 400. , 0.0065784...], [ 401. , 0.0075658...], [ 402. , 0.0086912...], [ 403. , 0.0099638...], [ 404. , 0.0114058...], [ 405. , 0.0130401...], [ 406. , 0.0148750...], [ 407. , 0.0169310...], [ 408. , 0.0192211...], [ 409. , 0.0217511...], [ 410. , 0.0245342...], [ 411. , 0.0275773...], [ 412. , 0.0309172...], [ 413. , 0.0345149...], [ 414. , 0.0383998...], [ 415. , 0.0425744...], [ 416. , 0.0471074...], [ 417. , 0.0519322...], [ 418. , 0.0570541...], [ 419. , 0.0625466...], [ 420. , 0.0683463...], [ 421. , 0.0745255...], [ 422. , 0.0809440...], [ 423. , 0.0877344...], [ 424. , 0.0948915...], [ 425. , 0.1022731...], [ 426. , 0.109877 ...], [ 427. , 0.1178421...], [ 428. , 0.1260316...], [ 429. , 0.1343772...], [ 430. , 0.143017 ...], [ 431. , 0.1518128...], [ 432. , 0.1608328...], [ 433. , 0.1700088...], [ 434. , 0.1792726...], [ 435. , 0.1886934...], [ 436. , 0.1982041...], [ 437. , 0.2078032...], [ 438. , 0.2174184...], [ 439. , 0.2271147...], [ 440. , 0.2368196...], [ 441. , 0.2464623...], [ 442. , 0.2561153...], [ 443. , 0.2657160...], [ 444. , 0.2753387...], [ 445. , 0.2848520...], [ 446. , 0.2944648...], [ 447. , 0.3034902...], [ 448. , 0.3132347...], [ 449. , 0.3223257...], [ 450. , 0.3314513...], [ 451. , 0.3406129...], [ 452. , 0.3498117...], [ 453. , 0.3583617...], [ 454. , 0.3676377...], [ 455. , 0.3762670...], [ 456. , 0.3849392...], [ 457. , 0.3936540...], [ 458. , 0.4024077...], [ 459. , 0.4111965...], [ 460. , 0.4193298...], [ 461. , 0.4281803...], [ 462. , 0.4363804...], [ 463. , 0.4453117...], [ 464. , 0.4542949...], [ 465. , 0.4626509...], [ 466. , 0.4717570...], [ 467. , 0.4809300...], [ 468. , 0.4901776...], [ 469. , 0.4995075...], [ 470. , 0.5096145...], [ 471. , 0.5191293...], [ 472. , 0.5294259...], [ 473. , 0.5391316...], [ 474. , 0.5496217...], [ 475. , 0.5602103...], [ 476. , 0.5702197...], [ 477. , 0.5810207...], [ 478. , 0.5919093...], [ 479. , 0.6028683...], [ 480. , 0.6138806...], [ 481. , 0.6249373...], [ 482. , 0.6360619...], [ 483. , 0.6465989...], [ 484. , 0.6579538...], [ 485. , 0.6687841...], [ 486. , 0.6797939...], [ 487. , 0.6909887...], [ 488. , 0.7023827...], [ 489. , 0.7133032...], [ 490. , 0.7244513...], [ 491. , 0.7358470...], [ 492. , 0.7468118...], [ 493. , 0.7580294...], [ 494. , 0.7694964...], [ 495. , 0.7805225...], [ 496. , 0.7917805...], [ 497. , 0.8026123...], [ 498. , 0.8130793...], [ 499. , 0.8239297...], [ 500. , 0.8352251...], [ 501. , 0.8456342...], [ 502. , 0.8564818...], [ 503. , 0.8676921...], [ 504. , 0.8785021...], [ 505. , 0.8881489...], [ 506. , 0.8986405...], [ 507. , 0.9079322...], [ 508. , 0.9174255...], [ 509. , 0.9257739...], [ 510. , 0.9350656...], [ 511. , 0.9432365...], [ 512. , 0.9509063...], [ 513. , 0.9586931...], [ 514. , 0.9658413...], [ 515. , 0.9722825...], [ 516. , 0.9779924...], [ 517. , 0.9836106...], [ 518. , 0.9883465...], [ 519. , 0.9920964...], [ 520. , 0.9954436...], [ 521. , 0.9976202...], [ 522. , 0.9993457...], [ 523. , 1. ...], [ 524. , 0.9996498...], [ 525. , 0.9990487...], [ 526. , 0.9975356...], [ 527. , 0.9957615...], [ 528. , 0.9930143...], [ 529. , 0.9899559...], [ 530. , 0.9858741...], [ 531. , 0.9814453...], [ 532. , 0.9766885...], [ 533. , 0.9709363...], [ 534. , 0.9648947...], [ 535. , 0.9585832...], [ 536. , 0.952012 ...], [ 537. , 0.9444916...], [ 538. , 0.9367089...], [ 539. , 0.9293506...], [ 540. , 0.9210429...], [ 541. , 0.9124772...], [ 542. , 0.9036604...], [ 543. , 0.8945958...], [ 544. , 0.8845999...], [ 545. , 0.8750500...], [ 546. , 0.8659457...], [ 547. , 0.8559224...], [ 548. , 0.8456846...], [ 549. , 0.8352499...], [ 550. , 0.8253229...], [ 551. , 0.8152079...], [ 552. , 0.8042205...], [ 553. , 0.7944209...], [ 554. , 0.7837466...], [ 555. , 0.7735680...], [ 556. , 0.7627808...], [ 557. , 0.7522710...], [ 558. , 0.7417549...], [ 559. , 0.7312909...], [ 560. , 0.7207983...], [ 561. , 0.7101939...], [ 562. , 0.6996362...], [ 563. , 0.6890656...], [ 564. , 0.6785599...], [ 565. , 0.6680593...], [ 566. , 0.6575697...], [ 567. , 0.6471578...], [ 568. , 0.6368208...], [ 569. , 0.6264871...], [ 570. , 0.6161541...], [ 571. , 0.6058896...], [ 572. , 0.5957000...], [ 573. , 0.5855937...], [ 574. , 0.5754412...], [ 575. , 0.5653883...], [ 576. , 0.5553742...], [ 577. , 0.5454680...], [ 578. , 0.5355972...], [ 579. , 0.5258267...], [ 580. , 0.5160152...], [ 581. , 0.5062322...], [ 582. , 0.4965595...], [ 583. , 0.4868746...], [ 584. , 0.4773299...], [ 585. , 0.4678028...], [ 586. , 0.4583704...], [ 587. , 0.4489722...], [ 588. , 0.4397606...], [ 589. , 0.4306131...], [ 590. , 0.4215446...], [ 591. , 0.4125681...], [ 592. , 0.4037550...], [ 593. , 0.3950359...], [ 594. , 0.3864104...], [ 595. , 0.3778777...], [ 596. , 0.3694405...], [ 597. , 0.3611074...], [ 598. , 0.3528596...], [ 599. , 0.3447056...], [ 600. , 0.3366470...], [ 601. , 0.3286917...], [ 602. , 0.3208410...], [ 603. , 0.3130808...], [ 604. , 0.3054105...], [ 605. , 0.2978225...], [ 606. , 0.2903027...], [ 607. , 0.2828727...], [ 608. , 0.2755311...], [ 609. , 0.2682900...], [ 610. , 0.2611478...], [ 611. , 0.2541176...], [ 612. , 0.2471885...], [ 613. , 0.2403570...], [ 614. , 0.2336057...], [ 615. , 0.2269379...], [ 616. , 0.2203527...], [ 617. , 0.2138465...], [ 618. , 0.2073946...], [ 619. , 0.2009789...], [ 620. , 0.1945818...], [ 621. , 0.1881943...], [ 622. , 0.1818226...], [ 623. , 0.1754987...], [ 624. , 0.1692476...], [ 625. , 0.1630876...], [ 626. , 0.1570257...], [ 627. , 0.151071 ...], [ 628. , 0.1452469...], [ 629. , 0.1395845...], [ 630. , 0.1341087...], [ 631. , 0.1288408...], [ 632. , 0.1237666...], [ 633. , 0.1188631...], [ 634. , 0.1141075...], [ 635. , 0.1094766...], [ 636. , 0.1049613...], [ 637. , 0.1005679...], [ 638. , 0.0962924...], [ 639. , 0.0921296...], [ 640. , 0.0880778...], [ 641. , 0.0841306...], [ 642. , 0.0802887...], [ 643. , 0.0765559...], [ 644. , 0.0729367...], [ 645. , 0.0694345...], [ 646. , 0.0660491...], [ 647. , 0.0627792...], [ 648. , 0.0596278...], [ 649. , 0.0565970...], [ 650. , 0.0536896...], [ 651. , 0.0509068...], [ 652. , 0.0482444...], [ 653. , 0.0456951...], [ 654. , 0.0432510...], [ 655. , 0.0409052...], [ 656. , 0.0386537...], [ 657. , 0.0364955...], [ 658. , 0.0344285...], [ 659. , 0.0324501...], [ 660. , 0.0305579...], [ 661. , 0.0287496...], [ 662. , 0.0270233...], [ 663. , 0.0253776...], [ 664. , 0.0238113...], [ 665. , 0.0223226...], [ 666. , 0.0209086...], [ 667. , 0.0195688...], [ 668. , 0.0183056...], [ 669. , 0.0171216...], [ 670. , 0.0160192...], [ 671. , 0.0149986...], [ 672. , 0.0140537...], [ 673. , 0.0131784...], [ 674. , 0.0123662...], [ 675. , 0.0116107...], [ 676. , 0.0109098...], [ 677. , 0.0102587...], [ 678. , 0.0096476...], [ 679. , 0.0090665...], [ 680. , 0.0085053...], [ 681. , 0.0079567...], [ 682. , 0.0074229...], [ 683. , 0.0069094...], [ 684. , 0.0064213...], [ 685. , 0.0059637...], [ 686. , 0.0055377...], [ 687. , 0.0051402...], [ 688. , 0.00477 ...], [ 689. , 0.0044263...], [ 690. , 0.0041081...], [ 691. , 0.0038149...], [ 692. , 0.0035456...], [ 693. , 0.0032984...], [ 694. , 0.0030718...], [ 695. , 0.0028639...], [ 696. , 0.0026738...], [ 697. , 0.0025000...], [ 698. , 0.0023401...], [ 699. , 0.0021918...], [ 700. , 0.0020526...], [ 701. , 0.0019207...], [ 702. , 0.001796 ...], [ 703. , 0.0016784...], [ 704. , 0.0015683...], [ 705. , 0.0014657...], [ 706. , 0.0013702...], [ 707. , 0.001281 ...], [ 708. , 0.0011976...], [ 709. , 0.0011195...], [ 710. , 0.0010464...], [ 711. , 0.0009776...], [ 712. , 0.0009131...], [ 713. , 0.0008525...], [ 714. , 0.0007958...], [ 715. , 0.0007427...], [ 716. , 0.0006929...], [ 717. , 0.0006462...], [ 718. , 0.0006026...], [ 719. , 0.0005619...], [ 720. , 0.0005240...], [ 721. , 0.0004888...], [ 722. , 0.0004561...], [ 723. , 0.0004255...], [ 724. , 0.0003971...], [ 725. , 0.0003704...], [ 726. , 0.0003455...], [ 727. , 0.0003221...], [ 728. , 0.0003001...], [ 729. , 0.0002796...], [ 730. , 0.0002604...], [ 731. , 0.0002423...], [ 732. , 0.0002254...], [ 733. , 0.0002095...], [ 734. , 0.0001947...], [ 735. , 0.0001809...], [ 736. , 0.0001680...], [ 737. , 0.0001560...], [ 738. , 0.0001449...], [ 739. , 0.0001345...], [ 740. , 0.0001249...], [ 741. , 0.0001159...], [ 742. , 0.0001076...], [ 743. , 0.0000999...], [ 744. , 0.0000927...], [ 745. , 0.0000862...], [ 746. , 0.0000801...], [ 747. , 0.0000745...], [ 748. , 0.0000693...], [ 749. , 0.0000646...], [ 750. , 0.0000602...], [ 751. , 0.0000561...], [ 752. , 0.0000523...], [ 753. , 0.0000488...], [ 754. , 0.0000456...], [ 755. , 0.0000425...], [ 756. , 0.0000397...], [ 757. , 0.0000370...], [ 758. , 0.0000346...], [ 759. , 0.0000322...], [ 760. , 0.0000301...], [ 761. , 0.0000281...], [ 762. , 0.0000262...], [ 763. , 0.0000244...], [ 764. , 0.0000228...], [ 765. , 0.0000213...], [ 766. , 0.0000198...], [ 767. , 0.0000185...], [ 768. , 0.0000173...], [ 769. , 0.0000161...], [ 770. , 0.0000150...], [ 771. , 0.0000140...], [ 772. , 0.0000131...], [ 773. , 0.0000122...], [ 774. , 0.0000114...], [ 775. , 0.0000106...], [ 776. , 0.0000099...], [ 777. , 0.0000092...], [ 778. , 0.0000086...], [ 779. , 0.0000080...], [ 780. , 0.0000075...]], interpolator=SpragueInterpolator, interpolator_args={}, extrapolator=Extrapolator, extrapolator_args={...}) """ photopic_lef_shape = photopic_lef.shape scotopic_lef_shape = scotopic_lef.shape shape = SpectralShape( max(photopic_lef_shape.start, scotopic_lef_shape.start), min(photopic_lef_shape.end, scotopic_lef_shape.end), max(photopic_lef_shape.interval, scotopic_lef_shape.interval)) wavelengths = shape.range() sd_data = dict( zip( wavelengths, mesopic_weighting_function(wavelengths, Lp, source, method, photopic_lef, scotopic_lef))) sd = SpectralDistribution( sd_data, name='{0} Lp Mesopic Luminous Efficiency Function'.format(Lp)) return sd.normalise()