Skip to content

Light curve OGIP read/write#8

Open
ferrigno wants to merge 15 commits into
masterfrom
LightCurve
Open

Light curve OGIP read/write#8
ferrigno wants to merge 15 commits into
masterfrom
LightCurve

Conversation

@ferrigno

@ferrigno ferrigno commented Aug 9, 2024

Copy link
Copy Markdown

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
Comment thread ogip/lc.py Outdated
Comment thread ogip/spec.py Outdated
def from_file_name_normal(fn):

f = fits.open(fn)
if 'RATE' in f['SPECTRUM'].data.names:

Copy link
Copy Markdown
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
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done

Comment thread ogip/lc.py Outdated

@volodymyrss volodymyrss left a comment

Copy link
Copy Markdown
Member

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
Comment thread tests/test_lc.py
lc = ogip.lc.Rate(fn)
k = fn.rfind('.')
new_fn = fn[0:k] + '_ogip.' + fn[k + 1:]
lc.to_fits(new_fn)

Copy link
Copy Markdown
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
Copy Markdown
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