Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/routes/v1/lsst/objects/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2025 AstroLab Software
# Copyright 2025-2026 AstroLab Software
# Author: Julien Peloton
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -43,7 +43,7 @@ def extract_object_data(payload: dict) -> pd.DataFrame:
if "," in payload["diaObjectId"]:
# multi-objects search
splitids = payload["diaObjectId"].split(",")
splitids = [i.split() for i in splitids]
splitids = [i.strip() for i in splitids]
# add salt
objectids = [f"key:key:{i[-3:]}_{i}" for i in splitids]
else:
Expand Down
13 changes: 9 additions & 4 deletions apps/routes/v1/lsst/resolver/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,15 @@ def resolve_name(payload: dict) -> pd.DataFrame:
tmp = pd.DataFrame.from_dict(hbase_to_dict(results), orient="index")
# drop duplicates
tmp = tmp.drop_duplicates()
# remove xmatch artifacts on high cadence
pdf = tmp[
tmp["f:xm_tns_fullname"].apply(lambda x: x != "nan" and not pd.isna(x))
]
if "f:xm_tns_fullname" in tmp.columns:
# remove xmatch artifacts on high cadence
pdf = tmp[
tmp["f:xm_tns_fullname"].apply(
lambda x: x != "nan" and not pd.isna(x)
)
]
else:
pdf = tmp
else:
# indices are case-insensitive
# salt is last letter of the name
Expand Down
23 changes: 9 additions & 14 deletions apps/routes/v1/lsst/sso/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,24 @@
def resolve_packed(n_or_d):
"""Resolve all packed names corresponding to input n_or_d"""
n_or_d = str(n_or_d)
# check if the object is an asteroid or a comet
if n_or_d.startswith("C/") or n_or_d.endswith("P"):
obj_type = "Comet"
else:
obj_type = "Asteroid"

# Pure quaero implementation
r = requests.get(
"https://api.ssodnet.imcce.fr/quaero/1/sso?q={}&type={}".format(
n_or_d.replace(" ", "_"), obj_type
"https://ssp.imcce.fr/webservices/ssodnet/api/resolver.php?-name=a:EQUAL:{}&-mime=json&-from=FINK".format(
n_or_d
)
)
if r.status_code == 200 and r.json() != []:
if r.json()["total"] > 0:
sso_name = r.json()["data"][0]["name"]
sso_name = r.json()["data"][0]["name"]

aliases = r.json()["data"][0]["aliases"]
aliases = r.json()["data"][0]["aliases"]
aliases = [i.strip() for i in aliases.split(",")]

# The provisional designation stored on the orbit and
# observations is stored in a 7-character packed format
aliases = [al for al in aliases if len(al) == 7]
# The provisional designation stored on the orbit and
# observations is stored in a 7-character packed format
aliases = [al for al in aliases if len(al) == 7]

return sso_name, aliases
return sso_name, aliases
return "", []


Expand Down