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

Light curve OGIP read/write #8

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open

Light curve OGIP read/write #8

wants to merge 15 commits into from

Conversation

ferrigno
Copy link

@ferrigno ferrigno commented Aug 9, 2024

I created the module lc.py that reads and writes a light curve in OGIP format.

There is an example of usage in tools.ipynb and in test_lc.py (this one not yet tested)

As I needed to access class properties while reading, I found it more natural to build the object from the filename, rather than from a staticmethod as in spectrum.py

TODO:

  • read/write the GTI extension, if present.
  • integrate it in tools.py ?

@ferrigno ferrigno requested a review from volodymyrss August 9, 2024 16:32
@ferrigno ferrigno marked this pull request as draft August 9, 2024 16:32
@ferrigno ferrigno changed the title DRAFT to be commented: Light curve OGIP read/write Light curve OGIP read/write Aug 9, 2024
@volodymyrss volodymyrss requested a review from dsavchenko August 13, 2024 13:56
@volodymyrss volodymyrss linked an issue Aug 13, 2024 that may be closed by this pull request
@volodymyrss volodymyrss assigned ferrigno and unassigned dsavchenko Aug 13, 2024
ogip/lc.py Outdated Show resolved Hide resolved
ogip/spec.py Outdated
f = fits.open(fn)
if 'RATE' in f['SPECTRUM'].data.names:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please put this change in a different PR so it can be assessed separately?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

ogip/lc.py Outdated Show resolved Hide resolved
Copy link
Member

@volodymyrss volodymyrss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, it's a good start!

@ferrigno ferrigno marked this pull request as ready for review August 20, 2024 16:12
@ferrigno ferrigno requested a review from volodymyrss August 20, 2024 16:13
lc = ogip.lc.Rate(fn)
k = fn.rfind('.')
new_fn = fn[0:k] + '_ogip.' + fn[k + 1:]
lc.to_fits(new_fn)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you check something basic about the content, at least that it's non-zero, there is total sum, etc?

@dsavchenko
Copy link
Member

I found it more natural to build the object from the filename, rather than from a staticmethod as in spectrum.py

It may also be @classmethod, which is the most natural for such kind of methods, in my opinion. With your current approach, it's complicated to build an instance programmatically, if there is no file already available.

Anyway, the interface will have to be unified later on.

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.

add LC standard
3 participants