function [sigmaData,diagDecay] = NOEread8OrgFunNew(sigmaData,diagDecay,user,conditions)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Set decay to the one we are normalizing to

% Assign fitted data to sigmaData.decay

for i=1:length(sigmaData)
    
    for k = 1:length(diagDecay)
        
        if diagDecay(k).numcode.ATOMi_pdbSerNo  == sigmaData(i).numcode.ATOMnorm_pdbSerNo            
            
            sigmaData(i).decay                  = diagDecay(k);
            
        end
        
    end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% assign rhoi and rhoj to sigmaData.buildups according to type either from 
% fitted or supplied
    
for i = 1:length(sigmaData)
    
    sigmaData(i).buildups.rhoi                  = user.rhoAverage;          % use supplied average
   	sigmaData(i).buildups.rhoj                  = user.rhoAverage;          % use supplied average
                
 	for k = 1:length(diagDecay)

        if diagDecay(k).numcode.ATOMi_pdbSerNo  == sigmaData(i).numcode.ATOMi_pdbSerNo
    
            sigmaData(i).buildups.rhoi          = diagDecay(k).rho;
                    
        end
    end
           
 	for k = 1:length(diagDecay)

        if diagDecay(k).numcode.ATOMi_pdbSerNo  == sigmaData(i).numcode.ATOMj_pdbSerNo  
            
          	sigmaData(i).buildups.rhoj          = diagDecay(k).rho;
                    
        end
  	end
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Assign rawIzero value to sigmaData.buildups

for i = 1:length(sigmaData)
    
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % initialize rawIzero
   	sigmaData(i).buildups.rawIzero              = 999;      % none supplied flag
        
    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    % assign genNORM rawIzero values if supplied, else use fitted or individual
    % values supplied and scale acording to normalization
       
        if ~isempty(user.IzeroMethyl) && ~isempty(user.IzeroMethylenePseudo) && ~isempty(user.IzeroSingle)
            
            sigmaData(i).buildups.rawIzero      = genNORMeNOE(sigmaData(i).numcode.ATOMnorm,conditions,user);
            
        end
    
        if isempty(user.IzeroMethyl) && isempty(user.IzeroMethylenePseudo) && isempty(user.IzeroSingle)
            
            if ~isempty(sigmaData(i).decay.Const)
                
            	sigmaData(i).buildups.rawIzero 	= -abs(sigmaData(i).decay.Const);
                
            end
            
        end
        
        sigmaData(i).buildups.Izero             = sigmaData(i).buildups.rawIzero * sigmaData(i).numcode.IzeroScaling;
        
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%        
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%       