function sigmaData = scalingFactorsFun(sigmaData, conditions)

user            = sigmaData(1).user;

fprintf('\n\nDetermining scaling factors for sigma effective\n')

for i = 1:length(sigmaData)
    
    
       if ismember(sigmaData(i).numcode.ATOMj,      [conditions.methyl(1:8).grpNum])
            
            % if the final magnetization is on a methyl group, the cross
            % peak is a superposition of 3 pathways that are not scaled
            % properly by I(0)
            
            Sj  = 3; %all atom
            Slj = 3; %schneller austausch
            
       elseif ismember(sigmaData(i).numcode.ATOMj,  [conditions.methyl(9:10).grpNum])
            
            % if the final magnetization is on val where QG1 and QG2 are
            % overlapped, on leu where QD1 and QD2 are overlapped, the
            % cross peak is a superposition of 6 pathways that are not
            % scaled properly by I(0)
            
            Sj  = 6; 
            Slj = 3;
            
       elseif ismember(sigmaData(i).numcode.ATOMj,  [conditions.methylene(1:13).grpNum])
            
            % if the final magnetization is on a methylene or aromatic
            % group (QA(gly); QB, QG; QD; QE; QG(ile); QD(asn); QE(gln);
            % QZ(lys, 3HZ has PKa 11); QH1(arg); QH2(arg); QD(phe,tyr);
            % QE(phe,tyr)), the cross peak is a superposition of 2 pathways
            % that are not scaled properly by I(0)
            
            Sj  = 2; 
            Slj = 1; 
            
       elseif ismember(sigmaData(i).numcode.ATOMj,  [conditions.methylene(14:15).grpNum])
            
            % if the final magnetization is on arg where QH1 and QH2 are
            % overlapped (although below PKa 12.5, second HH1 invisible),
            % or an aromatic group where QD and QE overlapped, the cross
            % peak is a superposition of 4 pathways that are not scaled
            % properly by I(0)
            
            Sj  = 4; 
            Slj = 1;
            
       else
            
            Sj  = 1;
            Slj = 1;
            
       end
            
       if ismember(sigmaData(i).numcode.ATOMi,      [conditions.methyl(1:8).grpNum])
            
            Si  = 3; 

       elseif ismember(sigmaData(i).numcode.ATOMi,  [conditions.methyl(9:10).grpNum])

            Si  = 3; 
           
       elseif ismember(sigmaData(i).numcode.ATOMi,  [conditions.methylene(1:13).grpNum])
            
            Si  = 1; 
            
       elseif ismember(sigmaData(i).numcode.ATOMi,  [conditions.methylene(14:15).grpNum])
            
            Si  = 1;  
           
       else
            Si  = 1; 
       end
        
       sigmaData(i).numcode.sigmaEffScaling     = [Si Sj Slj];
       
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

        % Scale the izero values according to multiplicity
        % and the HN spins to D2O exchange

        sigmaData(i).numcode.ATOMmultiplicity(1) = atomMultiplicity(sigmaData(i).numcode.ATOMi,conditions);
        sigmaData(i).numcode.ATOMmultiplicity(2) = atomMultiplicity(sigmaData(i).numcode.ATOMj,conditions);
        
        if user.magOriginSpin == user.magNormSpin       % when normalizing to origin
        
            sigmaData(i).numcode.IzeroScaling   = 1;
            
            if  sigmaData(i).numcode.ATOMj      == 1    % If receiving atomtypes are HN, correct for percent D2O in sample
            
                sigmaData(i).numcode.corrD2O_factor     =  1 / (1 - user.perCentD2O / 100);
                        
            elseif  sigmaData(i).numcode.ATOMj  > 1     % If receiving atomtypes are not HN, do not correct for D2O in sample

                sigmaData(i).numcode.corrD2O_factor     = 1;
                        
            end
           
        else                                            % when normalizing to destination
        
            sigmaData(i).numcode.IzeroScaling   = sigmaData(i).numcode.ATOMmultiplicity(1)/sigmaData(i).numcode.ATOMmultiplicity(2);

            if  sigmaData(i).numcode.ATOMi      == 1    % If receiving atomtypes are HN, correct for percent D2O in sample
            
                sigmaData(i).numcode.corrD2O_factor     =  1 / (1 - user.perCentD2O / 100);
                        
            elseif  sigmaData(i).numcode.ATOMi  > 1     % If receiving atomtypes are not HN, do not correct for D2O in sample
            
                sigmaData(i).numcode.corrD2O_factor     = 1;
                        
            end

        end
        
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%        
    
end

end