PpdbTap#
- class lsst.analysis.ap.PpdbTap(url='https://data-int.lsst.cloud/api/ppdbtap', *, token=None, service=None, log=None)#
Bases:
objectLoad PPDB catalogs through the RSP TAP service as astropy Tables.
Parameters#
- url
str, optional TAP endpoint to query. Defaults to the prototype PPDB at
data-int.- token
str, optional RSP token with the
read:tapscope. If not given (andserviceis also not given), theRSP_TOKENenvironment variable is used.- service
pyvo.dal.TAPService, optional Pre-built TAP service. When supplied,
urlandtokenare ignored. Intended for use with unit tests.- log
logging.Logger, optional Logger to use; defaults to the module logger.
Notes#
The token is read only from the environment or the constructor argument and is never logged.
Methods Summary
load_forced_source(diaForcedSourceId, *[, ...])Load a single DiaForcedSource by id.
load_forced_sources(*, diaObjectId[, ...])Load DiaForcedSources, with the same filters as
load_sources.load_forced_sources_by_cone(*[, ra, dec, ...])Directly cone-search the DiaForcedSource table (prototype-only).
load_forced_sources_by_time_window(*[, ...])Load DiaForcedSources in a time window, any object (prototype-only).
load_forced_sources_for_object(diaObjectId, *)Load all DiaForcedSources associated with one diaObject.
load_forced_sources_for_region(*[, ra, dec, ...])Load DiaForcedSources for a region (object-first).
load_light_curve(diaObjectId)Assemble the full PPDB record for one diaObject.
load_object(diaObjectId, *[, columns])Load the current version of a single DiaObject.
load_objects(*[, ra, dec, radius, exposure, ...])Load DiaObjects, optionally within a spatial region.
load_source(diaSourceId, *[, columns])Load a single DiaSource by id.
load_sources(*, diaObjectId[, mjd_begin, ...])Load DiaSources for a given object (or objects), by time and band.
load_sources_by_cone(*[, ra, dec, radius, ...])Directly cone-search the DiaSource table (prototype-only).
load_sources_by_time_window(*[, mjd_begin, ...])Load DiaSources in a time window, any object (prototype-only).
load_sources_for_object(diaObjectId, *[, ...])Load all DiaSources associated with one diaObject.
load_sources_for_region(*[, ra, dec, ...])Load DiaSources for a region, the production-compatible way.
run_query(adql, *[, maxrec, order_table])Run an ADQL query and return the result as an astropy Table.
Methods Documentation
- load_forced_source(diaForcedSourceId, *, columns=None)#
Load a single DiaForcedSource by id.
Raises#
- RuntimeError
If the forced source does not exist.
- load_forced_sources(*, diaObjectId, mjd_begin=None, mjd_end=None, bands=None, columns=None, limit=100000, id_chunk_size=1000)#
Load DiaForcedSources, with the same filters as
load_sources.Like
load_sources,diaObjectIdis required and there is no spatial argument; useload_forced_sources_for_region, or the prototype-onlyload_forced_sources_by_cone/load_forced_sources_by_time_window.Returns#
- forced_sources
astropy.table.Table The matching DiaForcedSources, ordered by
midpointMjdTai.
Raises#
- ValueError
If
diaObjectIdis None.
- forced_sources
- load_forced_sources_by_cone(*, ra=None, dec=None, radius=None, exposure=None, padding=5.0, mjd_begin=None, mjd_end=None, bands=None, columns=None, limit=100000)#
Directly cone-search the DiaForcedSource table (prototype-only).
Warning
Not supported by the production PPDB; prototype/debugging only. Prefer
load_forced_sources_for_region.Returns#
- forced_sources
astropy.table.Table DiaForcedSources within the cone, ordered by
midpointMjdTai.
- forced_sources
- load_forced_sources_by_time_window(*, mjd_begin=None, mjd_end=None, bands=None, columns=None, limit=100000)#
Load DiaForcedSources in a time window, any object (prototype-only).
Warning
Not supported by the production PPDB; prototype/debugging only. Prefer
load_forced_sources_for_region. At least one ofmjd_begin/mjd_endis required.Returns#
- forced_sources
astropy.table.Table DiaForcedSources in the window, ordered by
midpointMjdTai.
Raises#
- ValueError
If neither
mjd_beginnormjd_endis given.
- forced_sources
- load_forced_sources_for_object(diaObjectId, *, columns=None, limit=100000)#
Load all DiaForcedSources associated with one diaObject.
Returns#
- forced_sources
astropy.table.Table The object’s DiaForcedSources, ordered by
midpointMjdTai.
- forced_sources
- load_forced_sources_for_region(*, ra=None, dec=None, radius=None, exposure=None, padding=5.0, mjd_begin=None, mjd_end=None, bands=None, columns=None, limit=100000, object_limit=100000, id_chunk_size=1000)#
Load DiaForcedSources for a region (object-first).
Same two-step workflow and caveats as
load_sources_for_region.Returns#
- forced_sources
astropy.table.Table DiaForcedSources of the objects in the region, ordered by time.
- forced_sources
- load_light_curve(diaObjectId)#
Assemble the full PPDB record for one diaObject.
Loads the current DiaObject plus all of its DiaSources and DiaForcedSources, time-ordered.
Parameters#
- diaObjectId
int Identifier of the object.
Returns#
- light_curve
DiaObjectLightCurve The object and its associated source time series.
Raises#
- RuntimeError
If no current version of the object exists.
- diaObjectId
- load_object(diaObjectId, *, columns=None)#
Load the current version of a single DiaObject.
Parameters#
- diaObjectId
int Identifier of the object to load.
- columns
list[str], optional Columns to select; defaults to all columns.
Returns#
- object
astropy.table.Row The current DiaObject row.
Raises#
- RuntimeError
If no current version of the object exists.
- diaObjectId
- load_objects(*, ra=None, dec=None, radius=None, exposure=None, padding=5.0, columns=None, limit=100000, latest=True)#
Load DiaObjects, optionally within a spatial region.
Parameters#
- ra, dec, radius
float, optional Cone-search center and radius, in degrees. All three must be given together; mutually exclusive with
exposure.- exposure
lsst.afw.image.Exposure, optional Load objects covering this exposure’s footprint (see
region_from_exposure). Mutually exclusive withra/dec/radius.- padding
float, optional Margin around the exposure footprint, in arcseconds (only used with
exposure).- columns
list[str], optional Columns to select; defaults to all columns.
- limit
int, optional Maximum number of rows to return; None means no limit.
- latest
bool, optional If True (default), return only the current version of each object (
validityEndMjdTai IS NULL). Setting this False returns every historical version and is rarely what you want.
Returns#
- objects
astropy.table.Table The matching DiaObjects.
- ra, dec, radius
- load_source(diaSourceId, *, columns=None)#
Load a single DiaSource by id.
Raises#
- RuntimeError
If the source does not exist.
- load_sources(*, diaObjectId, mjd_begin=None, mjd_end=None, bands=None, columns=None, limit=100000, id_chunk_size=1000)#
Load DiaSources for a given object (or objects), by time and band.
DiaSources are loaded by object:
diaObjectIdis required. This loader has no spatial argument, because the production PPDB does not permit searches on the source tables. To load sources for a region, useload_sources_for_region(object-first); for direct, object- unrestricted prototype-only access, useload_sources_by_coneorload_sources_by_time_window.Parameters#
- diaObjectId
intor iterable ofint Restrict to sources of this object, or of any of these objects (issued as chunked
diaObjectId IN (...)queries). Required.- mjd_begin, mjd_end
float, optional Restrict to
mjd_begin <= midpointMjdTai < mjd_end(TAI).- bands
list[str], optional Restrict to these bands (subset of
ugrizy).- columns
list[str], optional Columns to select; defaults to all columns.
- limit
int, optional Maximum number of rows to return; None means no limit.
- id_chunk_size
int, optional Number of diaObjectIds per
INquery when an iterable is given.
Returns#
- sources
astropy.table.Table The matching DiaSources, ordered by
midpointMjdTai.
Raises#
- ValueError
If
diaObjectIdis None.
- diaObjectId
- load_sources_by_cone(*, ra=None, dec=None, radius=None, exposure=None, padding=5.0, mjd_begin=None, mjd_end=None, bands=None, columns=None, limit=100000)#
Directly cone-search the DiaSource table (prototype-only).
Warning
The production PPDB will not allow spatial searches on the source tables. This works only against the prototype and is intended for debugging/validation (e.g. finding DiaSources with no associated DiaObject). For the production-compatible region workflow use
load_sources_for_region.Parameters mirror
load_sources_for_regionminusobject_limit.Returns#
- sources
astropy.table.Table DiaSources within the cone, ordered by
midpointMjdTai.
- sources
- load_sources_by_time_window(*, mjd_begin=None, mjd_end=None, bands=None, columns=None, limit=100000)#
Load DiaSources in a time window, any object (prototype-only).
Warning
The production PPDB will not allow object-unrestricted searches on the source tables. This works only against the prototype and is intended for debugging (e.g. inspecting everything processed in an MJD range). For the production-compatible workflow use
load_sources_for_region.Parameters#
- mjd_begin, mjd_end
float, optional Time window on
midpointMjdTai(TAI), asmjd_begin <= midpointMjdTai < mjd_end. At least one bound is required (an unbounded source-table scan is not permitted).- bands
list[str], optional Restrict to these bands (subset of
ugrizy).- columns
list[str], optional Columns to select; defaults to all columns.
- limit
int, optional Maximum number of rows to return; None means no limit.
Returns#
- sources
astropy.table.Table DiaSources in the window, ordered by
midpointMjdTai.
Raises#
- ValueError
If neither
mjd_beginnormjd_endis given.
- mjd_begin, mjd_end
- load_sources_for_object(diaObjectId, *, columns=None, limit=100000)#
Load all DiaSources associated with one diaObject.
Returns#
- sources
astropy.table.Table The object’s DiaSources, ordered by
midpointMjdTai.
- sources
- load_sources_for_region(*, ra=None, dec=None, radius=None, exposure=None, padding=5.0, mjd_begin=None, mjd_end=None, bands=None, columns=None, limit=100000, object_limit=100000, id_chunk_size=1000)#
Load DiaSources for a region, the production-compatible way.
Performs the two-step workflow the production PPDB requires: cone- search DiaObjects (the only table that allows spatial search), then load the DiaSources of those objects.
Parameters#
- ra, dec, radius
float, optional Cone center and radius, in degrees; mutually exclusive with
exposure. The radius is applied to object positions.- exposure
lsst.afw.image.Exposure, optional Load sources for objects covering this exposure’s footprint.
- padding
float, optional Margin around the exposure footprint, in arcseconds.
- mjd_begin, mjd_end, bands, columnsoptional
Passed through to the source query (see
load_sources).- limit
int, optional Cap on returned sources; None means no limit.
- object_limit
int, optional Cap on the DiaObjects found by the cone search.
- id_chunk_size
int, optional diaObjectIds per
INquery when fetching sources.
Returns#
- sources
astropy.table.Table DiaSources of the objects in the region, ordered by time.
Notes#
Because this is object-first, DiaSources not associated with a returned DiaObject (e.g. unassociated or ssObject-only detections) are not included. To find those, use
load_sources_by_cone.- ra, dec, radius
- run_query(adql, *, maxrec=None, order_table=None)#
Run an ADQL query and return the result as an astropy Table.
Parameters#
- adql
str The ADQL query to execute.
- maxrec
int, optional Server-side cap on the number of records returned.
- order_table
str, optional If given (e.g.
"DiaSource"), reorder the result columns into that table’s SDM-schema order. The loaders pass this so thatSELECT *results, which the TAP service returns alphabetically, come back in the schema’s logical column order. Columns not in the schema are appended in their original order.
Returns#
- table
astropy.table.Table The query result.
- adql
- url