Skip to content
This repository was archived by the owner on Nov 24, 2024. It is now read-only.

Commit 603e8e8

Browse files
committed
Merge branch 'feature/v0.1.7' into develop
2 parents 7f83201 + 78ea0b2 commit 603e8e8

11 files changed

+150
-117
lines changed

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ This Code of Conduct applies within all project spaces, and it also applies when
3636
## Enforcement
3737

3838

39-
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting Thomas Mansencal and Michael Mauderer via email at thomas[email protected] and michael@mauderer.me respectively. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
39+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting Thomas Mansencal and Michael Mauderer via email at thomas@colour-science.org and michael@colour-science.org respectively. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
4040

4141
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project’s leadership.
4242

CONTRIBUTORS.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ About
1212
-----
1313

1414
| **Colour - Analysis** by Colour Developers
15-
| Copyright © 2018-2019 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
15+
| Copyright © 2018-2020 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
1616
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
1717
| `https://github.com/colour-science/colour-analysis-three.js <https://github.com/colour-science/colour-analysis-three.js>`__

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
FROM python:3.6
1+
FROM python:3.8
22

33
WORKDIR /tmp
44
COPY ./requirements.txt /tmp
5-
RUN pip install -r requirements.txt
5+
RUN pip install -r requirements.txt \
6+
&& rm /tmp/requirements.txt \
7+
&& python -c "import imageio;imageio.plugins.freeimage.download()"
68

79
ARG CACHE_DATE
810

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ About
5050
-----
5151

5252
| **Colour - Analysis** by Colour Developers
53-
| Copyright © 2018-2019 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
53+
| Copyright © 2018-2020 – Colour Developers – `colour-[email protected] <colour-[email protected]>`__
5454
| This software is released under terms of New BSD License: https://opensource.org/licenses/BSD-3-Clause
5555
| `https://github.com/colour-science/colour-analysis-three.js <https://github.com/colour-science/colour-analysis-three.js>`__

app.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88

99
import json
1010
import os
11+
from cachelib import SimpleCache
1112
from flask import Flask, Response, render_template, request
1213
from flask_caching import Cache
1314
from flask_compress import Compress
14-
from werkzeug.contrib.cache import SimpleCache
1515

1616
from colour.utilities import domain_range_scale
1717

@@ -23,17 +23,17 @@
2323
visible_spectrum_visual)
2424

2525
__author__ = 'Colour Developers'
26-
__copyright__ = 'Copyright (C) 2018-2019 - Colour Developers'
26+
__copyright__ = 'Copyright (C) 2018-2020 - Colour Developers'
2727
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
2828
__maintainer__ = 'Colour Developers'
29-
__email__ = 'colour-[email protected]'
29+
__email__ = 'colour-[email protected]'
3030
__status__ = 'Production'
3131

3232
__application_name__ = 'Colour - Analysis'
3333

3434
__major_version__ = '0'
3535
__minor_version__ = '1'
36-
__change_version__ = '6'
36+
__change_version__ = '7'
3737
__version__ = '.'.join(
3838
(__major_version__,
3939
__minor_version__,

colour_analysis.py

Lines changed: 81 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,28 @@
77
loaded by "Three.js".
88
"""
99

10-
from __future__ import division
11-
1210
import json
1311
import numpy as np
1412
import os
1513
import re
16-
from werkzeug.contrib.cache import SimpleCache
14+
from cachelib import SimpleCache
1715

18-
from colour import (ILLUMINANTS, CCTF_DECODINGS, Lab_to_XYZ, LCHab_to_Lab,
19-
POINTER_GAMUT_DATA, POINTER_GAMUT_ILLUMINANT,
16+
from colour import (CCS_ILLUMINANTS, CCTF_DECODINGS, Lab_to_XYZ, LCHab_to_Lab,
2017
RGB_COLOURSPACES, RGB_to_RGB, RGB_to_XYZ, XYZ_to_RGB,
2118
XYZ_to_JzAzBz, XYZ_to_OSA_UCS, convert,
2219
is_within_pointer_gamut, read_image)
23-
from colour.models import linear_function
20+
from colour.models import (CCS_ILLUMINANT_POINTER_GAMUT,
21+
DATA_POINTER_GAMUT_VOLUME, linear_function)
2422
from colour.plotting import filter_cmfs, filter_RGB_colourspaces
2523
from colour.utilities import (CaseInsensitiveMapping, as_float_array,
2624
first_item, normalise_maximum, tsplit, tstack)
2725
from colour.volume import XYZ_outer_surface
2826

2927
__author__ = 'Colour Developers'
30-
__copyright__ = 'Copyright (C) 2018-2019 - Colour Developers'
28+
__copyright__ = 'Copyright (C) 2018-2020 - Colour Developers'
3129
__license__ = 'New BSD License - https://opensource.org/licenses/BSD-3-Clause'
3230
__maintainer__ = 'Colour Developers'
33-
__email__ = 'colour-[email protected]'
31+
__email__ = 'colour-[email protected]'
3432
__status__ = 'Production'
3533

3634
__all__ = [
@@ -88,16 +86,16 @@
8886
COLOURSPACE_MODELS = ('CAM02LCD', 'CAM02SCD', 'CAM02UCS', 'CAM16LCD',
8987
'CAM16SCD', 'CAM16UCS', 'CIE XYZ', 'CIE xyY', 'CIE Lab',
9088
'CIE Luv', 'CIE UCS', 'CIE UVW', 'DIN 99', 'Hunter Lab',
91-
'Hunter Rdab', 'ICTCP', 'IPT', 'JzAzBz', 'OSA UCS',
92-
'hdr-CIELAB', 'hdr-IPT')
89+
'Hunter Rdab', 'ICTCP', 'IGPGTG', 'IPT', 'JzAzBz',
90+
'OSA UCS', 'hdr-CIELAB', 'hdr-IPT')
9391
"""
9492
Reference colourspace models defining available colour transformations from
9593
CIE XYZ tristimulus values.
9694
9795
COLOURSPACE_MODELS : tuple
9896
**{'CAM02LCD', 'CAM02SCD', 'CAM02UCS', 'CAM16LCD', 'CAM16SCD', 'CAM16UCS',
9997
'CIE XYZ', 'CIE xyY', 'CIE Lab', 'CIE Luv', 'CIE UCS', 'CIE UVW', 'DIN 99',
100-
'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IPT', 'JzAzBz', 'OSA UCS',
98+
'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IGPGTG', 'IPT', 'JzAzBz', 'OSA UCS',
10199
'hdr-CIELAB', 'hdr-IPT'}**
102100
"""
103101

@@ -118,6 +116,7 @@
118116
'Hunter Lab': ('a', 'L', 'b'),
119117
'Hunter Rdab': ('a', 'Rd', 'b'),
120118
'ICTCP': ('CT', 'I', 'CP'),
119+
'IGPGTG': ('PG', 'IG', 'TG'),
121120
'IPT': ('P', 'I', 'T'),
122121
'JzAzBz': ('Az', 'Jz', 'Bz'),
123122
'OSA UCS': ('j', 'J', 'g'),
@@ -131,7 +130,7 @@
131130
COLOURSPACE_MODELS : dict
132131
**{'CAM02LCD', 'CAM02SCD', 'CAM02UCS', 'CAM16LCD', 'CAM16SCD', 'CAM16UCS',
133132
'CIE XYZ', 'CIE xyY', 'CIE Lab', 'CIE Luv', 'CIE UCS', 'CIE UVW', 'DIN 99',
134-
'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IPT', 'JzAzBz', 'OSA UCS',
133+
'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IGPGTG', 'IPT', 'JzAzBz', 'OSA UCS',
135134
'hdr-CIELAB', 'hdr-IPT'}**
136135
"""
137136

@@ -174,16 +173,16 @@
174173
COLOURSPACE_MODEL : unicode
175174
**{'CAM02LCD', 'CAM02SCD', 'CAM02UCS', 'CAM16LCD', 'CAM16SCD', 'CAM16UCS',
176175
'CIE XYZ', 'CIE xyY', 'CIE Lab', 'CIE Luv', 'CIE UCS', 'CIE UVW', 'DIN 99',
177-
'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IPT', 'JzAzBz', 'OSA UCS',
176+
'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IGPGTG', 'IPT', 'JzAzBz', 'OSA UCS',
178177
'hdr-CIELAB', 'hdr-IPT'}**
179178
"""
180179

181-
POINTER_GAMUT_DATA = Lab_to_XYZ(
182-
LCHab_to_Lab(POINTER_GAMUT_DATA), POINTER_GAMUT_ILLUMINANT)
180+
DATA_POINTER_GAMUT = Lab_to_XYZ(
181+
LCHab_to_Lab(DATA_POINTER_GAMUT_VOLUME), CCS_ILLUMINANT_POINTER_GAMUT)
183182
"""
184183
Pointer's Gamut data converted to *CIE XYZ* tristimulus values.
185184
186-
POINTER_GAMUT_DATA : ndarray
185+
DATA_POINTER_GAMUT : ndarray
187186
"""
188187

189188
IMAGE_CACHE = SimpleCache(default_timeout=60 * 24 * 7)
@@ -246,8 +245,8 @@ def XYZ_to_colourspace_model(XYZ, illuminant, model, **kwargs):
246245
model : unicode
247246
**{'CAM02LCD', 'CAM02SCD', 'CAM02UCS', 'CAM16LCD', 'CAM16SCD',
248247
'CAM16UCS', 'CIE XYZ', 'CIE xyY', 'CIE Lab', 'CIE Luv', 'CIE UCS',
249-
'CIE UVW', 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IPT',
250-
'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT'}**,
248+
'CIE UVW', 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IGPGTG',
249+
'IPT', 'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT'}**,
251250
Colourspace model to convert the *CIE XYZ* tristimulus values to.
252251
253252
Other Parameters
@@ -289,8 +288,8 @@ def colourspace_model_axis_reorder(a, model=None):
289288
model : unicode, optional
290289
**{'CAM02LCD', 'CAM02SCD', 'CAM02UCS', 'CAM16LCD', 'CAM16SCD',
291290
'CAM16UCS', 'CIE XYZ', 'CIE xyY', 'CIE Lab', 'CIE Luv', 'CIE UCS',
292-
'CIE UVW', 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IPT',
293-
'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT'}**,
291+
'CIE UVW', 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IGPGTG',
292+
'IPT', 'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT'}**,
294293
Colourspace model.
295294
296295
Returns
@@ -306,8 +305,8 @@ def colourspace_model_axis_reorder(a, model=None):
306305
a = tstack([j, k, i])
307306
elif model in ('CAM02LCD', 'CAM02SCD', 'CAM02UCS', 'CAM16LCD', 'CAM16SCD',
308307
'CAM16UCS', 'CIE Lab', 'CIE LCHab', 'CIE Luv', 'CIE LCHuv',
309-
'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IPT',
310-
'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT'):
308+
'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IGPGTG',
309+
'IPT', 'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT'):
311310
a = tstack([k, i, j])
312311

313312
return a
@@ -324,8 +323,8 @@ def colourspace_model_faces_reorder(a, model=None):
324323
model : unicode, optional
325324
**{'CAM02LCD', 'CAM02SCD', 'CAM02UCS', 'CAM16LCD', 'CAM16SCD',
326325
'CAM16UCS', 'CIE XYZ', 'CIE xyY', 'CIE Lab', 'CIE Luv', 'CIE UCS',
327-
'CIE UVW', 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IPT',
328-
'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT'}**,
326+
'CIE UVW', 'DIN 99', 'Hunter Lab', 'Hunter Rdab', 'ICTCP', 'IGPGTG',
327+
'IPT', 'JzAzBz', 'OSA UCS', 'hdr-CIELAB', 'hdr-IPT'}**,
329328
Colourspace model.
330329
331330
Returns
@@ -384,13 +383,13 @@ def buffer_geometry(**kwargs):
384383
"""
385384
Returns given geometry formatted as *JSON* compatible with *Three.js*
386385
`BufferGeometryLoader <https://threejs.org/docs/#api/loaders/\
387-
BufferGeometryLoader>`_.
386+
BufferGeometryLoader>`__.
388387
389388
Other Parameters
390389
----------------
391390
\\**kwargs : dict, optional
392391
Valid attributes from `BufferGeometryLoader <https://threejs.org/docs/\
393-
#api/loaders/BufferGeometryLoader>`_.
392+
#api/loaders/BufferGeometryLoader>`__.
394393
395394
Returns
396395
-------
@@ -644,7 +643,8 @@ def create_box(width=1,
644643
colors = np.hstack([
645644
np.reshape(
646645
np.interp(colors, (np.min(colors), np.max(colors)), (0, 1)),
647-
positions.shape),
646+
positions.shape,
647+
),
648648
np.ones((positions.shape[0], 1))
649649
])
650650

@@ -733,8 +733,12 @@ def image_data(path,
733733

734734
if out_of_pointer_gamut:
735735
O_PG = is_within_pointer_gamut(
736-
RGB_to_XYZ(RGB, colourspace.whitepoint, colourspace.whitepoint,
737-
colourspace.RGB_to_XYZ_matrix)).astype(np.int_)
736+
RGB_to_XYZ(
737+
RGB,
738+
colourspace.whitepoint,
739+
colourspace.whitepoint,
740+
colourspace.matrix_RGB_to_XYZ,
741+
)).astype(np.int_)
738742
O_PG = 1 - O_PG
739743
RGB[O_PG != 1] = 0
740744
RGB[O_PG == 1] = 1
@@ -788,11 +792,18 @@ def RGB_colourspace_volume_visual(colourspace=PRIMARY_COLOURSPACE,
788792
np.reshape(cube[1], (-1, 1)), colourspace_model)
789793
RGB = cube[0]['colour']
790794

791-
XYZ = RGB_to_XYZ(vertices, colourspace.whitepoint, colourspace.whitepoint,
792-
colourspace.RGB_to_XYZ_matrix)
795+
XYZ = RGB_to_XYZ(
796+
vertices,
797+
colourspace.whitepoint,
798+
colourspace.whitepoint,
799+
colourspace.matrix_RGB_to_XYZ,
800+
)
793801
vertices = colourspace_model_axis_reorder(
794-
XYZ_to_colourspace_model(XYZ, colourspace.whitepoint,
795-
colourspace_model), colourspace_model)
802+
XYZ_to_colourspace_model(
803+
XYZ,
804+
colourspace.whitepoint,
805+
colourspace_model,
806+
), colourspace_model)
796807

797808
return buffer_geometry(position=vertices, color=RGB, index=faces)
798809

@@ -884,17 +895,28 @@ def RGB_image_scatter_visual(path,
884895

885896
if out_of_pointer_gamut:
886897
O_PG = is_within_pointer_gamut(
887-
RGB_to_XYZ(RGB, colourspace.whitepoint, colourspace.whitepoint,
888-
colourspace.RGB_to_XYZ_matrix)).astype(np.int_)
898+
RGB_to_XYZ(
899+
RGB,
900+
colourspace.whitepoint,
901+
colourspace.whitepoint,
902+
colourspace.matrix_RGB_to_XYZ,
903+
)).astype(np.int_)
889904
O_PG = 1 - O_PG
890905
RGB = RGB[O_PG == 1]
891906

892-
XYZ = RGB_to_XYZ(RGB, colourspace.whitepoint, colourspace.whitepoint,
893-
colourspace.RGB_to_XYZ_matrix)
907+
XYZ = RGB_to_XYZ(
908+
RGB,
909+
colourspace.whitepoint,
910+
colourspace.whitepoint,
911+
colourspace.matrix_RGB_to_XYZ,
912+
)
894913

895914
vertices = colourspace_model_axis_reorder(
896-
XYZ_to_colourspace_model(XYZ, colourspace.whitepoint,
897-
colourspace_model), colourspace_model)
915+
XYZ_to_colourspace_model(
916+
XYZ,
917+
colourspace.whitepoint,
918+
colourspace_model,
919+
), colourspace_model)
898920

899921
if (out_of_primary_colourspace_gamut or
900922
out_of_secondary_colourspace_gamut or out_of_pointer_gamut):
@@ -934,12 +956,19 @@ def spectral_locus_visual(colourspace=PRIMARY_COLOURSPACE,
934956
XYZ = np.vstack([XYZ, XYZ[0, ...]])
935957

936958
vertices = colourspace_model_axis_reorder(
937-
XYZ_to_colourspace_model(XYZ, colourspace.whitepoint,
938-
colourspace_model), colourspace_model)
959+
XYZ_to_colourspace_model(
960+
XYZ,
961+
colourspace.whitepoint,
962+
colourspace_model,
963+
), colourspace_model)
939964

940965
RGB = normalise_maximum(
941-
XYZ_to_RGB(XYZ, colourspace.whitepoint, colourspace.whitepoint,
942-
colourspace.XYZ_to_RGB_matrix),
966+
XYZ_to_RGB(
967+
XYZ,
968+
colourspace.whitepoint,
969+
colourspace.whitepoint,
970+
colourspace.matrix_XYZ_to_RGB,
971+
),
943972
axis=-1)
944973

945974
return buffer_geometry(position=vertices, color=RGB)
@@ -960,15 +989,16 @@ def pointer_gamut_visual(colourspace_model='CIE xyY'):
960989
*Pointer's Gamut* visual geometry formatted as *JSON*.
961990
"""
962991

963-
pointer_gamut_data = np.reshape(POINTER_GAMUT_DATA, (16, -1, 3))
992+
data_pointer_gamut = np.reshape(DATA_POINTER_GAMUT, (16, -1, 3))
964993
vertices = []
965994
for i in range(16):
966995
section = colourspace_model_axis_reorder(
967996
XYZ_to_colourspace_model(
968997
np.vstack(
969-
[pointer_gamut_data[i], pointer_gamut_data[i][0, ...]]),
970-
POINTER_GAMUT_ILLUMINANT, colourspace_model),
971-
colourspace_model)
998+
[data_pointer_gamut[i], data_pointer_gamut[i][0, ...]]),
999+
CCS_ILLUMINANT_POINTER_GAMUT,
1000+
colourspace_model,
1001+
), colourspace_model)
9721002

9731003
vertices.append(list(zip(section, section[1:])))
9741004

@@ -995,8 +1025,10 @@ def visible_spectrum_visual(colourspace_model='CIE xyY'):
9951025
XYZ = XYZ_outer_surface()
9961026
vertices = colourspace_model_axis_reorder(
9971027
XYZ_to_colourspace_model(
998-
XYZ, ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['E'],
999-
colourspace_model), colourspace_model)
1028+
XYZ,
1029+
CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['E'],
1030+
colourspace_model,
1031+
), colourspace_model)
10001032

10011033
vertices = as_float_array(list(zip(vertices, vertices[1:])))
10021034

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "colour-analysis",
3-
"version": "0.1.6",
3+
"version": "0.1.7",
44
"description": "Colour - Analysis",
55
"private": true,
66
"scripts": {

0 commit comments

Comments
 (0)