ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/cct.cal
Revision: 1.1
Committed: Sat Feb 22 02:07:21 2003 UTC (21 years, 1 month ago) by greg
Branch: MAIN
CVS Tags: rad5R2, rad4R2P2, rad5R0, rad5R1, rad3R7P2, rad3R7P1, rad4R2, rad4R1, rad4R0, rad3R5, rad3R6, rad3R6P1, rad3R8, rad3R9, rad4R2P1
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# Content
1 {
2 Compute correlated color temperature.
3 Used by scripts illumcal, reflcal.
4
5 Input is SPD curve convolved with CIE standard response curves
6 to compute u_k and v_k.
7 }
8
9 mk(i) = select(i, 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 125,
10 150, 175, 200, 225, 250, 275, 300, 325, 350, 375, 400, 425,
11 450, 475, 500, 525, 550, 575, 600);
12
13 ut(i) = select(i, 0.180060, 0.180660, 0.181330, 0.182080, 0.182930,
14 0.183880, 0.184940, 0.186110, 0.187400, 0.188800, 0.190320,
15 0.194620, 0.199620, 0.205250, 0.211420, 0.218070, 0.225110,
16 0.232470, 0.240100, 0.247020, 0.255910, 0.264000, 0.272180,
17 0.280390, 0.288630, 0.296850, 0.305050, 0.313200, 0.321290,
18 0.329310, 0.337240);
19
20 vt(i) = select(i, 0.263520, 0.265890, 0.268460, 0.271190, 0.274070,
21 0.277090, 0.280210, 0.283420, 0.286680, 0.289970, 0.293260,
22 0.301410, 0.309210, 0.316470, 0.323120, 0.329090, 0.334390,
23 0.339040, 0.343080, 0.346550, 0.349510, 0.352000, 0.354070,
24 0.355770, 0.357140, 0.358230, 0.359070, 0.359680, 0.360110,
25 0.360380, 0.360510);
26
27 tt(i) = select(i, -0.243410, -0.254790, -0.268760, -0.285390, -0.304700,
28 -0.326750, -0.351560, -0.379150, -0.409550, -0.442780, -0.478880,
29 -0.582040, -0.704710, -0.849010, -1.018200, -1.216800, -1.451200,
30 -1.729800, -2.063700, -2.468100, -2.964100, -3.581400, -4.363300,
31 -5.376200, -6.726200, -8.595500, -11.324000, -15.628000, -23.325000,
32 -40.770000, -116.450000);
33
34 dti(j) = ( (v_k - vt(j)) - tt(j) * (u_k - ut(j)) ) / sqrt(1+tt(j)*tt(j));
35
36 T(i) = 1e6/(mk(i)+dti(i)/(dti(i)-dti(i+1))*(mk(i+1)-mk(i)));
37 temp(k) = if(dti(k)/dti(k+1), temp(k+1), T(k));
38
39 cct = temp(1);