Crossspectrum.power only returning real component
See original GitHub issueHi,
I’m having an issue where the Crossspectrum object is only returning the real part of the CS, while I would quite like to also see the imaginary part. Looking at the source code it would seem that passing ‘none’ to norm should retain the full complex number, however on my version (1.0) this is not the case - still only receiving the real part.
Code to re-produce:
import numpy as np
from stingray import Lightcurve, Crossspectrum
#Generating mock light-curves
dt = 0.5
ts = np.arange(0, 200, 0.5)
l1 = 80 * np.sin(np.pi*ts/10) + 100
l2 = 20 * np.sin(np.pi*ts/10 + np.pi/2) + 10
l1_noise = np.random.poisson(l1 * dt)
l2_noise = np.random.poisson(l2 * dt)
lc1 = Lightcurve(ts, l1_noise, skip_checks=True, dt=dt)
lc2 = Lightcurve(ts, l2_noise, skip_checks=True, dt=dt)
cs_s = Crossspectrum(lc1, lc2, norm='none')
print(cs_s.power.imag)
I think that some option in Crossspectrum to return the full complex number would be nice 😃
Cheers, Scott
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Ah, yes that works!! Thank you @matteobachetti !
My vote is to leave the default as-is but note it more in the docstrings.