
% IMPORTANT NOTE
% ==============
%
% This works only if you run script
%   SOFIA_EXES_spectra_script_1.m
% first !!!

% -----------------------------------------------------------------------------

close all
hold off
plot( lambda, intensity_instrument, '-k', ...
lambda, atmospheric_transmission * max(intensity_instrument), '-r' )
grid on
pause(1)

% -----------------------------------------------------------------------------

idx = find(atmospheric_transmission > 0.99)
pause(1)

plot( lambda, intensity_instrument, '-k', ...
lambda, atmospheric_transmission*max(intensity_instrument), '-r' , ...
lambda(idx), atmospheric_transmission(idx)*max(intensity_instrument), '*y')
grid on
pause(1)

[l_mouse, i_mouse, b_mouse] = ginput(2)
pause(1)

hold on
pause(1)

plot(l_mouse, i_mouse, '-*g')
pause(1)

% ---

intensity_instrument_kontinuum = interp1 (l_mouse, i_mouse, lambda, "linear", "extrap")
pause(1)

plot(lambda, intensity_instrument_kontinuum, '-g')
pause(1)

intensity_instrument_normiert = intensity_instrument ./ intensity_instrument_kontinuum
pause(1)

figure
plot(lambda, intensity_instrument_normiert, '-k', lambda, atmospheric_transmission, '-r')
grid on
pause(1)

% ---

intensity_instrument_err_pos = intensity_instrument + DATA(:,3)
pause(1)

intensity_instrument_err_neg = intensity_instrument - DATA(:,3)
pause(1)

intensity_instrument_err_pos_normiert = intensity_instrument_err_pos ./ intensity_instrument_kontinuum
pause(1)

intensity_instrument_err_neg_normiert = intensity_instrument_err_neg ./ intensity_instrument_kontinuum
pause(1)

figure
plot(lambda, intensity_instrument_normiert, '-k')
grid on
hold on
plot(lambda, intensity_instrument_err_pos_normiert, '-b')
plot(lambda, intensity_instrument_err_neg_normiert, '-b')
plot(lambda, atmospheric_transmission, '-r')
pause(1)

% -----------------------------------------------------------------------------

