201.12. CoaddPatches table#
201.11. CoaddPatches table¶
For the Rubin Science Platform at data.lsst.cloud.
Data Release: Data Preview 1
Container Size: large
LSST Science Pipelines version: r29.2.0
Last verified to run: 2026-01-26
Repository: github.com/lsst/tutorial-notebooks
Learning objective: To understand the contents of the CoaddPatches table and how to access it.
LSST data products: CoaddPatches
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 CoaddPatches table contains static information about the subset of tracts and patches from the standard LSST skymap that apply to coadds in these catalog.
- TAP table name:
dp1.CoaddPatches - columns: 5
Related tutorials: The TAP data access service is demonstrated in the 100-level "How to" tutorials.
1.1. Import packages¶
Import standard python packages re, numpy, matplotlib, and astropy.
From the lsst package, import the module for the TAP service.
import numpy as np
import matplotlib.pyplot as plt
from lsst.rsp import get_tap_service
1.2. Define parameters and functions¶
Create an instance of the TAP service, and assert that it exists.
service = get_tap_service("tap")
assert service is not None
2. Schema (columns)¶
To browse the table schema visit the Rubin schema browser, or use the TAP service via the Portal Aspect or 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 CoaddPatches table and run the query job.
query = "SELECT column_name, datatype, description, unit " \
"FROM tap_schema.columns " \
"WHERE table_name = 'dp1.CoaddPatches'"
job = 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()
Job phase is COMPLETED
Retrieve the query results and display them as an astropy table with the to_table() attribute.
assert job.phase == 'COMPLETED'
results = job.fetch_result().to_table()
assert len(results) == 5
results
| column_name | datatype | description | unit |
|---|---|---|---|
| str64 | str64 | str512 | str64 |
| lsst_patch | long | ID number of the second level, 'patch', within the standard LSST skymap | |
| lsst_tract | long | ID number of the top level, 'tract', within the standard LSST skymap | |
| s_dec | double | Central Spatial Position in ICRS; Declination | deg |
| s_ra | double | Central Spatial Position in ICRS; Right ascension | deg |
| s_region | char | Sky region covered by the coadd (expressed in ICRS frame) |
The table displayed above has not been truncated, as it is only 5 rows long.
Delete the job, but not the results.
del query
job.delete()
3. Data access¶
The CoaddPatches table is available via the TAP service.
Recommended access method: TAP.
3.1. TAP (Table Access Protocol)¶
The CoaddPatches table is stored in Qserv and accessible via the TAP services using ADQL queries.
3.1.2. Demo query¶
Avoid full-table queries.
Although the DP1 CoaddPatches table is relatively small, it is good practice to always include spatial constraints and only retrieve necessary columns.
Search for coadd patches within 3 degrees of the center of the Extended Chandra Deep Field South (ECDFS) field, RA, Dec = $53.13, -28.10$. Return the patch ID, tract ID, central RA, DEC, and sky region covered by the coadd.
query = "SELECT lsst_patch, lsst_tract, s_ra, s_dec, s_region " \
"FROM dp1.CoaddPatches " \
"WHERE CONTAINS(POINT('ICRS', s_ra, s_dec), " \
"CIRCLE('ICRS', 53.13, -28.10, 3)) = 1 "
job = 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()
Job phase is COMPLETED
Fetch the results as an astropy table.
assert job.phase == 'COMPLETED'
results = job.fetch_result().to_table()
print(len(results))
92
Option to display the table.
# results
As an example, plot patch boundaries for all patches in a tract. In case the polygon cross RA = 0 deg, wrap the RA angles into the range [-180, 180) deg.
fig, ax = plt.subplots(1, 1, figsize=(5, 5))
sel = results['lsst_tract'] == 4848
s_regions = results[sel]['s_region']
for s_region in s_regions:
vertices = np.array(s_region.split()[2:], dtype=float)
ra = vertices[0::2]
ra = (ra + 180) % 360 - 180
dec = vertices[1::2]
ra_plot = np.append(ra, ra[0])
dec_plot = np.append(dec, dec[0])
ax.plot(ra_plot, dec_plot, "b-")
ax.grid()
ax.set_xlabel('RA [deg]')
ax.set_ylabel('DEC [deg]')
ax.invert_xaxis()
plt.tight_layout()
plt.show()
Figure 1: Patch boundaries for all patches in the tract 4848 within 3 degrees of the center of the ECDFS field.
Clean up.
job.delete()
del query, results