202.6. Nearby SSO table#
202.6. NearbySSO 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-30
Repository: github.com/lsst/tutorial-notebooks
DOI: 10.11578/rubin/dc.20250909.20
Learning objective: To understand the contents of the NearbySSO table and how to access it.
LSST data products: NearbySSO
Packages: lsst.rsp, lsst.utils.plotting
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 NearbySSO table provides a list of Rubin difference-image DiaSource detections that are potentially associated with the predicted position of a Solar System object. For a given visit the predicted position is calculated for all known objects that in the mpc_orbits table that could lie within the LSSTCam field of view. Solar System Processing (SSP) then attempts to associate DiaSources in the visit to the predicted positions as described in the Prompt processing documentation for association. In some cases multiple DiaSources have association radii covering the predicted position, these are all recorded in NearbySSO. Furthermore, any predicted positions that could not be associated are recorded (with diaSourceId IS NULL) in order to record non-detections of known objects in mpc_orbits.
Warning: The detections in
NearbySSOhave not been associated to a real Solar System object by the Minor Planet Center (MPC). For Rubin observations that have been confirmed by the MPC please refer to theSSObservationstable.
Related tutorials: The TAP data access service is demonstrated in the 100-level "How to" tutorials.
1.1. Import packages¶
Import standard python packages numpy and matplotlib.
From the lsst package, import modules for the TAP service and plotting.
import numpy as np
import matplotlib.pyplot as plt
from lsst.rsp import RSPDiscovery
from lsst.utils.plotting import (get_multiband_plot_colors,
get_multiband_plot_symbols,
set_rubin_plotstyle)
1.2. Define parameters and functions¶
Create an instance of the TAP service.
discovery = RSPDiscovery("prompt")
service = discovery.get_tap_client()
Define the colors and symbols to represent the LSST filters in plots.
set_rubin_plotstyle()
filter_colors = get_multiband_plot_colors()
filter_names = filter_colors.keys()
filter_symbols = get_multiband_plot_symbols()
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 NearbySSO table and run the query job.
query = """SELECT column_name, datatype, description, unit
FROM tap_schema.columns
WHERE table_name = 'ppdb.NearbySSO'"""
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()
results
| column_name | datatype | description | unit |
|---|---|---|---|
| str64 | str64 | str512 | str64 |
| diaSourceId | long | Unique identifier of the matched DiaSource; NULL for a prediction that matched no DiaSource. | |
| visit | long | Id of the visit the prediction is for. | |
| detector | short | Id of the detector the predicted position falls on, or the nearest detector when it falls in a gap between detectors or just outside the focal plane; for a matched row in a visit without a WCS, the DiaSource's detector. | |
| ssObjectId | long | Id of this row's object in SSObject (SSObject.ssObjectId); NULL if the object has no SSObject row. | |
| designation | char | The primary provisional designation in unpacked form (e.g. 2008 AB); designations starting C/, P/, D/ or I/ (comets and interstellar objects) are matched within 15 arcsec. | |
| ephRa | double | Predicted ICRS right ascension from the orbit in mpc_orbits. | deg |
| ephRaErr | float | 1-sigma uncertainty of ephRa (on the sky, i.e. including the cos(dec) factor), propagated from the mpc_orbits covariance. | deg |
| ephDec | double | Predicted ICRS declination from the orbit in mpc_orbits. | deg |
| ephDecErr | float | 1-sigma uncertainty of ephDec, propagated from the mpc_orbits covariance. | deg |
| ephRa_ephDec_Cov | float | Covariance between ephRa (on the sky) and ephDec; with ephRaErr and ephDecErr, the predicted position's error ellipse, in the convention of raErr, decErr and ra_dec_Cov. | deg**2 |
| ephOffset | float | Total observed versus predicted angular separation on the sky; NULL for a prediction that matched no DiaSource. | arcsec |
| diaDistanceRank | short | Rank of this DiaSource by its separation from the object's predicted position, among all DiaSources of the same visit within the object's matching radius of that prediction: 1 for the nearest, 2 for the next, and so on (ties broken by the lower diaSourceId). A rank above 1 means a closer DiaSource exists, which may be attributed to another object. NULL for a prediction that matched no DiaSource. | |
| ephVmag | float | Predicted magnitude in V band, computed from mpc_orbits data including the mpc_orbits-provided (H, G) estimates. | mag |
| ephRateRa | float | Predicted on-sky angular rate in the R.A. direction (includes the cos(dec) factor). | deg/d |
| ephRateDec | float | Predicted on-sky angular rate in the declination direction. | deg/d |
| ephAntiSunPA | float | Predicted position angle of the extended Sun-to-object radius vector (the anti-Sun direction, along which an ion tail points), projected on the sky at the object and measured from ICRS north through east, in [0, 360). As JPL Horizons' PsAng, but relative to the ICRS pole; from the light-emission-time heliocentric vector (helio_x, helio_y, helio_z). Ill-conditioned near zero phase angle. | deg |
| ephAntiMotionPA | float | Predicted position angle of the negative of the object's heliocentric velocity vector (the direction a dust trail lags towards), projected on the sky at the object and measured from ICRS north through east, in [0, 360). As JPL Horizons' PsAMV, but relative to the ICRS pole; from the light-emission-time heliocentric velocity (helio_vx, helio_vy, helio_vz). | deg |
Option to print every column name as a list.
# for col in results['column_name']:
# print(col)
Delete the job, but not the results.
del query
job.delete()
2.2. Key columns¶
Description of NearbySSO columns.
2.2.1. Solar System Object Id¶
The long integer that uniquely identifies each Solar System object:
ssObjectId
In some cases the ssObjectId can be NULL, e.g. the predicted positions for a given designation has not been associated with any DiaSources (diaSourceId IS NULL).
Warning: Caution is advised when handling query results from columns that contain both integer and NULL values, such as
NearbySSO.ssObjectIdandNearbySSO.diaSourceId. The conversion of such results from an astropy Table to a pandas DataFrame using theto_pandas()method (astropy = 7.2.0) can alter long integer numbers such asssObjectIddue to rounding errors in integer to float conversion. Ifto_pandas()is required for such columns exclude NULL values in the query (WHERE ssObjectId IS NOT NULL) or consider usingto_pandas(use_nullable_int=False)to produce an error.
2.2.2. Unpacked primary provisional designation¶
The unpacked primary provisional designation for this object:
designation
2.2.2. Difference Source Id¶
The difference image detection identifier used to join to the DiaSource table:
diaSourceId
The diaSourceId will be NULL for non-detections at the predicted position of a given Solar System object during an LSSTCam visit.
Warning: See warning above regarding use of
to_pandas()for columns containing integers and NULL values, such asNearbySSO.diaSourceId.
2.2.3. Predicted magnitude, ra, dec, and on-sky angular rates¶
The predicted V-band magnitude, computed from mpc_orbits data including the mpc_orbits-provided (H, G) estimates:
ephVmag
The predicted ICRS right ascension (ra) and declincation (dec) from the orbit in mpc_orbits:
ephRaephDec
The total predicted on-sky angular rate of motion and the predicted on-sky angular rates in the ra (includes the cos(dec) factor) and dec direction:
ephRateRaephRateDec
2.2.4. Offsets from predicted magnitude, ra, dec, and on-sky angular rates¶
The total observed versus predicted angular separation on the sky and the offsets between the observed and predicted positions in the ra (includes cos(dec) term)and dec directions:
ephOffsetephOffsetRaephOffsetDec
The offsets between observed and predicted positions in the along-track and cross-track directions on the sky:
ephOffsetAlongTrackephOffsetCrossTrack
2.2.5 Active object position angles¶
For assessing active object tail directions relative to the Sun and orbital motion:
ephAntiSunPAephAntiMotionPA
2.2.6. Rank of source in its closeness to a predicted SSO position¶
For diaSources with known Solar System objects (SSOs) predicted to be within a 1 arcsecond association radius, the rank of the diaSourceId -identified source in terms of its closeness to the predicted SSO position:
diaDistanceRank
I.e., if diaSourceId is the nearest DiaSource to the SSO prediction, diaSourceDistanceRank = 1 would be set. If it is the second nearest, it would be 2, etc. Source association in PPDB provides more information.
2.3. Descriptions and units¶
For a subset of the key columns in Section 2.2, show the table of their descriptions and units.
col_list = set(['ssObjectId', 'ephOffset', 'diaDistanceRank'])
tx = [i for i, item in enumerate(results['column_name']) if item in col_list]
results[tx]
| column_name | datatype | description | unit |
|---|---|---|---|
| str64 | str64 | str512 | str64 |
| ssObjectId | long | Id of this row's object in SSObject (SSObject.ssObjectId); NULL if the object has no SSObject row. | |
| ephOffset | float | Total observed versus predicted angular separation on the sky; NULL for a prediction that matched no DiaSource. | arcsec |
| diaDistanceRank | short | Rank of this DiaSource by its separation from the object's predicted position, among all DiaSources of the same visit within the object's matching radius of that prediction: 1 for the nearest, 2 for the next, and so on (ties broken by the lower diaSourceId). A rank above 1 means a closer DiaSource exists, which may be attributed to another object. NULL for a prediction that matched no DiaSource. |
Clean up.
del col_list, tx, results
3. Data access¶
The Prompt Products NearbySSO table is available via the TAP service.
3.1. TAP (Table Access Protocol)¶
The NearbySSO table is accessible via the TAP services using ADQL queries.
3.1.1. Current catalog size¶
The NearbySSO table is updated daily as part of solar system prompt processing and the number of rows will increase with new visits that overlap the predicted positions of known objects, producing possible DiaSource associations or non-detections. As of the date of PPDB release (30th November 2026) NearbySSO contains over 4,250,000 rows.
Uncomment the following cell to run a query that retrieves the size of the NearbySSO table (at the time of query).
results = service.search("SELECT COUNT(*) FROM ppdb.NearbySSO")
results.to_table()
| COUNT1 |
|---|
| int64 |
| 4260994 |
3.1.2. Demo query - Inspect multiple associated DiaSources with diaDistanceRank¶
Sometimes the predicted position of a known Solar System object can fall within the association radius of multiple DiaSources. All possible associations are recorded in NearbySSO with the corresponding designation, but an additional diaDistanceRank is provided which ranks the DiaSources in order of proximity to the predicted position.
The following query identifies predicted Solar System object positions that are associated with multiple DiaSource detections, and retrieves all associations except the closest one (which would have diaDistanceRank = 1).
query = """SELECT diaSourceId, ssObjectId, designation,
ephOffSet, diaDistanceRank, visit
FROM ppdb.NearbySSO
WHERE diaSourceId IS NOT NULL AND diaDistanceRank > 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))
1202
Option to print the results.
# results
Print the unique values of diaDistanceRank (i.e., 2, 3, and so on) and the number of rows of the results table that are the 2nd, 3rd, and so on, nearest match.
values, counts = np.unique(results['diaDistanceRank'],
return_counts=True)
for value, count in zip(values, counts):
print(value, count)
del values, counts
2 1192 3 8 4 2
Plot a histogram showing the distance from the predicted position ephOffSet for the DiaSources with diaDistanceRank > 1. I.e. these detections are not the closest DiaSource to the predicted position.
fig, ax = plt.subplots(figsize=(6, 4))
ax.hist(results['ephOffSet'], bins=50)
ax.set_xlabel('ephOffSet [arcsec]')
ax.set_ylabel('Number')
ax.set_title('Positional offset of diaDistanceRank > 1 DiaSources')
ax.set_yscale("log")
plt.tight_layout()
plt.show()
Figure 1: Histogram of distance from predicted Solar System object position
ephOffSetforDiaSourceswithdiaDistanceRank > 1, with logarithmic scaling on the $y$-axis.
Additional demo query: distribution of all diaDistanceRank values.
Inspecting all values of diaDistanceRank shows that the majority of detections have only one possible association, however, there are a number of predicted positions that have 2 or more DiaSources potentially associated with them.
query = """SELECT diaDistanceRank, COUNT(diaDistanceRank) as diaDistanceRank_count
FROM ppdb.NearbySSO
WHERE diaSourceId IS NOT NULL
GROUP BY diaDistanceRank"""
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()
results
| diaDistanceRank | diaDistanceRank_count |
|---|---|
| int16 | int64 |
| 2 | 1192 |
| 4 | 2 |
| 1 | 2020634 |
| 3 | 8 |
Additional demo query: one known object with multiple possible associations.
The following query inspects an example predicted position that is known to have several possible associations. The unique position and time of the prediction are indicated by designation and visit respectively.
query = """SELECT nbsso.diaSourceId,nbsso.diaDistanceRank,
dia.ra, dia.dec, dia.psfFlux, dia.diaObjectId
FROM ppdb.NearbySSO as nbsso
JOIN ppdb.DiaSource as dia ON dia.diaSourceId = nbsso.diaSourceId
WHERE nbsso.designation = '2010 DP55' AND nbsso.visit = 2026022300222
ORDER BY nbsso.diaDistanceRank"""
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()
results
| diaSourceId | diaDistanceRank | ra | dec | psfFlux | diaObjectId |
|---|---|---|---|---|---|
| deg | deg | nJy | |||
| int64 | int16 | float64 | float64 | float32 | int64 |
| 170050498162854072 | 1 | 148.43180093046044 | 1.5747798146087941 | 8860.353 | -- |
| 170050498162854075 | 2 | 148.4314238674176 | 1.5736586561693149 | 1163.4833 | 313875416782733525 |
| 170050498162854252 | 3 | 148.43247011111157 | 1.573608567627008 | -1004.7486 | 170050490156450654 |
| 170050498162854066 | 4 | 148.4304670332192 | 1.5744299124279502 | -155.41743 | 313963405483967003 |
Clean up.
job.delete()
del query, results
3.1.3. Demo query - Non detections of Solar System Objects¶
The Rubin Solar System prompt processing attempts to associate DiaSources for all known objects predicted to lie within the LSSTCam field of view for that visit (the positions are calculated from the orbits in mpc_orbits). Not all predictions will have a nearby DiaSource for a multitude of reasons, e.g. offset due to orbital uncertainty, image processing pipeline issues at that detector position, or the Solar System object was too faint to be detected.
The following query retreives a subset of non-detections in NearbySSO, indicated by diaSourceId IS NULL, in order to investigate the effect of predicted brightness ephVMag.
query = """SELECT TOP 10000 diaSourceId, designation, ephVMag
FROM ppdb.NearbySSO
WHERE diaSourceId IS NULL"""
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))
10000
Option to print the results.
# results
Plot the distribution of predicted brightness for Solar System objects that could not be associated to a nearby DiaSource by SSP.
fig, ax = plt.subplots(figsize=(6, 4))
ax.hist(results['ephVMag'], bins=50)
ax.set_xlabel('ephVMag')
ax.set_ylabel('Number')
ax.set_title('Predicted brightness of non-detections')
plt.tight_layout()
plt.show()
Figure 2: Histogram of predicted brightness
ephVMagof known Solar System objects (TOP 10000) which were not detected inDiaSource.
3.1.4. Joinable tables¶
Identifier fields diaSourceId, ssObjectId, and designation can be used to join NearbySSO to the other Rubin Solar System tables.
The tables most commonly joined to NearbySSO tables are the tables DiaSource and mpc_orbits.
Retrieve all diaSources (SNR>5 detections) associated with designation "2015 BO641", and which are the closest detection (diaDistanceRank = 1), by joining the DiaSource and NearbySSO tables.
Fetch the results as an astropy table.
query = """SELECT nbsso.ssObjectId, dia.midpointMjdTai, dia.psfFlux, dia.band,
nbsso.ephOffSet, nbsso.diaDistanceRank
FROM ppdb.NearbySSO as nbsso
JOIN ppdb.DiaSource as dia
ON nbsso.diaSourceId = dia.diaSourceId
WHERE nbsso.designation = '2015 BO641'
AND nbsso.diaDistanceRank = 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()
assert job.phase == 'COMPLETED'
results = job.fetch_result().to_table()
print(len(results))
Job phase is COMPLETED 419
Option to print the results.
# results
Plot PSF flux as a function of the observation midpoint for designation = 2015 BO641, ssObjectId = 7437747768430845728.
fig, ax = plt.subplots(1, 1, figsize=(10, 4))
for filt in filter_names:
fx = np.where(results['band'] == filt)[0]
if len(fx) > 0:
ax.plot(results['midpointMjdTai'][fx], results['psfFlux'][fx],
filter_symbols[filt], ms=5, mew=0, alpha=0.7,
color=filter_colors[filt], label=filt)
ax.set_xlabel('MJD [days]')
ax.set_ylabel('Difference-image flux [nJy]')
ax.legend(loc='upper left')
plt.suptitle(f"ssObjectId = {results['ssObjectId'][0]}", y=1.01)
plt.show()
Figure 3: The difference-image PSF flux measurement for each diaSource associated with 2015 BO641.
Clean up.
job.delete()
del query, results
3.2. Butler¶
The PPDB NearbySSO table is not currently available via the Butler.