load_spectral_resp.m 741 B

12345678910111213141516171819202122
  1. function [lambda R] = load_spectral_resp( file_name )
  2. % LOAD_SPECTRAL_RESP (intetrnal) load spectral response or emmision curve
  3. % from a comma separated file. The first column must contain wavelengths in
  4. % nm (lambda) and the remaining columns response / sensitivity / emission
  5. % data. The data is resampled to the 360-780 range with the step of 1nm.
  6. %
  7. % (C) Rafal Mantiuk <mantiuk@gmail.com>
  8. % This is an experimental code for internal use. Do not redistribute.
  9. D = dlmread( file_name );
  10. l_minmax = [360 780];
  11. l_step = 1;
  12. lambda = linspace( l_minmax(1), l_minmax(2), (l_minmax(2)-l_minmax(1))/l_step );
  13. R = zeros( length(lambda), size(D,2)-1 );
  14. for k=2:size(D,2)
  15. R(:,k-1) = interp1( D(:,1), D(:,k), lambda, 'cubic', 0 );
  16. end
  17. end