Skip to content

Use lightkurve's cache instead of maintaining our own #230

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions pbjam/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,22 +345,10 @@ def query_lightkurve(id, download_dir, use_cached, lkwargs):

ext = set_cadence(lkwargs)

tgtfiles = lookup_cached_files(id, cache_dir, ext)

if (use_cached and (len(tgtfiles) != 0)):
lc_col = [lk.open(n) for n in tgtfiles]
lc_col = lk.search_lightcurvefile(target=id, **lkwargs).download_all(download_dir=cache_dir)
if lc_col is None:
raise ValueError("lightkurve could not find %s cadence data for %s in cache or on MAST" % (lkwargs['cadence'], id))

elif (not use_cached) or (use_cached and (len(tgtfiles) == 0)):
if (use_cached and (len(tgtfiles) == 0)):
warnings.warn('Could not find %s cadence data for %s in cache, checking MAST...' % (lkwargs['cadence'], id))

lc_col = launch_query(id, cache_dir, lkwargs)

if len(lc_col) == 0:
raise ValueError("Could not find %s cadence data for %s in cache or on MAST" % (lkwargs['cadence'], id))
else:
raise ValueError('Could not find any cached data, and failed to access MAST')

# Perform reduction on first lc of the lc collection and append the rest
lc0 = clean_lc(lc_col[0].PDCSAP_FLUX)
for i, lc in enumerate(lc_col[1:]):
Expand Down