Skip to content

[programming] access lsst data #72

@sdcorle1

Description

@sdcorle1

I am following the instructions for querying lsst data. Here is my code which works fine when I choose survey = 'ztf':

from alerce.core import Alerce

Initialize the client

alerce = Alerce()

Query objects from ZTF

lsst_objects = alerce.query_objects(
survey="lsst",
classifier="lc_classifier",

class_name="SN",

probability=0.8,

format="pandas"

)

print("lsst_objects = ", lsst_objects)

Get lightcurve for a specific ZTF object

if len(ztf_objects) > 0:
oid = ztf_objects.iloc[0]['oid']
lightcurve = alerce.query_lightcurve(
oid=oid,
survey="lsst",
format="json"
)
print("lightcurve = ", lightcurve)
# Get detections separately
detections = alerce.query_detections(
oid=oid,
survey="lsst",
format="pandas"
)
print("detections = ", detections)

but, when I run with survey = 'lsst', it errors out:

Traceback (most recent call last):
File "/Users/subercorley/Library/Mobile Documents/comappleCloudDocs/Projects/alerce/lsstaccess.py", line 7, in
lsst_objects = alerce.query_objects(
survey="lsst",
...<3 lines>...
format="pandas"
)
File "/opt/miniconda3/lib/python3.13/site-packages/alerce/common_search.py", line 75, in query_objects
return self.multisurvey_client.query_objects(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
survey, format=format, index=index, sort=sort, **kwargs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/opt/miniconda3/lib/python3.13/site-packages/alerce/ms_search.py", line 60, in query_objects
q = self._request(
"GET",
...<3 lines>...
response_field=None,
)
File "/opt/miniconda3/lib/python3.13/site-packages/alerce/utils.py", line 169, in _request
handle_error(resp, response_format)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/lib/python3.13/site-packages/alerce/exceptions.py", line 21, in handle_error
raise codes.get(code, APIError)(
message=message, code=code, data=data, response=response
)
alerce.exceptions.APIError: {'Error code': 500, 'Message': 'An error occurred', 'Data': {}}

Does the exception error mean that there is no lsst data or is there another issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions