From 870236b3c4950762a73247c68023a8dee6e14a7b Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Sun, 12 Jun 2011 21:31:22 -0400 Subject: added some fun models; added some untested code to implement absorption, scattering, reflection, and refraction --- chromaticity.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 chromaticity.py (limited to 'chromaticity.py') diff --git a/chromaticity.py b/chromaticity.py new file mode 100644 index 0000000..18ec28f --- /dev/null +++ b/chromaticity.py @@ -0,0 +1,18 @@ +import numpy as np + +f = open('ciexyz64_1.csv') + +color_map = [] +for line in f: + color_map.append([float(s) for s in line.split(',')]) + +f.close() + +color_map = np.array(color_map) + +def map_wavelength(wavelength): + r = np.interp(wavelength, color_map[:,0], color_map[:,1]) + g = np.interp(wavelength, color_map[:,0], color_map[:,2]) + b = np.interp(wavelength, color_map[:,0], color_map[:,3]) + + return r, g, b -- cgit