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

Implement CrossSpectrum for unevenly sampled data? #533

Closed
dhuppenkothen opened this issue Jan 22, 2021 · 2 comments
Closed

Implement CrossSpectrum for unevenly sampled data? #533

dhuppenkothen opened this issue Jan 22, 2021 · 2 comments
Labels
enhancement Improve existing functionality. feature Additional functionality. help wanted We need additional help with these issues! low-priority Low-priority issues.

Comments

@dhuppenkothen
Copy link
Member

Maybe this would be a good idea. :)

@dhuppenkothen dhuppenkothen added enhancement Improve existing functionality. help wanted We need additional help with these issues! feature Additional functionality. low-priority Low-priority issues. labels Jan 22, 2021
@SamiraBhattacharya
Copy link

Hi, after some research, I have come up with this code. Do give me feedback on this.

from stingray import Lightcurve, Crossspectrum

# Generate some fake data
t1 = np.sort(np.random.uniform(0, 10, 100))
y1 = np.sin(2*np.pi*t1) + np.random.normal(0, 0.1, len(t1))
lc1 = Lightcurve(t1, y1)

t2 = np.sort(np.random.uniform(0, 10, 100))
y2 = np.sin(4*np.pi*t2) + np.random.normal(0, 0.1, len(t2))
lc2 = Lightcurve(t2, y2)

# Compute the cross spectrum
cs = Crossspectrum(lc1, lc2)
freq, power = cs.compute_crossspectrum(normalization='leahy')

# Plot the cross spectrum
import matplotlib.pyplot as plt
plt.plot(freq, power)
plt.xlabel('Frequency')
plt.ylabel('Power')
plt.show()

@matteobachetti
Copy link
Member

Addressed by @pupperemeritus' #737 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve existing functionality. feature Additional functionality. help wanted We need additional help with these issues! low-priority Low-priority issues.
Projects
None yet
Development

No branches or pull requests

3 participants