From 77221e174cdab64de60450646de77f849b043062 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Fri, 19 Jun 2020 23:42:16 +0200 Subject: Major cleanup - The interpolator code is no longer here (but in the Colour fork) - Refactoring made the code shorter and cleaner - All tests work properly again --- test_coverage.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'test_coverage.py') diff --git a/test_coverage.py b/test_coverage.py index e73e015..90e3c79 100644 --- a/test_coverage.py +++ b/test_coverage.py @@ -1,14 +1,10 @@ import numpy as np, os, multiprocessing from colour import * from colour.models import eotf_inverse_sRGB -from jakob_hanika import jakob_hanika, model_sd +from gsoc_common import D65, D65_xy, jakob_hanika, model_sd, plot_comparison -illuminant = "D65" -ill_xy = ILLUMINANTS["CIE 1931 2 Degree Standard Observer"][illuminant] -ill_sd = SpectralDistribution(ILLUMINANT_SDS[illuminant]) # Note: changed in dev (to ILLUMINANT_SD) - # Resolution of the discretization cubes # Both should be 64, but this code is a bit too slow at the moment CHROMA_STEPS = 8 @@ -19,10 +15,10 @@ LIGHTNESS_STEPS = 8 # Solve for a specific RGB color def optimize_RGB(linear_RGB, ccp0): RGB = eotf_inverse_sRGB(linear_RGB) - target = sRGB_to_XYZ(RGB, ill_xy) - ccp, error = jakob_hanika(target, ill_sd, ill_xy, ccp0, verbose=False) + target = sRGB_to_XYZ(RGB, D65_xy) + ccp, error = jakob_hanika(target, D65, D65_xy, ccp0, verbose=False) if error > 0.1: - print("WARNING: convergence failed with L=%s, starting from %s" \ + print("WARNING: convergence failed with L=%s, starting from %s" % (linear_RGB, ccp0)) return ccp, error @@ -90,7 +86,8 @@ if __name__ == "__main__": dirname = "out/R%.3fG%.3fB%.3f" % (*RGB,) total += 1 - if os.path.exists(dirname) and len(os.listdir(dirname)) == LIGHTNESS_STEPS: + if os.path.exists(dirname) and \ + len(os.listdir(dirname)) == LIGHTNESS_STEPS: done += 1 continue -- cgit