summaryrefslogtreecommitdiff
path: root/color/chromaticity.py
diff options
context:
space:
mode:
authorStan Seibert <stan@mtrr.org>2011-08-03 11:25:05 -0400
committerStan Seibert <stan@mtrr.org>2011-08-03 11:25:05 -0400
commit1fd605da0024f85714f9451bb78d3a767788e811 (patch)
treead4069d02619d8a8d7a1239c1e47c3dd9778cbac /color/chromaticity.py
parent747d7cde79234775ac117cc58a47f5b2e91ccaaa (diff)
parent42d2241948e04953788ce82bbeef25d0cba584fb (diff)
downloadchroma-1fd605da0024f85714f9451bb78d3a767788e811.tar.gz
chroma-1fd605da0024f85714f9451bb78d3a767788e811.tar.bz2
chroma-1fd605da0024f85714f9451bb78d3a767788e811.zip
Merge with Tony
Diffstat (limited to 'color/chromaticity.py')
-rw-r--r--color/chromaticity.py18
1 files changed, 4 insertions, 14 deletions
diff --git a/color/chromaticity.py b/color/chromaticity.py
index fbd812a..859cc14 100644
--- a/color/chromaticity.py
+++ b/color/chromaticity.py
@@ -1,24 +1,14 @@
import numpy as np
import os
+import sys
dir = os.path.split(os.path.realpath(__file__))[0]
-f = open(dir + '/sbrgb10w.csv')
+sys.path.append(dir + '/..')
-color_map = []
-for line in f:
- color_map.append([float(s) for s in line.split(',')])
+from tools import read_csv
-f.close()
-
-color_map = np.array(color_map)
-
-# zero negative coefficients
-color_map[color_map < 0] = 0
-
-# normalize coefficients
-for i in range(len(color_map)):
- color_map[i,1:] /= np.sum(color_map[i,1:])
+color_map = read_csv(dir + '/ciexyz64_1.csv')
def map_wavelength(wavelength):
r = np.interp(wavelength, color_map[:,0], color_map[:,1])