% ***********************************************************************
% oxy_hemoglobin_extinction.m
% ***********************************************************************
%
% Data description:
% The extinction coefficient of oxy-hemoglobin in [cm^-1/(mol/L)]
% (250-1000nm), with a resolution of 5nm.
%
% Prepared by: Tenn Francis Chen on March 2011
%
% ***********************************************************************
%
% Original data source:
%      Compiled by Scott Prahl using data from
%      * W. B. Gratzer, Med. Res. Council Labs, Holly Hill, London
%      * N. Kollias, Wellman Laboratories, Harvard Medical School, Boston
% 
%      Published by Oregon Medical Laser Center
%      http://omlc.ogi.edu/spectra/hemoglobin/index.html
%
% ***********************************************************************
clear all
data0=[106112, 105552, 107660, 109788, 112944, 116376, 120188, 124412, 128696, 133064, 136068, 137232, 138408, 137424, 135820, 131936, 127720, 122280, 116508, 108484, 104752, 98936, 88136, 79316, 70884, 65972, 63208, 61952, 62352, 62856, 63352, 65972, 69016, 72404, 75536, 78752, 82256, 85972, 89796, 93768, 97512, 100964, 103504, 104968, 106452, 107884, 109060, 110092, 109032, 107984, 106576, 105040, 103696, 101568, 97828, 94744, 92248, 89836, 88484, 87512, 88176, 91592, 95140, 98936, 103432, 109564, 116968, 125420, 135132, 148100, 167748, 189740, 212060, 231612, 248404, 266232, 284224, 308716, 354208, 422320, 466840, 500200, 524280, 521880, 515520, 480360, 431880, 376236, 326032, 283112, 246072, 214120, 165332, 132820, 119140, 102580, 92780, 81444, 76324, 67044, 62816, 58864, 53552, 49496, 47496, 44480, 41320, 39807.2, 37073.2, 34870.8, 33209.2, 31620, 30113.6, 28850.8, 27718, 26629.2, 25701.6, 25180.4, 24669.6, 24174.8, 23684.4, 23086.8, 22457.6, 21850.4, 21260, 20932.8, 20596.4, 20418, 19946, 19996, 20035.2, 20150.4, 20429.2, 21001.6, 22509.6, 24202.4, 26450.4, 29269.2, 32496.4, 35990, 39956.8, 43876, 46924, 49752, 51712, 53236, 53292, 52096, 49868, 46660, 43016, 39675.2, 36815.2, 34476.8, 33456, 32613.2, 32620, 33915.6, 36495.2, 40172, 44496, 49172, 53308, 55540, 54728, 50104, 43304, 34639.6, 26600.4, 19763.2, 14400.8, 10468.4, 7678.8, 5683.6, 4504.4, 3200, 2664, 2128, 1789.2, 1647.6, 1506, 1364.4, 1222.8, 1110, 1026, 942, 858, 774, 707.6, 658.8, 610, 561.2, 512.4, 478.8, 460.4, 442, 423.6, 405.2, 390.4, 379.2, 368, 356.8, 345.6, 335.2, 325.6, 319.6, 314, 308.4, 302.8, 298, 294, 290, 285.6, 282, 279.2, 277.6, 276, 274.4, 272.8, 274.4, 276, 277.6, 279.2, 282, 286, 290, 294, 298, 302.8, 308.4, 314, 319.6, 325.2, 332, 340, 348, 356, 364, 372.4, 381.2, 390, 398.8, 407.6, 418.8, 432.4, 446, 459.6, 473.2, 487.6, 502.8, 518, 533.2, 548.4, 562, 574, 586, 598, 610, 622.8, 636.4, 650, 663.6, 677.2, 689.2, 699.6, 710, 720.4, 730.8, 740, 748, 756, 764, 772, 786.4, 807.2, 816, 828, 836, 844, 856, 864, 872, 880, 887.2, 901.6, 916, 930.4, 944.8, 956.4, 965.2, 974, 982.8, 991.6, 1001.2, 1011.6, 1022, 1032.4, 1042.8, 1050, 1054, 1058, 1062, 1066, 1072.8, 1082.4, 1092, 1101.6, 1111.2, 1118.4, 1123.2, 1128, 1132.8, 1137.6, 1142.8, 1148.4, 1154, 1159.6, 1165.2, 1170, 1174, 1178, 1182, 1186, 1190, 1194, 1198, 1202, 1206, 1209.2, 1211.6, 1214, 1216.4, 1218.8, 1220.8, 1222.4, 1224, 1225.6, 1227.2, 1226.8, 1224.4, 1222, 1219.6, 1217.2, 1215.6, 1214.8, 1214, 1213.2, 1212.4, 1210.4, 1207.2, 1204, 1200.8, 1197.6, 1194, 1190, 1186, 1182, 1178, 1173.2, 1167.6, 1162, 1156.4, 1150.8, 1144, 1136, 1128, 1120, 1112, 1102.4, 1091.2, 1080, 1068.8, 1057.6, 1046.4, 1035.2, 1024];

wave0 = [250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 470, 472, 474, 476, 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, 684, 686, 688, 690, 692, 694, 696, 698, 700, 702, 704, 706, 708, 710, 712, 714, 716, 718, 720, 722, 724, 726, 728, 730, 732, 734, 736, 738, 740, 742, 744, 746, 748, 750, 752, 754, 756, 758, 760, 762, 764, 766, 768, 770, 772, 774, 776, 778, 780, 782, 784, 786, 788, 790, 792, 794, 796, 798, 800, 802, 804, 806, 808, 810, 812, 814, 816, 818, 820, 822, 824, 826, 828, 830, 832, 834, 836, 838, 840, 842, 844, 846, 848, 850, 852, 854, 856, 858, 860, 862, 864, 866, 868, 870, 872, 874, 876, 878, 880, 882, 884, 886, 888, 890, 892, 894, 896, 898, 900, 902, 904, 906, 908, 910, 912, 914, 916, 918, 920, 922, 924, 926, 928, 930, 932, 934, 936, 938, 940, 942, 944, 946, 948, 950, 952, 954, 956, 958, 960, 962, 964, 966, 968, 970, 972, 974, 976, 978, 980, 982, 984, 986, 988, 990, 992, 994, 996, 998, 1000];

wave = ceil(wave0(1)):5:floor(wave0(end));
data = interp1(wave0,data0,wave);

fid=fopen('oxy_hemoglobin_extinction.txt','wb');
for i=1:length(wave)
    fprintf(fid,'%d  %3.4g \n',wave(i),data(i));
end
fclose(fid);


plot(wave,data,'b-','linewidth',1.5);
set(gca,'FontSize',14);
grid on
title('oxy-hemoglobin','fontsize',14)
ylabel('molar extinction coefficient (cm^{-1}/(mol/L))','fontsize',14);
xlabel('wavelength (nm)','fontsize',14);
xlim([min(wave),max(wave)]);
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 6 5]);
pause
print('-dpng', '-r100','oxy_hemoglobin_extinction.png');
close 
   



