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

[pre-commit.ci] pre-commit autoupdate #16

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
repos:
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.8
- repo: https://github.com/PyCQA/flake8
rev: 7.1.1
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-yapf
rev: v0.23.0
- repo: https://github.com/google/yapf
rev: v0.43.0
hooks:
- id: yapf
36 changes: 18 additions & 18 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ def image_data_response(image):
args.get('outOfPrimaryColourspaceGamut', False)),
out_of_secondary_colourspace_gamut=_bool_to_bool(
args.get('outOfSecondaryColourspaceGamut', False)),
out_of_pointer_gamut=_bool_to_bool(
args.get('outOfPointerGamut', False)),
out_of_pointer_gamut=_bool_to_bool(args.get('outOfPointerGamut',
False)),
saturate=_bool_to_bool(args.get('saturate', False)))

response = Response(json_data, status=200, mimetype='application/json')
Expand Down Expand Up @@ -306,8 +306,8 @@ def RGB_image_scatter_visual_response(image):
args.get('outOfPrimaryColourspaceGamut', False)),
out_of_secondary_colourspace_gamut=_bool_to_bool(
args.get('outOfSecondaryColourspaceGamut', False)),
out_of_pointer_gamut=_bool_to_bool(
args.get('outOfPointerGamut', False)),
out_of_pointer_gamut=_bool_to_bool(args.get('outOfPointerGamut',
False)),
sub_sampling=int(args.get('subSampling', 25)),
saturate=_bool_to_bool(args.get('saturate', False)),
)
Expand Down Expand Up @@ -355,8 +355,8 @@ def pointer_gamut_visual_response():
"""

args = request.args
json_data = pointer_gamut_visual(
colourspace_model=args.get('colourspaceModel', COLOURSPACE_MODEL), )
json_data = pointer_gamut_visual(colourspace_model=args.get(
'colourspaceModel', COLOURSPACE_MODEL), )

response = Response(json_data, status=200, mimetype='application/json')
response.headers['X-Content-Length'] = len(json_data)
Expand All @@ -377,8 +377,8 @@ def visible_spectrum_visual_response():
"""

args = request.args
json_data = visible_spectrum_visual(
colourspace_model=args.get('colourspaceModel', COLOURSPACE_MODEL), )
json_data = visible_spectrum_visual(colourspace_model=args.get(
'colourspaceModel', COLOURSPACE_MODEL), )

response = Response(json_data, status=200, mimetype='application/json')
response.headers['X-Content-Length'] = len(json_data)
Expand All @@ -397,16 +397,16 @@ def index():
Index response.
"""

return render_template(
'index.html',
colour_analysis_js=os.environ.get('COLOUR_ANALYSIS_JS',
'/static/js/colour-analysis.js'),
image=sorted(os.listdir(IMAGES_DIRECTORY))[0],
primary_colourspace=PRIMARY_COLOURSPACE,
secondary_colourspace=SECONDARY_COLOURSPACE,
image_colourspace=IMAGE_COLOURSPACE,
image_decoding_cctf=IMAGE_CCTF_DECODING,
colourspace_model=COLOURSPACE_MODEL)
return render_template('index.html',
colour_analysis_js=os.environ.get(
'COLOUR_ANALYSIS_JS',
'/static/js/colour-analysis.js'),
image=sorted(os.listdir(IMAGES_DIRECTORY))[0],
primary_colourspace=PRIMARY_COLOURSPACE,
secondary_colourspace=SECONDARY_COLOURSPACE,
image_colourspace=IMAGE_COLOURSPACE,
image_decoding_cctf=IMAGE_CCTF_DECODING,
colourspace_model=COLOURSPACE_MODEL)


@APP.after_request
Expand Down
50 changes: 24 additions & 26 deletions colour_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@
'hdr-CIELAB', 'hdr-IPT'}**
"""

DATA_POINTER_GAMUT = Lab_to_XYZ(
LCHab_to_Lab(DATA_POINTER_GAMUT_VOLUME), CCS_ILLUMINANT_POINTER_GAMUT)
DATA_POINTER_GAMUT = Lab_to_XYZ(LCHab_to_Lab(DATA_POINTER_GAMUT_VOLUME),
CCS_ILLUMINANT_POINTER_GAMUT)
"""
Pointer's Gamut data converted to *CIE XYZ* tristimulus values.

Expand Down Expand Up @@ -250,13 +250,12 @@ def XYZ_to_colourspace_model(XYZ, illuminant, model, **kwargs):
Colourspace model values.
"""

ijk = convert(
XYZ,
'CIE XYZ',
model,
illuminant=illuminant,
verbose={'mode': 'Short'},
**kwargs)
ijk = convert(XYZ,
'CIE XYZ',
model,
illuminant=illuminant,
verbose={'mode': 'Short'},
**kwargs)

if model == 'JzAzBz':
ijk /= XYZ_to_JzAzBz([1, 1, 1])[0]
Expand Down Expand Up @@ -447,9 +446,10 @@ def conform_primitive_dtype(primitive):
vertices, faces, outline = primitive

return (
vertices.astype(
[('position', np.float32, (3, )), ('uv', np.float32, (2, )),
('normal', np.float32, (3, )), ('colour', np.float32, (4, ))]),
vertices.astype([('position', np.float32, (3, )),
('uv', np.float32, (2, )),
('normal', np.float32, (3, )),
('colour', np.float32, (4, ))]),
faces.astype(np.uint32),
outline.astype(np.uint32),
)
Expand Down Expand Up @@ -582,14 +582,13 @@ def RGB_colourspace_volume_visual(colourspace=PRIMARY_COLOURSPACE,
filter_RGB_colourspaces(re.escape(colourspace)).values())

cube = conform_primitive_dtype(
primitive_cube(
width_segments=segments,
height_segments=segments,
depth_segments=segments))
primitive_cube(width_segments=segments,
height_segments=segments,
depth_segments=segments))

vertices = cube[0]['position'] + 0.5
faces = colourspace_model_faces_reorder(
np.reshape(cube[1], (-1, 1)), colourspace_model)
faces = colourspace_model_faces_reorder(np.reshape(cube[1], (-1, 1)),
colourspace_model)
RGB = cube[0]['colour']

XYZ = RGB_to_XYZ(
Expand Down Expand Up @@ -762,14 +761,13 @@ def spectral_locus_visual(colourspace=PRIMARY_COLOURSPACE,
colourspace_model,
), colourspace_model)

RGB = normalise_maximum(
XYZ_to_RGB(
XYZ,
colourspace.whitepoint,
colourspace.whitepoint,
colourspace.matrix_XYZ_to_RGB,
),
axis=-1)
RGB = normalise_maximum(XYZ_to_RGB(
XYZ,
colourspace.whitepoint,
colourspace.whitepoint,
colourspace.matrix_XYZ_to_RGB,
),
axis=-1)

return buffer_geometry(position=vertices, color=RGB)

Expand Down