-
Notifications
You must be signed in to change notification settings - Fork 31
Make spectrum and correlation align with QuTiP
#330
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
Conversation
|
I have already done the function function spectrum_correlation_fft(tlist::AbstractVector, corr::AbstractVector; inverse::Bool=false)
N = length(tlist)
dt_list = diff(tlist)
dt = dt_list[1]
all(≈(dt), dt_list) || ArgumentError("tlist must be equally spaced for FFT.")
F = inverse ? N * ifft(corr) : fft(corr)
Flist = fftshift(F)
flist = fftshift(fftfreq(N, 1 / dt))
return 2 * π * flist, 2 * dt * real(Flist)
endThis gives the same result in |
|
Great |
|
I would also change the order of the arguments, since I think it is a bit different from QuTiP. |
spectrum align with QuTiPspectrum and correlation align with QuTiP
I also did it in this PR~ |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #330 +/- ##
==========================================
+ Coverage 93.19% 93.28% +0.09%
==========================================
Files 36 38 +2
Lines 2602 2637 +35
==========================================
+ Hits 2425 2460 +35
Misses 177 177 ☔ View full report in Codecov by Sentry. |
Checklist
Thank you for contributing to
QuantumToolbox.jl! Please make sure you have finished the following tasks before opening the PR.make test.juliaformatted by running:make format.docs/folder) related to code changes were updated and able to build locally by running:make docs.CHANGELOG.mdshould be updated (regarding to the code changes) and built by running:make changelog.Request for a review after you have completed all the tasks. If you have not finished them all, you can also open a Draft Pull Request to let the others know this on-going work.
Description
The current implementation of
spectrumdoes not align with QuTiP (see the documentation here). Thespectrumshould only return the value of spectrum corresponding to the user specifiedω_list. Also, the peudo-inverse method is missing.Furthermore, in QuTiP, the spectra obtained from
fftof the correlation function is done by a function calledspectrum_correlation_fftinstead ofspectrum.Finally, we can support
nothinginput state for correlation functions, that will automatically solve thesteadystatefirst.TODO list:
spectrumandcorrelationfunctions into independent filesspectrumandcorrelationfunctions to align withQuTiP(also add the deprecated methods todeprecated.jl)correlationfunctionsMatrixdimension order to align withQuTiPω_listinspectrumfunctionnothing::Nothinginput state for correlation functions [only when Hamiltonian is constant (Qobj)]QobjEvo) as an input forcorrelationfunctions.FFTCorrelation(move it todeprecated.jl)spectrum_correlation_fft(tlist, corr)to replace the functionality ofFFTCorrelationPseudoInverse <: SpectrumSolverforspectrumcorrelation_3op_1tTwo-time correlation functions