Skip to content

Commit

Permalink
in progress changes to searching for ffi data
Browse files Browse the repository at this point in the history
  • Loading branch information
tylerapritchard committed Feb 2, 2024
1 parent 9d58b95 commit b8a94e7
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/newlk_search/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,13 +921,16 @@ def _search_products(
).tolist()

# Speed up by restricting the MAST query if we don't want FFI image data
extra_query_criteria = {}
if not any(['ffi' in ftype.lower() for ftype in filetype]):
# At MAST, non-FFI Kepler pipeline products are known as "cube" products,
# and non-FFI TESS pipeline products are listed as "timeseries".
extra_query_criteria["dataproduct_type"] = ["cube", "timeseries"]
# At MAST, non-FFI Kepler pipeline products are known as "cube" products,
# and non-FFI TESS pipeline products are listed as "timeseries".
# NEW CHANGE - we're speeding this up by not including TESS FFI images in the search.
# We will handle them separately using something else (tesswcs? tesspoint?)
# Also the above is written like FFI kepler products exist, but I don't think they do?

extra_query_criteria["dataproduct_type"] = ["cube", "timeseries"]

# Query Mast to get a list of observations

observations = _query_mast(
target,
radius=radius,
Expand Down Expand Up @@ -985,10 +988,11 @@ def _search_products(
joint_table["sequence_number"].isna())
re_expr = r".*Q(\d+)"
seq_num[mask] = [re.findall(re_expr, item[0])[0] if re.findall(re_expr, item[0]) else "" for item in joint_table.loc[mask,["description"]].values]

# K2 campaigns 9, 10, and 11 were split into two sections, which are
# listed separately in the table with suffixes "a" and "b"
mask = ((joint_table["project"] == "K2") &
(joint_table["sequence_number"].values in [9, 10, 11]))
(joint_table["sequence_number"].values.isin([9, 10, 11])))

for index, row in joint_table[mask].iterrows():
for half, letter in zip([1,2],["a","b"]):
Expand All @@ -1013,6 +1017,7 @@ def _search_products(
sector=sector,
limit=limit,
)
print(masked_result)
log.debug(f"MAST found {len(masked_result)} matching data products.")
#masked_result["distance"].info.format = ".1f" # display <0.1 arcsec

Expand Down Expand Up @@ -1054,8 +1059,9 @@ def _search_products(
ffi_result = Table(cutouts)
ffi_result = ffi_result.to_pandas()

query_result = pd.concat([masked_result,
ffi_result]).sort_values(["distance",

query_result = pd.concat((masked_result,
ffi_result)).sort_values(["distance",
"obsid",
"sequence_number"])

Expand Down Expand Up @@ -1254,6 +1260,7 @@ def _filter_products(
mask &= ~np.array(
[prov.lower() == "kepler" for prov in products["provenance_name"]]
)

if "kepler" in provenance_lower and campaign is None and sector is None:
mask |= _mask_kepler_products(products, quarter=quarter, month=month)

Expand Down

0 comments on commit b8a94e7

Please sign in to comment.