202.1. DIA Object table#
202.1. DiaObject table¶
For the Rubin Science Platform at data.lsst.cloud.
Data Release: Prompt Products
Container Size: Large
LSST Science Pipelines version: r30.0.11
Last verified to run: 2026-11-29
Repository: github.com/lsst/tutorial-notebooks
DOI: 10.11578/rubin/dc.20250909.20
Learning objective: To understand the contents of the Prompt Products DiaObject table and how to access it.
LSST data products: ppdb.DiaObject
Packages: lsst.rsp
Credit: Originally developed by the Rubin Community Science team. Please consider acknowledging them if this notebook is used for the preparation of journal articles, software releases, or other notebooks.
Get Support: Everyone is encouraged to ask questions or raise issues in the Support Category of the Rubin Community Forum. Rubin staff will respond to all questions posted there.
1. Introduction¶
The Prompt Products Database (PPDB) DiaObject table is the result of Difference Image Analysis (DIA) processing.
Difference-image detections (called "diaSources" and stored in the DiaSource table) are associated into "diaObjects" in the DiaObject table using a 1-arcsecond radius.
The DiaObject table contains unique identifiers, sky coordinates, and $ugrizy$ light curve summary statistics for all static-sky time-varying astronomical objects detected in a difference image.
These light curve summary statistics (e.g., mean, standard deviation in the flux measurements) are primarily derived from the difference-image flux measurements for visits for which the object was detected at $>5\sigma$ in the difference image (the diaSources), but some statistics are based on forced measurements when there was no detection, and some on measurements from the science image.
Note: the positions and per-band aggregate parameters are computed from the diaSources associated with the object within the APDB history window (360 days by default) up to the visit that last updated it.
Related tutorials: The TAP service is demonstrated in the 100-level "How to" tutorials. There are a 200-level tutorials on the associated DiaSource and ForcedSourceOnDiaObject tables.
1.1. Import packages¶
Import standard python packages numpy, matplotlib, and astropy.
From the lsst package, import modules for the TAP service.
import re
import numpy as np
from astropy.time import Time
import matplotlib.pyplot as plt
from lsst.rsp import RSPDiscovery
from lsst.utils.plotting import set_rubin_plotstyle
1.2. Define parameters and functions¶
Create an instance of the TAP service.
discovery = RSPDiscovery("prompt")
tap_service = discovery.get_tap_client()
Set the plot style globally.
set_rubin_plotstyle()
Print the date that this notebook was executed.
now = Time.now()
print("Calendar (UTC):", now.iso)
print("MJD:", np.round(now.mjd, 1))
Calendar (UTC): 2026-12-01 00:17:21.703 MJD: 61375.0
2. Schema (columns)¶
To browse the table schema visit the Rubin schema browser, use the TAP service via the Portal Aspect, or do as demonstrated in Section 2.1.
2.1. Retrieve table schema¶
To retrieve the table schema, define a query for the schema columns of the DiaObject table, run the query job, and retrieve the results as an Astropy table.
query = """SELECT column_name, datatype, description, unit
FROM tap_schema.columns
WHERE table_name = 'ppdb.DiaObject'"""
job = tap_service.submit_job(query)
job.run()
job.wait(phases=['COMPLETED', 'ERROR'])
print('Job phase is', job.phase)
if job.phase == 'ERROR':
job.raise_if_error()
assert job.phase == 'COMPLETED'
schema_results = job.fetch_result().to_table()
Job phase is COMPLETED
Display the results.
schema_results
| column_name | datatype | description | unit |
|---|---|---|---|
| str64 | str64 | str512 | str64 |
| diaObjectId | long | Unique identifier of this DiaObject. | |
| ra | double | Right ascension of the inverse-variance weighted mean position of the DiaSources associated with this object, from all bands. | deg |
| raErr | float | Angular error of Right Ascension (dRA*cos(Dec)). | deg |
| dec | double | Declination of the inverse-variance weighted mean position of the DiaSources associated with this object, from all bands. | deg |
| decErr | float | Angular error of Declination. | deg |
| ra_dec_Cov | float | Covariance between the mean ra (RA*cos(Dec)) and dec. | deg**2 |
| nDiaSources | int | Number of DiaSources, in all bands, associated with this DiaObject in the APDB history window (360 days by default) up to and including this one. | |
| validityStartMjdTai | double | Processing time when validity of this diaObject starts, expressed as Modified Julian Date, International Atomic Time. | |
| u_psfFluxMean | float | Inverse-variance weighted mean of psfFlux of the u-band DiaSources. | nJy |
| ... | ... | ... | ... |
| z_psfFluxMin | float | Minimum psfFlux of the z-band DiaSources. | nJy |
| z_psfFluxMax | float | Maximum psfFlux of the z-band DiaSources. | nJy |
| z_psfFluxMaxSlope | float | Largest amplitude of change of psfFlux between consecutive z-band DiaSources, max(delta_flux/delta_time); positive values are brightening. | nJy/d |
| z_psfFluxErrMean | float | Unweighted mean of psfFluxErr of the z-band DiaSources. | nJy |
| y_psfFluxMin | float | Minimum psfFlux of the y-band DiaSources. | nJy |
| y_psfFluxMax | float | Maximum psfFlux of the y-band DiaSources. | nJy |
| y_psfFluxMaxSlope | float | Largest amplitude of change of psfFlux between consecutive y-band DiaSources, max(delta_flux/delta_time); positive values are brightening. | nJy/d |
| y_psfFluxErrMean | float | Unweighted mean of psfFluxErr of the y-band DiaSources. | nJy |
| firstDiaSourceMjdTai | double | midpointMjdTai of the earliest DiaSource associated with this object, expressed as Modified Julian Date, International Atomic Time. | |
| lastDiaSourceMjdTai | double | midpointMjdTai of the most recent DiaSource associated with this object, expressed as Modified Julian Date, International Atomic Time. |
The table displayed above has been truncated.
Option to print every column name as a list.
# for col in schema_results['column_name']:
# print(col)
Option to use the regular expressions package re to find all column names that hold the psfFluxMean for the six filters.
# for col in schema_results['column_name']:
# if re.fullmatch('[ugrizy]_psfFluxMean', col):
# print(col)
Option to search column names that contain the string defined as temp.
# temp = 'Max'
# temp = 'Slope'
# temp = 'psfFluxMean'
# for col in schema_results['column_name']:
# if re.search(temp, col):
# print(col)
Delete the job, but not the results.
del query
job.delete()
2.2. Column descriptions¶
The key columns in the DiaObject table are described below.
2.2.1. Identifier¶
The long integer that uniquely identifies each row of the DiaObject table.
diaObjectId
2.2.2. Coordinates¶
The sky coordinates in decimal degrees for each diaObject, and their errors.
ra,raErrdec,decErr
2.2.3. Detections¶
Total number of detections across all filters (i.e., number of associated diaSources).
nDiaSources
The MJD of the first and last detections - note that these columns are masked, and are not populated with values, for diaObjects that have not been detected since alert production recommenced at the end of October 2026 after the winter storm shutdown period.
firstDiaSourceMjdTailastDiaSourceMjdTai
2.2.4. Validity start time¶
The time at which the diaObject was last updated with new measurements.
validityStartMjdTai: Processing time when validity of thisdiaObjectstarts.
The TAP-based PPDB table only contains the most recent version of the diaObject.
When the Butler-based catalogs become available, all past versions of the diaObject will also be available, and those tables will also have a validityEndMjdTai column to denote the time at which that version of the diaObject was superseded by a new version due to new measurements being added.
2.2.5. Flux statistics¶
Several flux statistics are calculated for all diaObjects.
Statistics on the Point Spread Function (PSF) fluxes measured on the difference image detections in the DiaSource table:
[f]_psfFluxMean,MeanErr: Weighted mean of PSF flux in band [f], and error on the mean.[f]_psfFluxSigma: Standard deviation of the distribution of [f]_psfFlux values.[f]_psfFluxErrMean: Mean of the flux errors.[f]_psfFluxMaxandMin: Maximum and minimum PSF flux.[f]_psfFluxMaxSlope: Maximum slope between any two sequential [f]-band observations.[f]_psfFluxNdata: Number of [f]-band data points (from theDiaSourcetable; number of [f]-band detections).
One statistic is calculated using the forced PSF fluxes measured on all difference images, from the DiaForcedSource table:
[f]_fpFluxMeanandMeanErr: Weighted mean forced photometry flux and its standard error.
One statistic is calculated using the forced PSF fluxes measured on all science (direct; visit; non-difference) images:
[f]_scienceFluxMeanandMeanErr: Weighted mean forced photometry flux and its standard error, in the science image.
Use caution with all science-image fluxes for time-varying objects as there may be contamination from non-variable sources (e.g., host galaxies).
2.3. Descriptions and units¶
For a subset of the key columns show the table of their descriptions and units.
col_list = set(['diaObjectId', 'ra', 'dec', 'nDiaSources',
'firstDiaSourceMjdTai', 'lastDiaSourceMjdTai'
'r_psfFluxMean', 'r_psfFluxSigma', 'r_psfFluxMax'])
tx = [i for i, item in enumerate(schema_results['column_name']) if item in col_list]
schema_results[tx]
| column_name | datatype | description | unit |
|---|---|---|---|
| str64 | str64 | str512 | str64 |
| diaObjectId | long | Unique identifier of this DiaObject. | |
| ra | double | Right ascension of the inverse-variance weighted mean position of the DiaSources associated with this object, from all bands. | deg |
| dec | double | Declination of the inverse-variance weighted mean position of the DiaSources associated with this object, from all bands. | deg |
| nDiaSources | int | Number of DiaSources, in all bands, associated with this DiaObject in the APDB history window (360 days by default) up to and including this one. | |
| r_psfFluxSigma | float | Unweighted sample standard deviation of psfFlux of the r-band DiaSources. | nJy |
| r_psfFluxMax | float | Maximum psfFlux of the r-band DiaSources. | nJy |
| firstDiaSourceMjdTai | double | midpointMjdTai of the earliest DiaSource associated with this object, expressed as Modified Julian Date, International Atomic Time. |
Clean up.
del col_list, tx, schema_results
3. Data access¶
The Prompt Products DiaObject table is available via the TAP service.
3.1. Advisory: avoid full-table queries¶
Avoid full-table queries. Always include spatial constraints.
Skipping spatial constraints is not a good habit to form, because tables will grow to contain billions of rows.
3.2. TAP (Table Access Protocol)¶
The DiaObject table is stored in Qserv and accessible via the TAP services using ADQL queries.
Include spatial constraints:
Qserv stores catalog data sharded by coordinate (RA, Dec), so ADQL query statements that include constraints by coordinate do not requre a whole-catalog search and are typically faster (and can be much faster) than ADQL query statements which only include constraints for other columns.
Use either an ADQL cone or polygon search for faster queries (do not use WHERE ... BETWEEN statements to set boundaries on RA and Dec).
3.2.1. Demo query¶
Define a query to return, as an example, $r$-band flux statistics and other key columns for a sample from the DiaObject table.
Impose spatial constraints: search within 5 degrees of the center of the Euclid Deep Field South (A).
Also impose the constraint that a diaObject must be detected more than 5 times in the $r$-band to be returned.
targ_ra = 59.2
targ_dec = -49.2
radius = 5
query = """SELECT diaObjectId, ra, dec, nDiaSources,
firstDiaSourceMjdTai, lastDiaSourceMjdTai, validityStartMjdTai,
r_psfFluxMean, r_psfFluxMeanErr, r_psfFluxSigma, r_psfFluxErrMean,
r_psfFluxMax, r_psfFluxMin, r_psfFluxMaxSlope, r_psfFluxNdata
FROM ppdb.DiaObject
WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', {}, {}, {})) = 1
AND r_psfFluxNdata > 5""".format(targ_ra, targ_dec, radius)
print(query)
SELECT diaObjectId, ra, dec, nDiaSources,
firstDiaSourceMjdTai, lastDiaSourceMjdTai, validityStartMjdTai,
r_psfFluxMean, r_psfFluxMeanErr, r_psfFluxSigma, r_psfFluxErrMean,
r_psfFluxMax, r_psfFluxMin, r_psfFluxMaxSlope, r_psfFluxNdata
FROM ppdb.DiaObject
WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 59.2, -49.2, 5)) = 1
AND r_psfFluxNdata > 5
Execute the job and fetch the results as an astropy table.
job = tap_service.submit_job(query)
job.run()
job.wait(phases=['COMPLETED', 'ERROR'])
print('Job phase is', job.phase)
if job.phase == 'ERROR':
job.raise_if_error()
assert job.phase == 'COMPLETED'
diao_results = job.fetch_result().to_table()
print(len(diao_results))
Job phase is COMPLETED 32785
Option to display the table.
# diao_results
3.2.2. Visualize column data¶
Visualize the spatial coverage of this subset of diaObjects.
plt.figure(figsize=(4, 4))
plt.plot(diao_results['ra'], diao_results['dec'], 'o', ms=2, mew=0, alpha=0.2, color='gray')
plt.plot(targ_ra, targ_dec, '*', ms=10, color='black')
plt.xlabel('RA')
plt.ylabel('Dec')
plt.tight_layout()
plt.show()
Figure 1: A scatter plot of the sky coordinates for the subset of DIA objects shows the outline of the two side-by-side EDFS deep drilling fields.
Plot a histogram of the number of detections per diaObject.
plt.figure(figsize=(4, 3))
plt.hist(diao_results['nDiaSources'], bins=20, log=True, color='gray')
plt.xlabel('nDiaSources')
plt.ylabel('Counts of diaObjects')
plt.tight_layout()
plt.show()
Figure 2: Histogram of the number of detections (
nDiaSources) perdiaObject.
Not all diaObjects have the dates of first and last detections.
Print the number of rows in the retrieved subset that do not have values in the firstDiaSourceMjdTai or lastDiaSourceMjdTai columns.
Show also that all rows do have a validity start date.
tx1 = np.where(diao_results['firstDiaSourceMjdTai'].mask)[0]
tx2 = np.where(diao_results['lastDiaSourceMjdTai'].mask)[0]
print('Number of masked first and last detections: ', len(tx1), len(tx2))
print('Fraction of this subset with masked first/last detections: ',
np.round(len(tx1)/len(diao_results), 2))
del tx1, tx2
tx = np.where(diao_results['validityStartMjdTai'].mask)[0]
print('Number of masked validity start dates: ', len(tx))
del tx
Number of masked first and last detections: 18133 18133 Fraction of this subset with masked first/last detections: 0.55 Number of masked validity start dates: 0
Plot histograms of validity start dates for all diaObjects and for those with unmasked first and last detection dates.
tx = np.where(diao_results['firstDiaSourceMjdTai'].mask == 0)[0]
plt.figure(figsize=(8, 3))
plt.axvline(now.mjd, ls='dotted', lw=2, color='black', label='Plot creation date')
plt.hist(diao_results['validityStartMjdTai'], bins=50, log=True, histtype='step',
lw=2, alpha=0.5, color='grey', ls='solid', label="All diaObjects")
plt.hist(diao_results['validityStartMjdTai'][tx], bins=5, log=True, histtype='step',
lw=1, alpha=1, color='darkgreen', ls='dashed', label="Unmasked first/last detections")
plt.xlabel('validityStartMjdTai')
plt.ylabel('Counts of diaObjects')
plt.legend(bbox_to_anchor=(1, 1), loc='upper left')
plt.tight_layout()
plt.show()
del tx
Figure 3: Histograms of validity start dates for this subset of
diaObjects(grey solid), and fordiaObjectswith unmasked first and last detection dates (green dashed). This indicates that it is the earlierdiaObjectsthat have masked first and last detection dates. The date of plot creation is marked (black dotted).
Plot histograms of the first and last detection dates, for those diaObjects with these columns populated (see Section 4).
plt.figure(figsize=(8, 3))
plt.axvline(now.mjd, ls='dotted', lw=2, color='black', label='Plot creation date')
plt.hist(diao_results['firstDiaSourceMjdTai'], bins=50, log=True, histtype='step',
lw=2, alpha=0.3, color='blue', ls='solid', label="First detections")
plt.hist(diao_results['lastDiaSourceMjdTai'], bins=5, log=True, histtype='step',
lw=1, alpha=1, color='darkorange', ls='dashed', label="Latest detections")
plt.xlabel('MJD')
plt.ylabel('Counts of diaObjects')
plt.legend(bbox_to_anchor=(1, 1), loc='upper left')
plt.tight_layout()
plt.show()
Figure 4: The distribution of the dates of first (blue solid) and last (orange dashed) detection (SNR>5 source in a difference image) for the retrieved subset of DIA objects, with the date of plot creation marked (black dotted).
Show that validityStartMjdTai and lastDiaSourceMjdTai are correlated and similar.
The difference between them indicates the time it takes to run the DIA processing.
xval = diao_results['lastDiaSourceMjdTai']
yval = diao_results['validityStartMjdTai']-diao_results['lastDiaSourceMjdTai']
fig, ax = plt.subplots(1, 2, figsize=(8, 3))
ax[0].plot(xval, yval, 'o', ms=5, mew=0, alpha=0.3, color="black")
ax[0].set_xlabel('Last detection [MJD]')
ax[0].set_ylabel('Validity - Last [days]')
ax[1].plot(xval, 24*60*60*yval, 'o', ms=5, mew=0, alpha=0.3, color="black")
ax[1].set_ylim([0, 400])
ax[1].set_xlabel('Last detection [MJD]')
ax[1].set_ylabel('Validity - Last [seconds]')
ax[1].set_title('>0.5 day outliers cropped out')
plt.tight_layout()
plt.show()
del xval, yval
Figure 5: At left, the time of last detection in MJD vs. the difference between the validity start time and the time of last detection, in units of days. There are a few instances where processing was delayed for $>$0.5 days, but it is quite rare. At right the same values are plotted, but zoomed in on non-outliers and with the time difference in seconds, to truly show the typical processing time.
Plot histograms for a subset of the $r$-band light curve summary statistics.
fig, ax = plt.subplots(3, 2, figsize=(8, 6))
ax = ax.flatten()
stat_name = ['r_psfFluxMean', 'r_psfFluxSigma',
'r_psfFluxMax', 'r_psfFluxMin',
'r_psfFluxMaxSlope', 'r_psfFluxNdata']
for i in range(6):
ax[i].hist(diao_results[stat_name[i]], bins=30, color='gray', log=True)
ax[i].set_xlabel(stat_name[i])
ax[i].set_ylabel('Counts of diaObjects')
plt.tight_layout()
plt.show()
Figure 6: Histograms of the $r$-band light curve summary statistics for the retrieved sample, to show the range of values for this particular subset of
diaObjects.