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

Method to transform FluxPoints to stingray.Lightcurve #5170

Closed
wants to merge 2 commits into from

Conversation

cgalelli
Copy link
Contributor

This draft PR introduces a basic method for transforming a FluxPoints object to a stingray.Lightcurve object. Only objects with format="lightcurve" and one energy bin are allowed.

This could give access to hybrid workflows (at least one way) between the two packages.

Signed-off-by: cgalelli <claudio.galelli@obspm.fr>
Signed-off-by: cgalelli <claudio.galelli@obspm.fr>
@bkhelifi
Copy link
Member

bkhelifi commented Mar 14, 2024

`stringray' is not a dependency of Gammapy. One should then mention in the docstring that is uses it (then pip install) or to discuss the possibility to add this library into our dependencies.
If we keep it as optional, the import of the library should be made in the code and protected.
PS: and this is the primary cause of the failure of the tests ...

@cgalelli
Copy link
Contributor Author

@bkhelifi I am well aware that stingray is not a dependency; this PR inserts itself in the larger discourse about whether to add it or not. It is mostly a proof-of-concept of how a translator (in one direction) would work in case we decide to add it.

@adonath
Copy link
Member

adonath commented Mar 14, 2024

@cgalelli How different is the stingray light curve format from the one from Astropy? (see https://docs.astropy.org/en/stable/timeseries/index.html)

@cgalelli
Copy link
Contributor Author

@adonath stingray provides three different "Time series"-like objects: stingray.StingrayTimeseries (the most similar to astropy time series), stingray.Lightcurve (with most utilities for variability and analysis in general) and stingray.EventList (for unbinned or photon-to-photon analyses). stingray.Lightcurve shares many similarities with the astropy object, and there is in fact a translator provided by stingray itself; however it has some specificities that would render a "double translation" quite tricky.

@AtreyeeS
Copy link
Member

Maybe this motivates further the need for a gammapy Lightcurve object inheriting from FluxPoints, which can support a format=stringray option?

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.

4 participants