ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cal/cal/cct.cal
Revision: 1.2
Committed: Wed Nov 21 18:10:45 2018 UTC (5 years, 5 months ago) by greg
Branch: MAIN
CVS Tags: rad5R4, rad5R3, HEAD
Changes since 1.1: +1 -0 lines
Log Message:
Added missing RCSid tag

File Contents

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