Skip to content

Feature: correlated time series#973

Open
SethHtes wants to merge 13 commits intoStingraySoftware:mainfrom
SethHtes:features/correlated-time-series
Open

Feature: correlated time series#973
SethHtes wants to merge 13 commits intoStingraySoftware:mainfrom
SethHtes:features/correlated-time-series

Conversation

@SethHtes
Copy link
Copy Markdown

Summary

This PR adds support for simulating pairs correlated time series with user-specified cross spectral properties

Implementation

Adds a new class CrossSpectrumSimulator to stingray.simulator. This class subclasses the stingray.simulator.Simulator class and retains most of the same parameters. The main addition is in CrossSpectrumSimulator.CS_simulate, which allows for the specification of two power spectrum shapes and cross spectral information. It then returns two stingray.Lightcurve instances which have the specified power spectral shapes and cross spectral information.

This is done via extension to the widely used Timmer and Koenig implementation of simulating time series which is currently implemented in stingray.

CS_simulate supports specifying power spectral information by power law index, pre-defined model, user-provided spectrum, or stingray model string, much like stingray.simulator.simulate().

Cross-spectral information can be specified in much the same way, either by providing a phase lag profile and coherence profile or by providing a real and imaginary part of the cross spectrum.

Tests

Tests for the new class can be found under TestCrossSpectrumSimulator in stingray.simulator.tests

Other notes:

The full derivation of this method is described in a paper I have submitted and which is currently under review in RASTI. I am happy to provide a draft copy upon request.

@matteobachetti
Copy link
Copy Markdown
Member

@SethHtes thanks for your PR. A simulator lilke this is really useful, and a great addition to stingray! Would you mind sending me the draft paper at name . surname at inaf.it?
In the meantime, some minor requests:

  1. a quick demonstration, here as a comment or with a jupyter notebook, of the method. A jupyter notebook is better, it can become straight away part of the documentation.
  2. A changelog entry named docs/changes/973.feature.rst describing the addition in one line (such a feature deserves that!)
  3. Look at the failing checks, there might be some formatting issue and a broken link. Tests for this feature will have to be skipped in Python 3.8 because it uses a typing version that does not allow some of the syntax you used. Not worth solving the problem, we will have ditch Python 3.8 soon-ish because it's not supported by some major dependencies anyway.

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.

2 participants