{ RCSid $Id: blackbody.cal,v 1.2 2005/05/23 22:11:35 greg Exp $ } { Plank's formula for black body radiation spectrum } { Required constants } k : 8.617e-5; { Boltzmann constant (eV/K) } h : 4.136e-15; { Plank constant (eV-sec) } e : 1.602e-19; { elemetary charge (Coulombs) } c : 2.998e8; { speed of light (m/sec) } { The following distribution is in units of Joules/meter^4, i.e., energy per radiating volume per wavelength lmb (lambda) is expected in nm (10^-9 meter) and T must be given in degrees Kelvin } u(lmd,T) : 8*PI*h*e*c*(lmd*1e-9)^-5 / (exp(h*c/(lmd*1e-9*k*T)) - 1); { Compute approximate CIE (x,y) chromaticity (2-degree observer) from black body temperature in degrees Kelvin cct_x(t), cct_y(t) } interp_arr2`(i,x,f):(i+1-x)*f(i)+(x-i)*f(i+1); interp_arr`(x,f):if(x-1,if(f(0)-x,interp_arr2`(floor(x),x,f),f(f(0))),f(1)); cct_x`p334(i):select(i,0.6527561,0.6457256,0.6387621, 0.6318698,0.625051,0.6183069,0.6116381,0.605045,0.5985281, 0.5920879,0.5857252,0.5794412,0.5732371,0.5671146,0.5610752, 0.5551208,0.5492532,0.5434741,0.5377855,0.5321889,0.5266859, 0.5212777,0.5159658,0.5107508,0.5056338,0.5006152,0.4956953, 0.4908744,0.4861522,0.4815286,0.4770031,0.4725751,0.4682438, 0.4640083,0.4598675,0.4558203,0.4518653,0.4480012,0.4442265, 0.4405397,0.4369393,0.4334235,0.4299908,0.4266394,0.4233676, 0.4201736,0.4170558,0.4140124,0.4110416,0.4081418,0.4053111, 0.4025479,0.3998505,0.3972173,0.3946465,0.3921367,0.3896861, 0.3872933,0.3849568,0.3826749,0.3804464,0.3782696,0.3761434, 0.3740662,0.3720369,0.370054,0.3681163,0.3662226,0.3643717, 0.3625624,0.3607936,0.3590643,0.3573733,0.3557196,0.3541021, 0.35252,0.3509722,0.3494579,0.3479761,0.346526,0.3451067, 0.3437173,0.3423572,0.3410255,0.3397215,0.3384445,0.3371936, 0.3359684,0.334768,0.3335918,0.3324393,0.3313098,0.3302027, 0.3291174,0.3280535,0.3270103,0.3259873,0.324984,0.324, 0.3230347,0.3220877,0.3211585,0.3202467,0.3193519,0.3184736, 0.3176115,0.3167651,0.3159342,0.3151182,0.3143169,0.3135299, 0.3127569,0.3119975,0.3112515,0.3105185,0.3097981,0.3090902, 0.3083945,0.3077106,0.3070383,0.3063773,0.3057274,0.3050883, 0.3044599,0.3038417,0.3032337,0.3026356,0.3020472,0.3014682, 0.3008985,0.3003379,0.2997861,0.2992431,0.2987085,0.2981823, 0.2976642,0.2971541,0.2966518,0.2961571,0.29567,0.2951901, 0.2947175,0.2942519,0.2937932,0.2933412,0.2928959,0.2924571, 0.2920246,0.2915984,0.2911783,0.2907642,0.2903559,0.2899534, 0.2895566,0.2891653,0.2887795,0.288399,0.2880237,0.2876536, 0.2872885,0.2869283,0.286573,0.2862225,0.2858766,0.2855353, 0.2851985,0.2848662,0.2845382,0.2842144,0.2838949,0.2835794, 0.283268,0.2829606,0.282657,0.2823573,0.2820614,0.2817692, 0.2814805,0.2811955,0.280914,0.2806359,0.2803612,0.2800899, 0.2798218,0.2795569,0.2792953,0.2790367,0.2787812,0.2785287, 0.2782792,0.2780326,0.2777889,0.277548,0.2773098,0.2770744, 0.2768417,0.2766116,0.2763842,0.2761593,0.2759369,0.275717, 0.2754995,0.2752845,0.2750718,0.2748614,0.2746534,0.2744476, 0.274244,0.2740426,0.2738434,0.2736463,0.2734513,0.2732584, 0.2730675,0.2728786,0.2726917,0.2725067,0.2723236,0.2721425, 0.2719632,0.2717857,0.27161,0.2714361,0.271264,0.2710936, 0.2709249,0.2707579,0.2705925,0.2704288,0.2702667,0.2701062, 0.2699472,0.2697898,0.2696339,0.2694795,0.2693267,0.2691752, 0.2690252,0.2688767,0.2687295,0.2685838,0.2684393,0.2682963, 0.2681546,0.2680142,0.2678751,0.2677372,0.2676007,0.2674653, 0.2673312,0.2671984,0.2670667,0.2669362,0.2668069,0.2666787, 0.2665516,0.2664257,0.2663009,0.2661772,0.2660546,0.2659331, 0.2658126,0.2656931,0.2655747,0.2654573,0.2653409,0.2652255, 0.265111,0.2649976,0.2648851,0.2647735,0.2646629,0.2645532, 0.2644444,0.2643365,0.2642295,0.2641234,0.2640181,0.2639138, 0.2638102,0.2637075,0.2636056,0.2635046,0.2634044,0.2633049, 0.2632063,0.2631084,0.2630113,0.262915,0.2628194,0.2627246, 0.2626305,0.2625372,0.2624445,0.2623526,0.2622614,0.2621709, 0.2620811,0.261992,0.2619035,0.2618158,0.2617286,0.2616422, 0.2615564,0.2614712,0.2613866,0.2613027,0.2612194,0.2611368, 0.2610547,0.2609732,0.2608923,0.2608121,0.2607324,0.2606532, 0.2605747,0.2604967,0.2604192,0.2603424,0.260266,0.2601902, 0.260115,0.2600402,0.259966,0.2598924,0.2598192,0.2597465, 0.2596744,0.2596027,0.2595315,0.2594609,0.2593907,0.259321, 0.2592517,0.259183,0.2591147,0.2590468,0.2589795,0.2589125, 0.258846,0.25878,0.2587144,0.2586492,0.2585845,0.2585202, 0.2584563,0.2583929,0.2583298,0.2582672,0.2582049,0.2581431, 0.2580817,0.2580206,0.25796,0.2578997,0.2578399,0.2577804, 0.2577212,0.2576625,0.2576041,0.2575461,0.2574885,0.2574312, 0.2573743,0.2573177,0.2572615,0.2572056,0.2571501,0.2570949, 0.2570401,0.2569856,0.2569314,0.2568776,0.256824,0.2567708, 0.256718,0.2566654,0.2566132,0.2565612,0.2565096,0.2564583, 0.2564073,0.2563566,0.2563062,0.2562561,0.2562062,0.2561567, 0.2561075,0.2560585,0.2560099,0.2559615,0.2559134,0.2558655, 0.255818,0.2557707,0.2557237,0.255677,0.2556305,0.2555843, 0.2555383,0.2554926,0.2554472,0.255402,0.2553571,0.2553124, 0.255268,0.2552238,0.2551799,0.2551362,0.2550927,0.2550495, 0.2550065,0.2549638,0.2549213,0.254879,0.2548369,0.2547951, 0.2547535,0.2547122,0.254671,0.2546301,0.2545894,0.2545489, 0.2545086,0.2544686,0.2544287,0.2543891,0.2543496,0.2543104, 0.2542714,0.2542326,0.254194,0.2541556,0.2541174,0.2540793, 0.2540415,0.2540039,0.2539665,0.2539293,0.2538922,0.2538554, 0.2538187,0.2537822,0.2537459,0.2537098,0.2536739,0.2536381, 0.2536026,0.2535672,0.253532,0.2534969,0.2534621,0.2534274, 0.2533928,0.2533585,0.2533243,0.2532903,0.2532565,0.2532228, 0.2531893,0.2531559,0.2531227,0.2530897,0.2530568,0.2530241, 0.2529916,0.2529592,0.252927,0.2528949,0.252863,0.2528312, 0.2527995,0.2527681,0.2527367,0.2527056,0.2526745,0.2526436, 0.2526129,0.2525823,0.2525519,0.2525215); tct_x(t):interp_arr`((t-1000)/50+1,cct_x`p334); cct_y`p334(i):select(i,0.3444569,0.350601,0.3564928, 0.3621137,0.3674494,0.3724897,0.3772277,0.3816595,0.3857839, 0.3896022,0.3931174,0.3963348,0.3992608,0.4019032,0.404271, 0.406374,0.4082225,0.4098275,0.4112004,0.4123526,0.4132957, 0.4140414,0.414601,0.414986,0.4152074,0.4152759,0.4152019, 0.4149956,0.4146665,0.4142239,0.4136765,0.4130328,0.4123007, 0.4114878,0.410601,0.4096471,0.4086323,0.4075625,0.4064433, 0.4052798,0.4040768,0.4028388,0.40157,0.4002741,0.3989549, 0.3976157,0.3962596,0.3948894,0.3935077,0.392117,0.3907195, 0.3893173,0.3879123,0.3865063,0.3851007,0.3836971,0.3822968, 0.380901,0.3795108,0.3781272,0.3767512,0.3753834,0.3740248, 0.3726759,0.3713373,0.3700097,0.3686933,0.3673887,0.3660963, 0.3648163,0.363549,0.3622947,0.3610535,0.3598257,0.3586113, 0.3574106,0.3562235,0.3550501,0.3538905,0.3527446,0.3516126, 0.3504943,0.3493897,0.3482988,0.3472216,0.3461579,0.3451077, 0.3440708,0.3430473,0.3420369,0.3410396,0.3400553,0.3390838, 0.338125,0.3371788,0.336245,0.3353235,0.3344142,0.3335169, 0.3326314,0.3317577,0.3308955,0.3300448,0.3292054,0.3283771, 0.3275597,0.3267532,0.3259574,0.3251721,0.3243971,0.3236324, 0.3228778,0.3221332,0.3213983,0.3206731,0.3199574,0.319251, 0.3185539,0.3178659,0.3171868,0.3165165,0.315855,0.3152019, 0.3145573,0.313921,0.3132928,0.3126727,0.3120605,0.3114561, 0.3108594,0.3102702,0.3096884,0.309114,0.3085468,0.3079866, 0.3074335,0.3068872,0.3063477,0.3058149,0.3052886,0.3047688, 0.3042554,0.3037482,0.3032472,0.3027522,0.3022633,0.3017802, 0.3013029,0.3008313,0.3003653,0.2999049,0.2994499,0.2990003, 0.2985559,0.2981168,0.2976827,0.2972538,0.2968297,0.2964106, 0.2959963,0.2955868,0.2951819,0.2947816,0.2943859,0.2939946, 0.2936077,0.2932252,0.2928469,0.2924729,0.2921029,0.2917371, 0.2913753,0.2910175,0.2906636,0.2903135,0.2899672,0.2896247, 0.2892859,0.2889506,0.288619,0.2882909,0.2879663,0.2876451, 0.2873273,0.2870128,0.2867016,0.2863937,0.2860889,0.2857873, 0.2854888,0.2851934,0.2849009,0.2846115,0.284325,0.2840414, 0.2837606,0.2834827,0.2832075,0.2829351,0.2826654,0.2823983, 0.2821339,0.2818721,0.2816128,0.2813561,0.2811019,0.2808501, 0.2806007,0.2803537,0.2801091,0.2798669,0.2796269,0.2793892, 0.2791537,0.2789205,0.2786894,0.2784605,0.2782337,0.2780091, 0.2777865,0.2775659,0.2773474,0.2771308,0.2769163,0.2767036, 0.2764929,0.2762841,0.2760772,0.2758721,0.2756688,0.2754674, 0.2752677,0.2750698,0.2748736,0.2746792,0.2744864,0.2742953, 0.2741059,0.2739181,0.2737319,0.2735473,0.2733643,0.2731829, 0.273003,0.2728246,0.2726477,0.2724723,0.2722984,0.2721259, 0.2719548,0.2717852,0.271617,0.2714502,0.2712847,0.2711206, 0.2709578,0.2707963,0.2706362,0.2704773,0.2703197,0.2701634, 0.2700083,0.2698545,0.2697019,0.2695504,0.2694002,0.2692512, 0.2691033,0.2689566,0.268811,0.2686666,0.2685232,0.268381, 0.2682399,0.2680998,0.2679609,0.2678229,0.2676861,0.2675502, 0.2674154,0.2672816,0.2671488,0.267017,0.2668861,0.2667563, 0.2666274,0.2664994,0.2663724,0.2662463,0.2661212,0.2659969, 0.2658736,0.2657511,0.2656295,0.2655088,0.265389,0.26527, 0.2651519,0.2650346,0.2649182,0.2648025,0.2646877,0.2645737, 0.2644605,0.264348,0.2642364,0.2641255,0.2640154,0.2639061, 0.2637975,0.2636896,0.2635825,0.2634761,0.2633705,0.2632655, 0.2631613,0.2630577,0.2629549,0.2628528,0.2627513,0.2626505, 0.2625504,0.2624509,0.2623521,0.2622539,0.2621564,0.2620596, 0.2619633,0.2618677,0.2617727,0.2616783,0.2615845,0.2614914, 0.2613988,0.2613068,0.2612154,0.2611246,0.2610344,0.2609447, 0.2608556,0.2607671,0.2606791,0.2605917,0.2605048,0.2604184, 0.2603326,0.2602473,0.2601626,0.2600783,0.2599946,0.2599114, 0.2598287,0.2597465,0.2596648,0.2595836,0.2595029,0.2594227, 0.2593429,0.2592637,0.2591849,0.2591065,0.2590287,0.2589513, 0.2588744,0.2587979,0.2587218,0.2586462,0.2585711,0.2584964, 0.2584221,0.2583483,0.2582748,0.2582019,0.2581293,0.2580571, 0.2579854,0.2579141,0.2578431,0.2577726,0.2577025,0.2576328, 0.2575634,0.2574945,0.2574259,0.2573578,0.25729,0.2572225, 0.2571555,0.2570888,0.2570225,0.2569566,0.256891,0.2568258, 0.256761,0.2566965,0.2566323,0.2565685,0.2565051,0.256442, 0.2563792,0.2563168,0.2562547,0.2561929,0.2561315,0.2560704, 0.2560096,0.2559491,0.255889,0.2558292,0.2557696,0.2557104, 0.2556516,0.255593,0.2555347,0.2554767,0.2554191,0.2553617, 0.2553046,0.2552479,0.2551914,0.2551352,0.2550793,0.2550236, 0.2549683,0.2549132,0.2548585,0.254804,0.2547497,0.2546958, 0.2546421,0.2545887,0.2545355,0.2544827,0.25443,0.2543777, 0.2543256,0.2542737,0.2542222,0.2541708,0.2541197,0.2540689, 0.2540183,0.253968,0.2539179,0.2538681,0.2538185,0.2537691, 0.25372,0.2536711,0.2536224,0.253574,0.2535258,0.2534779, 0.2534301,0.2533826,0.2533353,0.2532883,0.2532415,0.2531948, 0.2531484,0.2531023,0.2530563,0.2530106,0.252965,0.2529197, 0.2528746,0.2528297,0.252785,0.2527405,0.2526962,0.2526521, 0.2526083,0.2525646,0.2525211,0.2524778,0.2524347,0.2523918, 0.2523491,0.2523066,0.2522643,0.2522222); cct_y(t):interp_arr`((t-1000)/50+1,cct_y`p334);