astrodatadownloader: add functionality to choose SLC/LLC for Kepler/K2
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user