Skip to content
Open
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
27 changes: 14 additions & 13 deletions apps/routes/v1/lsst/sso/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
import requests
from flask import Response

# from fink_utils.sso.miriade import get_miriade_data
from fink_utils.sso.miriade import get_miriade_data

# from fink_utils.sso.spins import func_hg1g2_with_spin, estimate_sso_params
from line_profiler import profile

Expand Down Expand Up @@ -86,6 +87,10 @@ def extract_sso_data(payload: dict) -> pd.DataFrame:
# For name resolving, i:ssnamenr must be here
# In case the user forgot, let's add it silently
cols += ",r:packed_primary_provisional_designation"
if truncated and with_ephem and "r:midpointMjdTai" not in cols:
cols += ",r:midpointMjdTai"
if truncated and with_ephem and "r:psfFlux" not in cols:
cols += ",r:psfFlux"

n_or_d = str(payload["n_or_d"])

Expand Down Expand Up @@ -164,18 +169,14 @@ def extract_sso_data(payload: dict) -> pd.DataFrame:
lambda x: sso_names[x]
)

# if with_ephem:
# # TODO: In case truncated is True, check (before DB call)
# # the mandatory fields have been requested
# # TODO: We should probably add a timeout and try/except
# # in case of miriade shutdown
# pdf = get_miriade_data(pdf, sso_colname="sso_name")
# if "i:magpsf_red" not in pdf.columns:
# rep = {
# "status": "error",
# "text": "We could not obtain the ephemerides information. Check Miriade availabilities.",
# }
# return Response(str(rep), 400)
if with_ephem:
pdf = get_miriade_data(pdf, survey="lsst", observer="X05", shift=0.0)
if "i:magpsf_red" not in pdf.columns:
rep = {
"status": "error",
"text": "We could not obtain the ephemerides information. Check Miriade availabilities.",
}
return Response(str(rep), 400)

# if with_residuals:
# # TODO: In case truncated is True, check (before DB call)
Expand Down
2 changes: 1 addition & 1 deletion apps/routes/v1/ztf/sso/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ def extract_sso_data(payload: dict) -> pd.DataFrame:
# the mandatory fields have been requested
# TODO: We should probably add a timeout and try/except
# in case of miriade shutdown
pdf = get_miriade_data(pdf, sso_colname="sso_name")
pdf = get_miriade_data(pdf, survey="ztf", observer="I41", shift=15.0)
if "i:magpsf_red" not in pdf.columns:
rep = {
"status": "error",
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ flask
flask-restx
pandas
numpy
fink-filters==7.31
fink-utils==0.59.0
fink-filters==7.33
fink-utils==0.64.0
line_profiler
requests
pyarrow
Expand Down
Loading