multi_lightness_function_plot(['CIE 1976', 'Glasser 1958']) print('\n') message_box('Plotting various blackbody spectral radiance.') blackbody_spectral_radiance_plot(temperature=3500, blackbody='VY Canis Majoris') blackbody_spectral_radiance_plot(temperature=5778, blackbody='The Sun') blackbody_spectral_radiance_plot(temperature=12130, blackbody='Rigel') print('\n') message_box('Comparing theoretical and measured "Sun" spectral distributions.') # Arbitrary ASTM_G_173_ETR scaling factor calculated with # :func:`colour.spectral_to_XYZ` definition. ASTM_G_173_spd = ASTM_G_173_ETR.copy() * 1.37905559e+13 ASTM_G_173_spd.interpolate(colour.SpectralShape(interval=5), interpolator=colour.LinearInterpolator) blackbody_spd = colour.blackbody_spd(5778, ASTM_G_173_spd.shape) blackbody_spd.name = 'The Sun - 5778K' multi_spd_plot((ASTM_G_173_spd, blackbody_spd), y_label='W / (sr m$^2$) / m', legend_location='upper right') print('\n') message_box('Plotting various "blackbody" spectral power distributions.') blackbody_spds = [
def plot_the_blue_sky(cmfs='CIE 1931 2 Degree Standard Observer', **kwargs): """ Plots the blue sky. Parameters ---------- cmfs : unicode, optional Standard observer colour matching functions. Other Parameters ---------------- \\**kwargs : dict, optional {:func:`colour.plotting.artist`, :func:`colour.plotting.plot_single_sd`, :func:`colour.plotting.plot_multi_colour_swatches`, :func:`colour.plotting.render`}, Please refer to the documentation of the previously listed definitions. Returns ------- tuple Current figure and axes. Examples -------- >>> plot_the_blue_sky() # doctest: +SKIP .. image:: ../_static/Plotting_Plot_The_Blue_Sky.png :align: center :alt: plot_the_blue_sky """ figure = plt.figure() figure.subplots_adjust(hspace=COLOUR_STYLE_CONSTANTS.geometry.short / 2) cmfs = first_item(filter_cmfs(cmfs).values()) ASTM_G_173_sd = ASTM_G_173_ETR.copy() rayleigh_sd = sd_rayleigh_scattering() ASTM_G_173_sd.align(rayleigh_sd.shape) sd = rayleigh_sd * ASTM_G_173_sd axes = figure.add_subplot(211) settings = { 'axes': axes, 'title': 'The Blue Sky - Synthetic Spectral Distribution', 'y_label': u'W / m-2 / nm-1', } settings.update(kwargs) settings['standalone'] = False plot_single_sd(sd, cmfs, **settings) axes = figure.add_subplot(212) x_label = ('The sky is blue because molecules in the atmosphere ' 'scatter shorter wavelengths more than longer ones.\n' 'The synthetic spectral distribution is computed as ' 'follows: ' '(ASTM G-173 ETR * Standard Air Rayleigh Scattering).') settings = { 'axes': axes, 'aspect': None, 'title': 'The Blue Sky - Colour', 'x_label': x_label, 'y_label': '', 'x_ticker': False, 'y_ticker': False, } settings.update(kwargs) settings['standalone'] = False blue_sky_color = XYZ_to_plotting_colourspace(sd_to_XYZ(sd)) figure, axes = plot_single_colour_swatch( ColourSwatch('', normalise_maximum(blue_sky_color)), **settings) settings = {'axes': axes, 'standalone': True} settings.update(kwargs) return render(**settings)
def the_blue_sky_plot(cmfs='CIE 1931 2 Degree Standard Observer', **kwargs): """ Plots the blue sky. Parameters ---------- cmfs : unicode, optional Standard observer colour matching functions. Other Parameters ---------------- \**kwargs : dict, optional {:func:`colour.plotting.render`}, Please refer to the documentation of the previously listed definition. Returns ------- Figure Current figure or None. Examples -------- >>> the_blue_sky_plot() # doctest: +SKIP """ canvas(**kwargs) cmfs, name = get_cmfs(cmfs), cmfs ASTM_G_173_spd = ASTM_G_173_ETR.copy() rayleigh_spd = rayleigh_scattering_spd() ASTM_G_173_spd.align(rayleigh_spd.shape) spd = rayleigh_spd * ASTM_G_173_spd matplotlib.pyplot.subplots_adjust(hspace=0.4) matplotlib.pyplot.figure(1) matplotlib.pyplot.subplot(211) settings = { 'title': 'The Blue Sky - Synthetic Spectral Power Distribution', 'y_label': u'W / m-2 / nm-1', 'standalone': False } settings.update(kwargs) single_spd_plot(spd, name, **settings) matplotlib.pyplot.subplot(212) settings = { 'title': 'The Blue Sky - Colour', 'x_label': ('The sky is blue because molecules in the atmosphere ' 'scatter shorter wavelengths more than longer ones.\n' 'The synthetic spectral power distribution is computed as ' 'follows: ' '(ASTM G-173 ETR * Standard Air Rayleigh Scattering).'), 'y_label': '', 'aspect': None, 'standalone': False } blue_sky_color = XYZ_to_sRGB(spectral_to_XYZ(spd)) single_colour_swatch_plot( ColourSwatch('', normalise_maximum(blue_sky_color)), **settings) settings = {'standalone': True} settings.update(kwargs) return render(**settings)
plot_multi_lightness_functions(['CIE 1976', 'Glasser 1958']) print('\n') message_box('Plotting various blackbody spectral radiance.') plot_blackbody_spectral_radiance( temperature=3500, blackbody='VY Canis Majoris') plot_blackbody_spectral_radiance(temperature=5778, blackbody='The Sun') plot_blackbody_spectral_radiance(temperature=12130, blackbody='Rigel') print('\n') message_box('Comparing theoretical and measured "Sun" spectral distributions.') # Arbitrary ASTM_G_173_ETR scaling factor calculated with # :func:`colour.sd_to_XYZ` definition. ASTM_G_173_sd = ASTM_G_173_ETR.copy() * 1.37905559e+13 ASTM_G_173_sd.interpolate( colour.SpectralShape(interval=5), interpolator=colour.LinearInterpolator) blackbody_sd = colour.sd_blackbody(5778, ASTM_G_173_sd.shape) blackbody_sd.name = 'The Sun - 5778K' plot_multi_sds((ASTM_G_173_sd, blackbody_sd), y_label='W / (sr m$^2$) / m') print('\n') message_box('Plotting various "blackbody" spectral distributions.') blackbody_sds = [ colour.sd_blackbody(i, colour.SpectralShape(0, 10000, 10)) for i in range(1000, 15000, 1000)