Esempio n. 1
0
 def test_coverage_2(self, verbose=False):
     ''' Another coverage test of illuminants. '''
     T_list = [0.0, 1.0, 100.0, 1000.0, 5778.0, 10000.0, 100000.0]
     for T in T_list:
         bb = illuminants.get_blackbody_illuminant (T)
         if verbose:
             print ('Blackbody Illuminant : %g K' % (T))
             print (str (bb))
Esempio n. 2
0
def figures ():
    '''Draw some plots of Rayleigh scattering.'''
    # Patch plots for some illuminants.
    rayleigh_patch_plot (
        [(illuminants.get_blackbody_illuminant (blackbody.SUN_TEMPERATURE), 'Sun')],
        'Rayleigh Scattering by the Sun', 'Rayleigh-PatchSun')

    rayleigh_patch_plot (
        [(illuminants.get_illuminant_D65 (), 'D65'),
        (illuminants.get_blackbody_illuminant (2000.0), '2000 K'),
        (illuminants.get_blackbody_illuminant (3500.0), '3500 K'),
        (illuminants.get_blackbody_illuminant (blackbody.SUN_TEMPERATURE), 'Sun'),
        (illuminants.get_blackbody_illuminant (6500.0), '6500 K'),
        (illuminants.get_blackbody_illuminant (15000.0), '15000 K')],
        'Rayleigh Scattering by Various Illuminants', 'Rayleigh-PatchVarious')

    # Scattered color vs blackbody illuminant temperature.
    T_list = numpy.linspace(1200.0, 16000.0, 300)
    rayleigh_color_vs_illuminant_temperature_plot (
        T_list, 'Rayleigh Scattering Sky Colors', 'Rayleigh-SkyColors')

    # Spectra for several illuminants.
    T_list = [2000.0, 3000.0, blackbody.SUN_TEMPERATURE, 6500.0, 11000.0, 15000.0]
    for T in T_list:
        T_label = '%dK' % (round(T))
        rayleigh_spectrum_plot (
            illuminants.get_blackbody_illuminant (T),
            'Rayleigh Scattering\nIlluminant %g K' % (T),
            'Rayleigh-Spectrum-%s' % (T_label))
Esempio n. 3
0
def figures():
    '''Draw some plots of Rayleigh scattering.'''
    # patch plots for some illuminants
    rayleigh_patch_plot([(illuminants.get_blackbody_illuminant(
        blackbody.SUN_TEMPERATURE), 'Sun')], 'Rayleigh Scattering by the Sun',
                        'Rayleigh-PatchSun')

    rayleigh_patch_plot(
        [(illuminants.get_illuminant_D65(), 'D65'),
         (illuminants.get_blackbody_illuminant(2000.0), '2000 K'),
         (illuminants.get_blackbody_illuminant(3500.0), '3500 K'),
         (illuminants.get_blackbody_illuminant(
             blackbody.SUN_TEMPERATURE), 'Sun'),
         (illuminants.get_blackbody_illuminant(6500.0), '6500 K'),
         (illuminants.get_blackbody_illuminant(15000.0), '15000 K')],
        'Rayleigh Scattering by Various Illuminants', 'Rayleigh-PatchVarious')

    # color vs illuminant temperature
    T_list = range(1200, 16000, 50)  # must be integers for range()
    rayleigh_color_vs_illuminant_temperature_plot(
        T_list, 'Rayleigh Scattering Sky Colors', 'Rayleigh-SkyColors')

    # spectra for several illuminants
    T_list = [
        2000.0, 3000.0, blackbody.SUN_TEMPERATURE, 6500.0, 11000.0, 15000.0
    ]
    for T in T_list:
        rayleigh_spectrum_plot(illuminants.get_blackbody_illuminant(T),
                               'Rayleigh Scattering\nIlluminant %g K' % (T),
                               'Rayleigh-Spectrum-%gK' % (T))
Esempio n. 4
0
def figures ():
    '''Draw some plots of Rayleigh scattering.'''
    # patch plots for some illuminants
    rayleigh_patch_plot (
        [(illuminants.get_blackbody_illuminant (blackbody.SUN_TEMPERATURE), 'Sun')],
        'Rayleigh Scattering by the Sun', 'Rayleigh-PatchSun')

    rayleigh_patch_plot (
        [(illuminants.get_illuminant_D65 (), 'D65'),
        (illuminants.get_blackbody_illuminant (2000.0), '2000 K'),
        (illuminants.get_blackbody_illuminant (3500.0), '3500 K'),
        (illuminants.get_blackbody_illuminant (blackbody.SUN_TEMPERATURE), 'Sun'),
        (illuminants.get_blackbody_illuminant (6500.0), '6500 K'),
        (illuminants.get_blackbody_illuminant (15000.0), '15000 K')],
        'Rayleigh Scattering by Various Illuminants', 'Rayleigh-PatchVarious')

    # color vs illuminant temperature
    T_list = range (1200, 16000, 50)    # must be integers for range()
    rayleigh_color_vs_illuminant_temperature_plot (T_list, 'Rayleigh Scattering Sky Colors', 'Rayleigh-SkyColors')

    # spectra for several illuminants
    T_list = [2000.0, 3000.0, blackbody.SUN_TEMPERATURE, 6500.0, 11000.0, 15000.0]
    for T in T_list:
        rayleigh_spectrum_plot (
            illuminants.get_blackbody_illuminant (T),
            'Rayleigh Scattering\nIlluminant %g K' % (T),
            'Rayleigh-Spectrum-%gK' % (T))
Esempio n. 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 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')
Esempio n. 6
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')
Esempio n. 7
0
def test(verbose=0):
    '''Mainly call some functions.'''
    D65 = illuminants.get_illuminant_D65()
    if verbose >= 1:
        print('Illuminant D65')
        print(str(D65))
    A = illuminants.get_illuminant_A()
    if verbose >= 1:
        print('Illuminant A')
        print(str(A))
    const = illuminants.get_constant_illuminant()
    if verbose >= 1:
        print('Constant Illuminant')
        print(str(const))

    T_list = [0.0, 1.0, 100.0, 1000.0, 5778.0, 10000.0, 100000.0]
    for T in T_list:
        bb = illuminants.get_blackbody_illuminant(T)
        if verbose >= 1:
            print('Blackbody Illuminant : %g K' % T)
            print(str(bb))
    print('test_illuminants.test() passed.')
Esempio n. 8
0
def test (verbose=0):
    '''Mainly call some functions.'''
    D65 = illuminants.get_illuminant_D65()
    if verbose >= 1:
        print 'Illuminant D65'
        print str (D65)
    A = illuminants.get_illuminant_A()
    if verbose >= 1:
        print 'Illuminant A'
        print str (A)
    const = illuminants.get_constant_illuminant()
    if verbose >= 1:
        print 'Constant Illuminant'
        print str (const)

    T_list = [0.0, 1.0, 100.0, 1000.0, 5778.0, 10000.0, 100000.0]
    for T in T_list:
        bb = illuminants.get_blackbody_illuminant (T)
        if verbose >= 1:
            print 'Blackbody Illuminant : %g K' % (T)
            print str (bb)
    print 'test_illuminants.test() passed.'