Example #1
0
def thinfilm_color_vs_thickness_plot(n1, n2, n3, thickness_nm_list, illuminant,
                                     title, filename):
    '''Plot the color of the thin film for the specfied thicknesses [nm].'''
    num_thick = len(thickness_nm_list)
    rgb_list = numpy.empty((num_thick, 3))
    for i in xrange(0, num_thick):
        film = thin_film(n1, n2, n3, thickness_nm_list[i])
        xyz = film.illuminated_color(illuminant)
        rgb_list[i] = colormodels.rgb_from_xyz(xyz)
    plots.color_vs_param_plot(thickness_nm_list,
                              rgb_list,
                              title,
                              filename,
                              xlabel=r'Thickness (nm)',
                              ylabel=r'RGB Color')
Example #2
0
def thinfilm_color_vs_thickness_plot (n1, n2, n3, thickness_nm_list, illuminant, title, filename):
    '''Plot the color of the thin film for the specfied thicknesses [nm].'''
    films = create_thin_films(n1, n2, n3, thickness_nm_list)
    num_films = len (films)
    rgb_list = numpy.empty ((num_films, 3))
    for i in range (0, num_films):
        film = films[i]
        xyz = film.illuminated_color (illuminant)
        rgb_list [i] = colormodels.rgb_from_xyz (xyz)
    plots.color_vs_param_plot (
        thickness_nm_list,
        rgb_list,
        title,
        filename,
        xlabel = r'Thickness (nm)',
        ylabel = r'RGB Color')
Example #3
0
def blackbody_color_vs_temperature_plot(T_list, title, filename):
    '''Draw a color vs temperature plot for the given temperature range.'''
    num_T = len(T_list)
    rgb_list = numpy.empty((num_T, 3))
    for i in xrange(0, num_T):
        T_i = T_list[i]
        xyz = blackbody_color(T_i)
        rgb_list[i] = colormodels.rgb_from_xyz(xyz)
    # note that b and g become negative for low T - MatPlotLib skips those on the semilog plot.
    plots.color_vs_param_plot(T_list,
                              rgb_list,
                              title,
                              filename,
                              plotfunc=pylab.semilogy,
                              tight=True,
                              xlabel=r'Temperature (K)',
                              ylabel=r'RGB Color')
Example #4
0
def rayleigh_color_vs_illuminant_temperature_plot(T_list, title, filename):
    '''Make a plot of the Rayleigh scattered color vs. temperature of blackbody illuminant.'''
    num_T = len(T_list)
    rgb_list = numpy.empty((num_T, 3))
    for i in xrange(0, num_T):
        T_i = T_list[i]
        illuminant = illuminants.get_blackbody_illuminant(T_i)
        xyz = rayleigh_illuminated_color(illuminant)
        rgb_list[i] = colormodels.rgb_from_xyz(xyz)
    plots.color_vs_param_plot(T_list,
                              rgb_list,
                              title,
                              filename,
                              tight=True,
                              plotfunc=pylab.plot,
                              xlabel=r'Illuminant Temperature (K)',
                              ylabel=r'RGB Color')
Example #5
0
def rayleigh_color_vs_illuminant_temperature_plot (T_list, title, filename):
    '''Make a plot of the Rayleigh scattered color vs. temperature of blackbody illuminant.'''
    num_T = len (T_list)
    rgb_list = numpy.empty ((num_T, 3))
    for i in range (0, num_T):
        T_i = T_list [i]
        illuminant = illuminants.get_blackbody_illuminant (T_i)
        xyz = rayleigh_illuminated_color (illuminant)
        rgb_list [i] = colormodels.rgb_from_xyz (xyz)
    plots.color_vs_param_plot (
        T_list,
        rgb_list,
        title,
        filename,
        tight = True,
        plotfunc = pylab.plot,
        xlabel = r'Illuminant Temperature (K)',
        ylabel = r'RGB Color')
Example #6
0
def blackbody_color_vs_temperature_plot (T_list, title, filename):
    '''Draw a color vs temperature plot for the given temperature range.'''
    num_T = len (T_list)
    rgb_list = numpy.empty ((num_T, 3))
    for i in xrange (0, num_T):
        T_i = T_list [i]
        xyz = blackbody_color (T_i)
        rgb_list [i] = colormodels.rgb_from_xyz (xyz)
    # note that b and g become negative for low T - MatPlotLib skips those on the semilog plot.
    plots.color_vs_param_plot (
        T_list,
        rgb_list,
        title,
        filename,
        plotfunc = pylab.semilogy,
        tight = True,
        xlabel = r'Temperature (K)',
        ylabel = r'RGB Color')