PpdbTap#

class lsst.analysis.ap.PpdbTap(url='https://data-int.lsst.cloud/api/ppdbtap', *, token=None, service=None, log=None)#

Bases: object

Load PPDB catalogs through the RSP TAP service as astropy Tables.

Parameters#

urlstr, optional

TAP endpoint to query. Defaults to the prototype PPDB at data-int.

tokenstr, optional

RSP token with the read:tap scope. If not given (and service is also not given), the RSP_TOKEN environment variable is used.

servicepyvo.dal.TAPService, optional

Pre-built TAP service. When supplied, url and token are ignored. Intended for use with unit tests.

loglogging.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, diaObjectId is required and there is no spatial argument; use load_forced_sources_for_region, or the prototype-only load_forced_sources_by_cone / load_forced_sources_by_time_window.

Returns#

forced_sourcesastropy.table.Table

The matching DiaForcedSources, ordered by midpointMjdTai.

Raises#

ValueError

If diaObjectId is None.

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_sourcesastropy.table.Table

DiaForcedSources within the cone, ordered by midpointMjdTai.

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 of mjd_begin / mjd_end is required.

Returns#

forced_sourcesastropy.table.Table

DiaForcedSources in the window, ordered by midpointMjdTai.

Raises#

ValueError

If neither mjd_begin nor mjd_end is given.

load_forced_sources_for_object(diaObjectId, *, columns=None, limit=100000)#

Load all DiaForcedSources associated with one diaObject.

Returns#

forced_sourcesastropy.table.Table

The object’s DiaForcedSources, ordered by midpointMjdTai.

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_sourcesastropy.table.Table

DiaForcedSources of the objects in the region, ordered by time.

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#

diaObjectIdint

Identifier of the object.

Returns#

light_curveDiaObjectLightCurve

The object and its associated source time series.

Raises#

RuntimeError

If no current version of the object exists.

load_object(diaObjectId, *, columns=None)#

Load the current version of a single DiaObject.

Parameters#

diaObjectIdint

Identifier of the object to load.

columnslist [str], optional

Columns to select; defaults to all columns.

Returns#

objectastropy.table.Row

The current DiaObject row.

Raises#

RuntimeError

If no current version of the object exists.

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, radiusfloat, optional

Cone-search center and radius, in degrees. All three must be given together; mutually exclusive with exposure.

exposurelsst.afw.image.Exposure, optional

Load objects covering this exposure’s footprint (see region_from_exposure). Mutually exclusive with ra/dec/radius.

paddingfloat, optional

Margin around the exposure footprint, in arcseconds (only used with exposure).

columnslist [str], optional

Columns to select; defaults to all columns.

limitint, optional

Maximum number of rows to return; None means no limit.

latestbool, 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#

objectsastropy.table.Table

The matching DiaObjects.

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: diaObjectId is 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, use load_sources_for_region (object-first); for direct, object- unrestricted prototype-only access, use load_sources_by_cone or load_sources_by_time_window.

Parameters#

diaObjectIdint or iterable of int

Restrict to sources of this object, or of any of these objects (issued as chunked diaObjectId IN (...) queries). Required.

mjd_begin, mjd_endfloat, optional

Restrict to mjd_begin <= midpointMjdTai < mjd_end (TAI).

bandslist [str], optional

Restrict to these bands (subset of ugrizy).

columnslist [str], optional

Columns to select; defaults to all columns.

limitint, optional

Maximum number of rows to return; None means no limit.

id_chunk_sizeint, optional

Number of diaObjectIds per IN query when an iterable is given.

Returns#

sourcesastropy.table.Table

The matching DiaSources, ordered by midpointMjdTai.

Raises#

ValueError

If diaObjectId is None.

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_region minus object_limit.

Returns#

sourcesastropy.table.Table

DiaSources within the cone, ordered by midpointMjdTai.

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_endfloat, optional

Time window on midpointMjdTai (TAI), as mjd_begin <= midpointMjdTai < mjd_end. At least one bound is required (an unbounded source-table scan is not permitted).

bandslist [str], optional

Restrict to these bands (subset of ugrizy).

columnslist [str], optional

Columns to select; defaults to all columns.

limitint, optional

Maximum number of rows to return; None means no limit.

Returns#

sourcesastropy.table.Table

DiaSources in the window, ordered by midpointMjdTai.

Raises#

ValueError

If neither mjd_begin nor mjd_end is given.

load_sources_for_object(diaObjectId, *, columns=None, limit=100000)#

Load all DiaSources associated with one diaObject.

Returns#

sourcesastropy.table.Table

The object’s DiaSources, ordered by midpointMjdTai.

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, radiusfloat, optional

Cone center and radius, in degrees; mutually exclusive with exposure. The radius is applied to object positions.

exposurelsst.afw.image.Exposure, optional

Load sources for objects covering this exposure’s footprint.

paddingfloat, optional

Margin around the exposure footprint, in arcseconds.

mjd_begin, mjd_end, bands, columnsoptional

Passed through to the source query (see load_sources).

limitint, optional

Cap on returned sources; None means no limit.

object_limitint, optional

Cap on the DiaObjects found by the cone search.

id_chunk_sizeint, optional

diaObjectIds per IN query when fetching sources.

Returns#

sourcesastropy.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.

run_query(adql, *, maxrec=None, order_table=None)#

Run an ADQL query and return the result as an astropy Table.

Parameters#

adqlstr

The ADQL query to execute.

maxrecint, optional

Server-side cap on the number of records returned.

order_tablestr, optional

If given (e.g. "DiaSource"), reorder the result columns into that table’s SDM-schema order. The loaders pass this so that SELECT * 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#

tableastropy.table.Table

The query result.