Skip to content

Commit

Permalink
some pylint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nschloe committed Feb 9, 2018
1 parent f313f7f commit fa4f995
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
2 changes: 2 additions & 0 deletions .pylintrc
Expand Up @@ -5,4 +5,6 @@ disable=
fixme,
invalid-name,
missing-docstring,
no-member,
no-name-in-module,
too-many-locals,
7 changes: 3 additions & 4 deletions colorio/tools.py
Expand Up @@ -21,9 +21,8 @@ def delta(a, b):
return numpy.einsum('i...,i...->...', diff, diff)


def show_visible_gamut(
colorspace, observer, illuminant, filename, cut_000=False
):
def show_visible_gamut(colorspace, observer, illuminant, filename,
cut_000=False):
import meshio

# The XYZ gamut is actually defined by an arbitrarily chosen maximum
Expand All @@ -39,7 +38,7 @@ def show_visible_gamut(
for width in range(1, len(lmbda)):
data = numpy.zeros(len(lmbda))
data[:width] = 1.0
for k, _ in enumerate(lmbda):
for _, _ in enumerate(lmbda):
values.append(
spectrum_to_xyz100((lmbda, illu*data), observer=observer)
)
Expand Down
25 changes: 12 additions & 13 deletions test/test_comparisons.py
Expand Up @@ -2,9 +2,9 @@
#
import numpy

import colorspacious
import colour
import colorio
import colorspacious

numpy.random.seed(0)

Expand Down Expand Up @@ -127,23 +127,22 @@ def performance_comparison_to():
whitepoint = colorio.illuminants.whitepoints_cie1931['D65']
L_A = 64 / numpy.pi / 5

c = 0.69 # average
cs2 = colorio.CIECAM02(c, Y_b, L_A)

cs1 = colorspacious.ciecam02.CIECAM02Space(
whitepoint, Y_b, L_A,
surround=colorspacious.CIECAM02Surround.AVERAGE
)

def setup(n):
rgb = numpy.random.rand(3)
out = numpy.empty((3, n))
for k in range(3):
out[k] = rgb[k]
return out

def csp(x):
return cs1.CIECAM02_to_XYZ100(J=x[0], C=x[1], h=x[2])
# cs1 = colorspacious.ciecam02.CIECAM02Space(
# whitepoint, Y_b, L_A,
# surround=colorspacious.CIECAM02Surround.AVERAGE
# )
# def csp(x):
# return cs1.CIECAM02_to_XYZ100(J=x[0], C=x[1], h=x[2])

c = 0.69 # average
cs2 = colorio.CIECAM02(c, Y_b, L_A)

def cio(x):
return cs2.to_xyz100(x, 'JCh')
Expand All @@ -152,8 +151,8 @@ def clr(x):
J, C, h = x
spec = colour.appearance.ciecam02.CIECAM02_Specification(J=J, C=C, h=h)
return colour.appearance.ciecam02.CIECAM02_to_XYZ(
spec, whitepoint, L_A, Y_b
)
spec, whitepoint, L_A, Y_b
)

perfplot.show(
setup=setup,
Expand Down
4 changes: 2 additions & 2 deletions test/test_tools.py
Expand Up @@ -30,7 +30,7 @@ def test_hdr_gamut(colorspace, n=10):
(colorio.XYY(), True),
(colorio.CAM02('UCS', 0.69, 20, 64/numpy.pi/5), False),
])
def test_visible_gamut(colorspace, cut_000, n=10):
def test_visible_gamut(colorspace, cut_000):
illuminant = colorio.illuminants.d65()
observer = colorio.observers.cie_1931_2()
colorio.show_visible_gamut(
Expand Down Expand Up @@ -67,4 +67,4 @@ def test_conversion_variants(a):
# colorspace_ = colorio.CAM02('UCS', 0.69, 20, 64/numpy.pi/5)
# colorspace_ = colorio.CAM16UCS(0.69, 20, 64/numpy.pi/5)
# test_hdr_gamut(colorspace_, n=10)
test_visible_gamut(colorspace_, cut_000=True, n=10)
test_visible_gamut(colorspace_, cut_000=True)

0 comments on commit fa4f995

Please sign in to comment.