function Pei = calc_Pei(Te,Ti,ne,Pei_fact);
% equipartion losses

% added the edge Ti to avoid singularity due to zero Te at edge
% (fix this later)
% densities in 1e19 and temperatures in keV (see Angioni Thesis)
Pei = 1e3*Pei_fact .* ((Te+Ti(end))*1e-3).^(-3/2) .* (ne*1e-19).* (Ti-Te);