Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Microwave phase is not working for a single-line spectrum #333

Open
stestoll opened this issue Mar 27, 2024 · 1 comment
Open

Microwave phase is not working for a single-line spectrum #333

stestoll opened this issue Mar 27, 2024 · 1 comment

Comments

@stestoll
Copy link
Member

stestoll commented Mar 27, 2024

The following should give two dispersion spectra (Exp.mwPhase=pi/2), but the one without Lorentzian broadening incorrectly returns the absorption spectrum.

clear, clc, clf

Exp.mwFreq = 9.5;
Exp.Range = [335 343];
Exp.mwPhase = pi/2;

Sys.lwpp = [1 0];
[B,spc_abs] = pepper(Sys,Exp);

Sys.lwpp = [1 0.1];
[B,spc_dis] = pepper(Sys,Exp);

plot(B,spc_abs,B,spc_dis);
legend('only Gaussian','incl Lorentzian')
@stestoll
Copy link
Member Author

stestoll commented Jan 16, 2025

In these cases, the spectrum is constructed using a template lineshape. If only a Gaussian broadening is given, then a Gaussian template is used, but gaussian does not have dispersion implemented for its integral. The Gaussian dispersion function is Dawson's integral, and the integral of that is the generalized hypergeometric function 1/2k^2 2F2(1,1;3/2,2;-k^2), where k = (x-x0)/sig/sqrt(2).

MATLAB's Symbolic Toolbox has hypergeom, which can evaluate this function, Since it uses exact arithmetic, it is very slow but accurate. Other purely numerical approaches (see e.g Julia's HypergeometricFunctions.jl) have challenges in the wings of the lineshape.

A numerical Hilbert transform is possible, but is inaccurate in the wings (shown here with a Lorentzian):

clear, clc
x = linspace(-1,1,1001)*5;
fwhm = 1;
Labs = lorentzian(x,0,fwhm,0,0);
Ldisp_exact = imag(hilberttrans(Labs));
Ldisp_transform = lorentzian(x,0,fwhm,0,pi/2);
plot(x,Ldisp_exact,x,Ldisp_transform)
legend('exact','Hilbert transform')

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant