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

lc.to_fits() + lk.io.read() does not preserve correct FLUX_ORIGIN meta data for SAP_FLUX data #1371

Open
pmaxted opened this issue Oct 20, 2023 · 1 comment
Labels
🐛 bug Something isn't working

Comments

@pmaxted
Copy link

pmaxted commented Oct 20, 2023

If SAP_FLUX data are downloaded and saved as a FITS file then re-loading the data using lk.io.read() assigns the incorrect value to lc.meta['FLUX_ORIGIN']

Example

>>> import lightkurve as lk
>>> s = lk.search_lightcurve('HD1',author='TESS-SPOC',exptime=200)
>>> lc = s.download_all(flux_column='sap_flux').stitch()
>>> print(lc.meta['FLUX_ORIGIN'])
>>> print(lc.flux[42])
>>> lc.to_fits('test.fits',overwrite=True)
>>> lctest = lk.io.read('test.fits')
>>> print(lctest.meta['FLUX_ORIGIN'])
>>> print(lctest.flux[42])

sap_flux
0.9995154142379761
pdcsap_flux
0.9995154142379761 electron / s

Expected behavior

lc.to_fits() needs to write the FLUX_ORIGIN value to the header of the output FITS file so that lk.io.read() can read this keyword and assign the correct value to this item in the meta data.

Environment

  • platform: Windows
  • lightkurve version: '2.4.1'
  • installation method: pip
@Nschanche Nschanche added the 🐛 bug Something isn't working label Oct 20, 2023
@orionlee
Copy link
Collaborator

The issue is essentially a symptom of the underlying problem, discussed in #896

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants