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.

Crossspectrum.power only returning real component

See original GitHub issue

Hi,

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:open
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
scotthgncommented, Mar 4, 2022

Ah, yes that works!! Thank you @matteobachetti !

0reactions
abigailStevcommented, Mar 26, 2022

My vote is to leave the default as-is but note it more in the docstrings.

Read more comments on GitHub >

github_iconTop Results From Across the Web

stingray/crossspectrum.py at main · StingraySoftware ... - GitHub
power : numpy.nd.array. The normalized co-spectrum (real part of the cross spectrum). For. 'none' normalization, imaginary part is returned as well.
Read more >
Cross Spectra — stingray v1.1.2.dev8+gdfd899c
We can print the first five values in the arrays of the positive Fourier frequencies and the cross power. The cross power has...
Read more >
CrossSpectrum - NI - National Instruments
The real part of the double-sided cross power spectrum between signals X and Y. The size of this array must be at least...
Read more >
Chapter 6c: Cross-Spectral Analysis PDF
Suppose we have two time series whose power spectra both are ... This is the cross-spectrum of x at y for wave k...
Read more >
CROSS_SPEC - L3HarrisGeospatial.com
This function estimates the power cross-spectrum of two vectors. ... AMPLITUDE: Returns the amplitude component of the cross-spectrum.
Read more >

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