question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

correlation_2op_1t() and spectrum() giving the physically incorrect result unless solver='es'

See original GitHub issue

Describe the bug See discussion here:

https://groups.google.com/g/qutip/c/2lod1DuFZiE/m/y8Bj6dKHDAAJ?pli=1

To my surprise, my PhD student had this problem again today, I am a bit surprised nothing has been done about this.

At least making es the default solver for correlation and spectrum, updating the docs to give a warning to only use the es solver (for now?), and maybe longer term figuring out why the other solvers are not handling it properly

To Reproduce

https://github.com/gsteele13/gary-exploring-qutip/blob/master/Correlations.ipynb

import numpy as np
import pylab as plt
from qutip import *

N = 5
w = 1 * 2 * np.pi              # 1 Hz oscillator frequency
Q = 40
kappa = w / Q

# Set up some operators
a = destroy(N)
n = num(N)
x = (a + a.dag())/np.sqrt(2)
p = -1j * (a - a.dag())/np.sqrt(2)
H = w * a.dag() * a

c_ops = []

psi0 = fock(N,0)
tlist = np.linspace(0, 10, 500)

corr = correlation_2op_1t(H, psi0, tlist, c_ops, x, x, solver='me')

wlist1, spec1 = spectrum_correlation_fft(tlist, corr)

plt.figure(figsize=(14,8))
plt.plot(tlist, np.real(corr))
plt.plot(tlist, np.imag(corr))
plt.show()

plt.figure(figsize=(14,8))
plt.plot(wlist1, np.abs(spec1))
plt.show()

Expected behavior Correlation should have an imaginary component and quantum PSD should not be symmetric about f = 0

Your Environment Software Version QuTiP 4.4.1 Numpy 1.17.4 SciPy 1.4.1 matplotlib 3.3.4 Cython 0.29.14 Number of CPUs 4 BLAS Info INTEL MKL IPython 7.9.0 Python 3.7.5 (default, Oct 25 2019, 10:52:18) [Clang 4.0.1 (tags/RELEASE_401/final)] OS posix [darwin] Wed Mar 10 08:51:15 2021 CET

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
AGaliciaMartinezcommented, Mar 28, 2021

Hi everyone, I would like to solve this issue. Is anyone working on it already or should I just go for it?

0reactions
jakelishmancommented, Mar 28, 2021

No-one that I know of is working on it - we’ve left it open for somebody to come and have a starting issue to work with. Thanks for taking it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found