Skip to content

Commit

Permalink
Fix queries again
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecThomson committed May 23, 2024
1 parent d75c255 commit 2f06cf3
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions arrakis/makecat.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,9 +887,19 @@ def main(
query = {
"$and": [
{"Source_ID": {"$in": all_island_ids}},
{"rm_outputs_1d": {"$elemMatch": {"field": save_name}}},
{"rm_outputs_1d": {"$elemMatch": {"rmsynth1d": True}}},
{"rm_outputs_1d": {"$elemMatch": {"rmclean1d": True}}},
{
"rm_outputs_1d": {
"$elemMatch": {
"$and": [
{"field": save_name},
{"rmsynth1d": True},
{"rmclean1d": True},
{"rmsynth_summary": {"$exists": True}},
{"rmclean_summary": {"$exists": True}},
],
}
},
},
]
}

Expand Down Expand Up @@ -951,7 +961,6 @@ def main(
)
pipeline = [{"$match": query}, {"$project": fields}]
comps_df = pd.DataFrame(comp_col.aggregate(pipeline))
comps_df.set_index("Source_ID", inplace=True)
# For sanity
comps_df = comps_df.loc[
comps_df.rmclean1d.astype(bool) & comps_df.rmsynth1d.astype(bool)
Expand All @@ -960,6 +969,7 @@ def main(
subset=["rmclean_summary", "rmsynth_summary", "rmclean1d", "rmsynth1d"],
inplace=True,
)
comps_df.set_index("Source_ID", inplace=True)
tock = time.time()
logger.info(f"Finished component collection query - {tock-tick:.2f}s")
logger.info(f"Found {len(comps_df)} components to catalogue. ")
Expand Down

0 comments on commit 2f06cf3

Please sign in to comment.