astrodatadownloader: add functionality to choose SLC/LLC for Kepler/K2

This commit is contained in:
2024-03-06 11:37:15 +01:00
parent 36597a6bfe
commit 2908d986ec
@@ -71,17 +71,39 @@ def getStarObservations(starName: str, sources: list[ObservationSource], sequenc
return obs[obsWantedFilter] 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) dataProducts = Observations.get_product_list(obs_wanted)
# LC: TESS lightcurve # LC: TESS lightcurve
# SLC: Kepler short cadence lightcurve # SLC: Kepler short cadence lightcurve
# LLC: Kepler long cadence lightcurve # LLC: Kepler long cadence lightcurve
productSubGroups = ["LC", "SLC"] 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, keplerProducts = Observations.filter_products(dataProducts, obs_collection="Kepler",
productSubGroupDescription=productSubGroups) 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") productsWanted = productsWanted.group_by("productFilename")
filenames = Observations.download_products(productsWanted) filenames = Observations.download_products(productsWanted)