Skip to content

Fix AveragedCrossspectrum for input_counts=False light curves#978

Open
VrtxOmega wants to merge 1 commit into
StingraySoftware:mainfrom
VrtxOmega:fix-stingray-avg-crossspectrum-977
Open

Fix AveragedCrossspectrum for input_counts=False light curves#978
VrtxOmega wants to merge 1 commit into
StingraySoftware:mainfrom
VrtxOmega:fix-stingray-avg-crossspectrum-977

Conversation

@VrtxOmega

Copy link
Copy Markdown

Relevant Issue(s)/PR(s)

Fixes #977.

Provide an overview of the implemented solution or the fix and elaborate on the modifications.

AveragedCrossspectrum was passing the private light-curve storage fields (_counts and _counts_err) into the shared time-series cross-spectrum helper. For light curves created with input_counts=False, those private counts arrays can be unset until the public counts/counts_err properties are accessed, so the helper can treat the data like event input and return zero powers.

This updates the light-curve path to pass the public counts and counts_err attributes, matching the existing AveragedPowerspectrum behavior, and adds a regression test for an identical countrate light curve where the averaged cross spectrum should match the averaged power spectrum.

Is there a new dependency introduced by your contribution? If so, please specify.

No.

Any other comments?

Validation run locally:

  • .venv/bin/python -m pytest stingray/tests/test_crossspectrum.py::TestAveragedCrossspectrum::test_input_countrate_matches_pds_for_identical_lightcurves -q
  • Issue repro before/after: input_counts=False changed from all-zero cross-spectrum powers to matching AveragedPowerspectrum, while input_counts=True remained matching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AveragedCrossspectrum returns zeros when using simulated light curves with input_counts=False.

1 participant