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

[WIP] Adding functionality to read fits files into dictionaries. #21

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

christinahedges
Copy link
Collaborator

The fits products downloaded by lksearch have various formats and units. We are building a more generic framework to hold and work with data like this.

To interface between the fits files and the new framework, we need a standard way to turn fits files into python objects we can parse.

I'm opening this WIP to show how I think we could do this. The function get_data_from_hdulist will:

  • Open any fits file
  • Store the header information as a dictionary
  • Store the column/data information as a dictionary
  • Store the WCS information as a dictionary
  • Resolve conflicting information by trusting the first data extension if there are any duplicate columns or header keywords with conflicting information
  • Optionally will store the data with the correct units.

The idea is that this converts any input fits file from the myriad TESS/Kepler/K2 data products (e.g. SPOC, TESS-SPOC, QLP, Eleanor, K2SFF, Everest, TESS-Cut) into something fairly easy to parse.

This does not do any of the checking to see if e.g. there is a flux column or to select which should be the "default" flux column in the event that there is more than one with different names.

This isn't designed to be merged [yet]. This might not be the final home for this functionality.

from lksearch.io import get_data_from_fits_file
from lksearch import KeplerSearch
sr = KeplerSearch('KIC 8462852')
path = sr.timeseries[0].download(quiet=True).loc[0, 'Local Path']
cards, cols, wcs = get_data_from_fits_file(path, units=False)

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.

1 participant