Created
January 30, 2019 05:07
-
-
Save fish2000/c29532197f81d8054481b4a6e73fe069 to your computer and use it in GitHub Desktop.
Coordinates for drawing the CIE1931 XYZ colorspace from above (née “Yxy”)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
""" | |
cieXYZ.py | |
Party like it's 1931. | |
Created by FI$H 2000 on 2011-04-18. | |
Copyright (c) 2011 OST, LLC. All rights reserved. | |
""" | |
coords = """ | |
360, 0.175560, 0.005294, 0.819146 | |
365, 0.175161, 0.005256, 0.819582 | |
370, 0.174821, 0.005221, 0.819959 | |
375, 0.174510, 0.005182, 0.820309 | |
380, 0.174112, 0.004964, 0.820924 | |
385, 0.174008, 0.004981, 0.821012 | |
390, 0.173801, 0.004915, 0.821284 | |
395, 0.173560, 0.004923, 0.821517 | |
400, 0.173337, 0.004797, 0.821866 | |
405, 0.173021, 0.004775, 0.822204 | |
410, 0.172577, 0.004799, 0.822624 | |
415, 0.172087, 0.004833, 0.823081 | |
420, 0.171407, 0.005102, 0.823490 | |
425, 0.170301, 0.005789, 0.823911 | |
430, 0.168878, 0.006900, 0.824222 | |
435, 0.166895, 0.008556, 0.824549 | |
440, 0.164412, 0.010858, 0.824731 | |
445, 0.161105, 0.013793, 0.825102 | |
450, 0.156641, 0.017705, 0.825654 | |
455, 0.150985, 0.022740, 0.826274 | |
460, 0.143960, 0.029703, 0.826337 | |
465, 0.135503, 0.039879, 0.824618 | |
470, 0.124118, 0.057803, 0.818079 | |
475, 0.109594, 0.086843, 0.803563 | |
480, 0.091294, 0.132702, 0.776004 | |
485, 0.068706, 0.200723, 0.730571 | |
490, 0.045391, 0.294976, 0.659633 | |
495, 0.023460, 0.412703, 0.563837 | |
500, 0.008168, 0.538423, 0.453409 | |
505, 0.003859, 0.654823, 0.341318 | |
510, 0.013870, 0.750186, 0.235943 | |
515, 0.038852, 0.812016, 0.149132 | |
520, 0.074302, 0.833803, 0.091894 | |
525, 0.114161, 0.826207, 0.059632 | |
530, 0.154722, 0.805864, 0.039414 | |
535, 0.192876, 0.781629, 0.025495 | |
540, 0.229620, 0.754329, 0.016051 | |
545, 0.265775, 0.724324, 0.009901 | |
550, 0.301604, 0.692308, 0.006088 | |
555, 0.337363, 0.658848, 0.003788 | |
560, 0.373102, 0.624451, 0.002448 | |
565, 0.408736, 0.589607, 0.001657 | |
570, 0.444062, 0.554714, 0.001224 | |
575, 0.478775, 0.520202, 0.001023 | |
580, 0.512486, 0.486591, 0.000923 | |
585, 0.544787, 0.454434, 0.000779 | |
590, 0.575151, 0.424232, 0.000616 | |
595, 0.602933, 0.396497, 0.000571 | |
600, 0.627037, 0.372491, 0.000472 | |
605, 0.648233, 0.351395, 0.000372 | |
610, 0.665764, 0.334011, 0.000226 | |
615, 0.680079, 0.319747, 0.000174 | |
620, 0.691504, 0.308342, 0.000154 | |
625, 0.700606, 0.299301, 0.000093 | |
630, 0.707918, 0.292027, 0.000055 | |
635, 0.714032, 0.285929, 0.000040 | |
640, 0.719033, 0.280935, 0.000032 | |
645, 0.723032, 0.276948, 0.000020 | |
650, 0.725992, 0.274008, 0.000000 | |
655, 0.728272, 0.271728, 0.000000 | |
660, 0.729969, 0.270031, 0.000000 | |
665, 0.731089, 0.268911, 0.000000 | |
670, 0.731993, 0.268007, 0.000000 | |
675, 0.732719, 0.267281, 0.000000 | |
680, 0.733417, 0.266583, 0.000000 | |
685, 0.734047, 0.265953, 0.000000 | |
690, 0.734390, 0.265610, 0.000000 | |
695, 0.734592, 0.265408, 0.000000 | |
700, 0.734690, 0.265310, 0.000000 | |
705, 0.734690, 0.265310, 0.000000 | |
710, 0.734690, 0.265310, 0.000000 | |
715, 0.734548, 0.265452, 0.000000 | |
720, 0.734690, 0.265310, 0.000000 | |
725, 0.734690, 0.265310, 0.000000 | |
730, 0.734690, 0.265310, 0.000000 | |
735, 0.734690, 0.265310, 0.000000 | |
740, 0.734690, 0.265310, 0.000000 | |
745, 0.734690, 0.265310, 0.000000 | |
750, 0.734690, 0.265310, 0.000000 | |
755, 0.734690, 0.265310, 0.000000 | |
760, 0.734690, 0.265310, 0.000000 | |
765, 0.734690, 0.265310, 0.000000 | |
770, 0.734690, 0.265310, 0.000000 | |
775, 0.734690, 0.265310, 0.000000 | |
780, 0.734690, 0.265310, 0.000000 | |
785, 0.734690, 0.265310, 0.000000 | |
790, 0.734690, 0.265310, 0.000000 | |
795, 0.734690, 0.265310, 0.000000 | |
800, 0.734690, 0.265310, 0.000000 | |
805, 0.734690, 0.265310, 0.000000 | |
810, 0.734690, 0.265310, 0.000000 | |
815, 0.734690, 0.265310, 0.000000 | |
820, 0.734690, 0.265310, 0.000000 | |
825, 0.734690, 0.265310, 0.000000 | |
830, 0.734690, 0.265310, 0.000000 | |
""" | |
""" | |
from colormath.color_objects import XYZColor | |
import StringIO, numpy, csv, sys | |
cie_xyz = [] | |
commas = csv.reader(StringIO.StringIO(coords)) | |
for xx in commas: | |
cie_xyz.append(tuple(xx)) | |
cie = numpy.matrix(cie_xyz[1:]) | |
map(lambda r: (r[0], XYZColor(*r[1:])), cie.tolist()) | |
cieXYZ = cie.T[1:].astype(float).T | |
cieYxy = numpy.array([cieXYZ.T[0].flatten(), cieXYZ.T[1].flatten()]).T | |
cieYxy2 = numpy.apply_along_axis(lambda c: c[0], 1, cieYxy) | |
cieYxy3 = cieYxy2.tolist() | |
""" | |
cieYxy3 = [[0.17556,0.00529],[0.17516,0.00526],[0.17482,0.00522],[0.17451,0.00518],[0.17411,0.00496],[0.17401,0.00498],[0.1738,0.00492],[0.17356,0.00492],[0.17334,0.0048],[0.17302,0.00478],[0.17258,0.0048],[0.17209,0.00483],[0.17141,0.0051],[0.1703,0.00579],[0.16888,0.0069],[0.1669,0.00856],[0.16441,0.01086],[0.1611,0.01379],[0.15664,0.0177],[0.15098,0.02274],[0.14396,0.0297],[0.1355,0.03988],[0.12412,0.0578],[0.10959,0.08684],[0.09129,0.1327],[0.06871,0.20072],[0.04539,0.29498],[0.02346,0.4127],[0.00817,0.53842],[0.00386,0.65482],[0.01387,0.75019],[0.03885,0.81202],[0.0743,0.8338],[0.11416,0.82621],[0.15472,0.80586],[0.19288,0.78163],[0.22962,0.75433],[0.26578,0.72432],[0.3016,0.69231],[0.33736,0.65885],[0.3731,0.62445],[0.40874,0.58961],[0.44406,0.55471],[0.47878,0.5202],[0.51249,0.48659],[0.54479,0.45443],[0.57515,0.42423],[0.60293,0.3965],[0.62704,0.37249],[0.64823,0.3514],[0.66576,0.33401],[0.68008,0.31975],[0.6915,0.30834],[0.70061,0.2993],[0.70792,0.29203],[0.71403,0.28593],[0.71903,0.28094],[0.72303,0.27695],[0.72599,0.27401],[0.72827,0.27173],[0.72997,0.27003],[0.73109,0.26891],[0.73199,0.26801],[0.73272,0.26728],[0.73342,0.26658],[0.73405,0.26595],[0.73439,0.26561],[0.73459,0.26541],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73455,0.26545],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531],[0.73469,0.26531]] | |
if __name__ == '__main__': | |
from imagekit.utils import json | |
print "YO DOGG:" | |
print json.dumps(cieXYZ.tolist()) | |
print "" | |
#print "I HEARD YOU LIKE HISTORICALLY SIGNIFICIANT ABSTRACT COLORSPACE DEFINITIONS:" | |
#print cieYxy | |
print "" | |
print "SO WE PUT SOME RGB IN YOUR XYZ SO YOU CAN OBSERVE WHILE YOU OBSERVE." | |
print json.dumps(cieYxy2.tolist()) | |
print "" | |
sys.exit(0) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A useful background PNG: