Advertisement
Guest User

Untitled

a guest
Dec 26th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. cieCMFdata =
  2. Import["cie2deg.csv"]; (* Get this file here: \
  3. http://www.cvrl.org/lumindex.htm *)
  4.  
  5. {x, y, z, ix, iy, iz} =
  6. Interpolation[Transpose[{cieCMFdata[[All, 1]], #}],
  7. InterpolationOrder -> 1] & /@
  8. Join[Transpose[cieCMFdata[[All, 2 ;; 4]]],
  9. Transpose[Accumulate[cieCMFdata[[All, 2 ;; 4]]]]/
  10. Total[cieCMFdata[[All, 2 ;; 4]]]];
  11.  
  12. xyz[\[Lambda]_] := {x[\[Lambda]], y[\[Lambda]], z[\[Lambda]]}
  13. xy[\[Lambda]_] := {#1, #2}/(#1 + #2 + #3) & @@ xyz[\[Lambda]]
  14. ixyz[e_] := {ix[e], iy[e], iz[e]}
  15. ixyz[s_, e_] := ixyz[e] - ixyz[s]
  16.  
  17. Row[{Plot[{x[\[Lambda]], y[\[Lambda]], z[\[Lambda]]}, {\[Lambda], 385,
  18. 745}, PlotStyle -> {Red, Green, Blue}, ImageSize -> 360],
  19. Plot[{ix[\[Lambda]], iy[\[Lambda]], iz[\[Lambda]]}, {\[Lambda], 385,
  20. 745}, PlotStyle -> {Red, Green, Blue}, ImageSize -> 360]}]
  21.  
  22.  
  23.  
  24.  
  25. XYYToXYZ[xyY_] := {xyY[[3]]/xyY[[2]] * xyY[[1]], xyY[[3]],
  26. xyY[[3]]/xyY[[2]] * (1 - xyY[[2]] - xyY[[1]])}
  27. XYZToXYY[XYZ_] := {XYZ[[1]]/Total[XYZ], XYZ[[2]]/Total[XYZ], XYZ[[2]]}
  28.  
  29.  
  30.  
  31.  
  32. map = Join @@
  33. Table[Join @@
  34. Table[Table[{XYZToXYY[ixyz[a, b] + {1, 1, 1} - ixyz[c]], {a, b,
  35. c}}, {c, b + 5, 745, 5}], {b, a + 5, 745, 5}], {a, 385, 745,
  36. 5}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement