From 2908d986ecd3889db4a7d9872623da6bbfd65aaf Mon Sep 17 00:00:00 2001 From: SGCMarkus Date: Wed, 6 Mar 2024 11:37:15 +0100 Subject: [PATCH] astrodatadownloader: add functionality to choose SLC/LLC for Kepler/K2 --- .../astrodatadownloader.py | 28 +++++++++++++++++-- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/main/astrodatadownloader/astrodatadownloader.py b/main/astrodatadownloader/astrodatadownloader.py index 4430c29..f7936fb 100644 --- a/main/astrodatadownloader/astrodatadownloader.py +++ b/main/astrodatadownloader/astrodatadownloader.py @@ -71,17 +71,39 @@ def getStarObservations(starName: str, sources: list[ObservationSource], sequenc return obs[obsWantedFilter] -def downloadStarProducts(obs_wanted): +def downloadStarProducts(obs_wanted, keplerCadences, k2Cadences): + if(len(keplerCadences) is not 2): + raise Exception("keplerCadences needs to have length 2") + if(len(k2Cadences) is not 2): + raise Exception("k2Cadences need to have length 2") + dataProducts = Observations.get_product_list(obs_wanted) # LC: TESS lightcurve # SLC: Kepler short cadence lightcurve # LLC: Kepler long cadence lightcurve productSubGroups = ["LC", "SLC"] + tessProducts = Observations.filter_products(dataProducts, obs_collection="TESS", + productSubGroupDescription=["LC"]) + keplerSubGroups = [] + if(keplerCadences[0]): + keplerSubGroups.append("SLC") + if(keplerCadences[1]): + keplerSubGroups.append("LLC") - productsWanted = Observations.filter_products(dataProducts, - productSubGroupDescription=productSubGroups) + keplerProducts = Observations.filter_products(dataProducts, obs_collection="Kepler", + productSubGroupDescription=keplerSubGroups) + k2SubGroups = [] + if(k2Cadences[0]): + k2SubGroups.append("SLC") + if(k2Cadences[1]): + k2SubGroups.append("LLC") + + k2Products = Observations.filter_products(dataProducts, obs_collection="K2", + productSubGroupDescription=k2SubGroups) + + productsWanted = table.vstack([tessProducts, keplerProducts, k2Products]) productsWanted = productsWanted.group_by("productFilename") filenames = Observations.download_products(productsWanted)