% Routine to adjust sensor specs for ISET
% Written by Joan Moh
% --------------------------------------------
% This routine illustrates the need to zero out the negative values
% obtained in the sensor estimation process. As well as scale the
% values into ISET acceptable [0, 1.0]

dataDir = '/home/joanmoh/matlab/ISET';
fileName = 'rgb_dataSub'
fullRawData = fullfile(dataDir,fileName);

rawData = load(fullRawData);
wavelength = [380:4:780];


comment = 'Nikon D70 estimated spectral sensitivity (Joan Moh)';

data = rawData.response_svd/(max(rawData.response_svd(:)));

%  Zero-ing out negative values
[r,c] = find(data < 0);
for i=1:length([r,c])
    data(r(i), c(i)) = 0;
end;

filterNames = {'bNikonD70','gNikonD70','rNikonD70'}

save sensorSpec2 data wavelength comment filterNames