EasySpin icon indicating copy to clipboard operation
EasySpin copied to clipboard

Lorentzian dispersion template is overtruncated

Open stestoll opened this issue 1 year ago • 2 comments

clear, clc

Sys.lw = [0 10];

Exp.Field = 340;
Exp.mwRange = [9 10];
Exp.Harmonic = 0;
Exp.mwPhase = pi/2;

[f,spc] = pepper(Sys,Exp);
plot(f,spc);

Image

stestoll avatar Jan 19 '25 19:01 stestoll

Preliminary testing shows that the Lorentz line template function has no bugs.

test code: clc, clear, clf;

x = linspace(-10, 10, 1e3); x0 = 0; fwhm = 1;

subplot(2, 2, 1); [yabs, ydisp] = lorentzian(x, x0, fwhm, -1); plot(x, yabs, 'r'); hold on; plot(x, ydisp, 'b'); legend('Absorption', 'Dispersion'); xlabel('x'); ylabel('Amplitude');

subplot(2, 2, 2); [yabs, ydisp] = lorentzian(x, x0, fwhm, 0); plot(x, yabs, 'r'); hold on; plot(x, ydisp, 'b'); legend('Absorption', 'Dispersion'); xlabel('x'); ylabel('Amplitude');

subplot(2, 2, 3); [yabs, ydisp] = lorentzian(x, x0, fwhm, 1, pi/2); plot(x, yabs, 'r'); hold on; plot(x, ydisp, 'b'); legend('Absorption', 'Dispersion'); xlabel('x'); ylabel('Amplitude');

subplot(2, 2, 4); [yabs, ydisp] = lorentzian(x, x0, fwhm, 2, pi); plot(x, yabs, 'r'); hold on; plot(x, ydisp, 'b'); legend('Absorption', 'Dispersion'); xlabel('x'); ylabel('Amplitude');

Image

For Gaussian and Lorentzian functions, the fixed parameters adopted here may introduce potential bugs. It has been found that for the same lw, for Gaussian and Lorentzian line modes, x0T, wT, xT are different, which should not make a difference. . .

Image Image

I don't quite understand why fixed parameters are used here, but preliminary tests have found that the current bug can be fixed by changing this "reduction factor" to 1e3 or larger.

Image Image

cerium1925 avatar Jan 20 '25 10:01 cerium1925

Yes, you are spot on. Extending the range over which the template lineshape is evaluated reduces this truncation error.

The issue is that for a reasonably accurate dispersion template (ie. falling off to at least 0.25e-2 of its maximum, or better), it would need to be about 800 fwhm linewidths wide. The absorption template only needs 20 fwhm linewidths.

Image

 clc, clear

x0 = 0;
fwhm = 1;

xabs = linspace(-1,1,1e4)*20*fwhm;
yabs = lorentzian(xabs,x0,fwhm,0,0);
yabs = yabs/max(yabs);

xdisp = linspace(-1,1,1e4)*800*fwhm;
ydisp = lorentzian(xdisp,x0,fwhm,0,pi/2);
ydisp = ydisp/max(ydisp);

tol = 0.25e-2;

tiledlayout(2,1)
nexttile
semilogy((xabs-x0)/fwhm,yabs);
xlabel('(x-x0)/fwhm')
ylabel('abs/max(abs)');
grid on
yline(tol,Color='r')
title('Lorentzian absorption')

nexttile
semilogy((xdisp-x0)/fwhm,abs(ydisp));
xlabel('(x-x0)/fwhm')
ylabel('disp/max(disp)');
grid on
yline(tol,Color='r')
title('Lorentzian dispersion')

stestoll avatar Jan 21 '25 06:01 stestoll