Example #1
0
"""Showcases *Colour Rendering Index* (CRI) computations."""

from pprint import pprint

import colour
from colour.utilities import message_box

message_box("Colour Rendering Index Computations")

message_box('Computing the "F2" illuminant "Colour Rendering Index (CRI)".')
print(colour.colour_rendering_index(colour.SDS_ILLUMINANTS["FL2"]))

print("\n")

message_box(
    'Computing the "F2" illuminant "Colour Rendering Index" (CRI) with '
    "detailed output data.")
pprint(
    colour.colour_rendering_index(colour.SDS_ILLUMINANTS["FL2"],
                                  additional_data=True))

print("\n")

message_box(
    'Computing the "CIE Standard Illuminant A" "Colour Rendering Index (CRI)".'
)
print(colour.colour_rendering_index(colour.SDS_ILLUMINANTS["A"]))

print("\n")

message_box('Computing the sample light "Colour Rendering Index (CRI)".')
Example #2
0
# -*- coding: utf-8 -*-
"""
Showcases *Colour Rendering Index* (CRI) computations.
"""

from pprint import pprint

import colour
from colour.utilities import message_box

message_box('Colour Rendering Index Computations')

message_box('Computing "F2" illuminant "Colour Rendering Index (CRI)".')
print(colour.colour_rendering_index(colour.ILLUMINANTS_SDS['FL2']))

print('\n')

message_box(('Computing "F2" illuminant "Colour Rendering Index" (CRI) with '
             'detailed output data.'))
pprint(
    colour.colour_rendering_index(colour.ILLUMINANTS_SDS['FL2'],
                                  additional_data=True))

print('\n')

message_box('Computing "CIE Standard Illuminant A" '
            '"Colour Rendering Index (CRI)".')
print(colour.colour_rendering_index(colour.ILLUMINANTS_SDS['A']))

print('\n')
Example #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Showcases *Colour Rendering Index* (CRI) computations.
"""

from pprint import pprint

import colour
from colour.utilities.verbose import message_box

message_box('Colour Rendering Index Computations')

message_box('Computing "F2" illuminant "Colour Rendering Index (CRI)".')
print(colour.colour_rendering_index(colour.ILLUMINANTS_RELATIVE_SPDS['F2']))

print('\n')

message_box(('Computing "F2" illuminant "Colour Rendering Index" (CRI) with '
             'detailed output data.'))
pprint(
    colour.colour_rendering_index(
        colour.ILLUMINANTS_RELATIVE_SPDS['F2'], additional_data=True))

print('\n')

message_box('Computing "CIE Standard Illuminant A" '
            '"Colour Rendering Index (CRI)".')
print(colour.colour_rendering_index(colour.ILLUMINANTS_RELATIVE_SPDS['A']))

print('\n')
Example #4
0
# -*- coding: utf-8 -*-
"""
Showcases *Colour Rendering Index* (CRI) computations.
"""

from pprint import pprint

import colour
from colour.utilities import message_box

message_box('Colour Rendering Index Computations')

message_box('Computing "F2" illuminant "Colour Rendering Index (CRI)".')
print(colour.colour_rendering_index(colour.SDS_ILLUMINANTS['FL2']))

print('\n')

message_box(('Computing "F2" illuminant "Colour Rendering Index" (CRI) with '
             'detailed output data.'))
pprint(
    colour.colour_rendering_index(colour.SDS_ILLUMINANTS['FL2'],
                                  additional_data=True))

print('\n')

message_box('Computing "CIE Standard Illuminant A" '
            '"Colour Rendering Index (CRI)".')
print(colour.colour_rendering_index(colour.SDS_ILLUMINANTS['A']))

print('\n')
Example #5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""
Showcases colour rendering index computations.
"""

from pprint import pprint

import colour
from colour.utilities.verbose import message_box

message_box('Colour Rendering Index Computations')

message_box('Computing "F2" illuminant colour rendering index.')
print(colour.colour_rendering_index(
    colour.ILLUMINANTS_RELATIVE_SPDS.get('F2')))

print('\n')

message_box(('Computing "F2" illuminant colour rendering index with detailed '
             'output data.'))
pprint(colour.colour_rendering_index(
    colour.ILLUMINANTS_RELATIVE_SPDS.get('F2'),
    additional_data=True))

print('\n')

message_box('Computing "CIE Standard Illuminant A" colour rendering index.')
print(colour.colour_rendering_index(
    colour.ILLUMINANTS_RELATIVE_SPDS.get('A')))
Example #6
0
def index():
    cmfs = CMFS['CIE 1931 2 Degree Standard Observer']
    with open('test.txt') as f:
        data = pd.read_csv(f, sep="\t" or ' ' or ',', header=None)
        f.close()
    w = [i[0] for i in data.values]
    s = [i[1] for i in data.values]
    data_formated = dict(zip(w, s))
    spd = SpectralPowerDistribution('Sample', data_formated)
    b = single_spd_plot(spd,
                        standalone=False,
                        figure_size=(5, 5),
                        title='Spectrum')
    figfile_b = StringIO()
    b.savefig(figfile_b, format='svg')
    figfile_b.seek(0)
    figdata_svg_b = '<svg' + figfile_b.getvalue().split('<svg')[1]
    b.clf()
    plot.close(b)
    illuminant = ILLUMINANTS_RELATIVE_SPDS['D50']
    XYZ = spectral_to_XYZ(spd, cmfs, illuminant)
    xy = XYZ_to_xy(XYZ)
    print(xy)
    cct = xy_to_CCT(xy)
    print(cct)
    cri = colour_rendering_index(spd, additional_data=True)
    print(cri.Q_a)
    Q_as = cri.Q_as
    y = [s[1].Q_a for s in sorted(Q_as.items(), key=lambda s: s[0])]
    print(y)
    single_spd_colour_rendering_index_bars_plot(spd,
                                                standalone=False,
                                                figure_size=(7, 7),
                                                title='Colour rendering index')
    c = plot.gcf()
    figfile_c = StringIO()
    c.savefig(figfile_c, format='svg')
    figfile_c.seek(0)
    figdata_svg_c = '<svg' + figfile_c.getvalue().split('<svg')[1]
    c.clf()
    plot.close(c)

    CIE_1931_chromaticity_diagram_plot(standalone=False,
                                       figure_size=(6, 5),
                                       grid=False,
                                       title='CIE 1931 Chromaticity Diagram',
                                       bounding_box=(-0.1, 0.9, -0.05, 0.95))
    x, y = xy
    pylab.plot(x, y, 'o-', color='white')
    pylab.annotate((("%.4f" % x), ("%.4f" % y)),
                   xy=xy,
                   xytext=(-50, 30),
                   textcoords='offset points',
                   arrowprops=dict(arrowstyle='->',
                                   connectionstyle='arc3, rad=-0.2'))

    a = plot.gcf()
    figfile = StringIO()
    a.savefig(figfile, format='svg')
    figfile.seek(0)
    figdata_svg = '<svg' + figfile.getvalue().split('<svg')[1]
    a.clf()
    plot.close(a)
    del a, b, c
    # pprint.pprint(figdata_svg)
    return render_template('index.html',
                           spd=figdata_svg_b,
                           result=figdata_svg,
                           colour_rendering_index=figdata_svg_c)
Example #7
0
# -*- coding: utf-8 -*-
"""
Showcases *Colour Rendering Index* (CRI) computations.
"""

from pprint import pprint

import colour
from colour.utilities import message_box

message_box('Colour Rendering Index Computations')

message_box('Computing "F2" illuminant "Colour Rendering Index (CRI)".')
print(colour.colour_rendering_index(colour.ILLUMINANTS_SDS['FL2']))

print('\n')

message_box(('Computing "F2" illuminant "Colour Rendering Index" (CRI) with '
             'detailed output data.'))
pprint(
    colour.colour_rendering_index(
        colour.ILLUMINANTS_SDS['FL2'], additional_data=True))

print('\n')

message_box('Computing "CIE Standard Illuminant A" '
            '"Colour Rendering Index (CRI)".')
print(colour.colour_rendering_index(colour.ILLUMINANTS_SDS['A']))

print('\n')