Pairs Tutorial
One common task is to find objects that form close pairs on the sky. Such close pairs might indicate objects that are interacting in some way, or might help identify clusters of objects.
Find pairs with SQL Search
You can search for closely paired objects in SDSS data with an SQL Search in the Catalog Archive Server. To get to SQL Search from the astronomers' main page, look under Search Tools. From the public main page, look under SkyServer Tools, then Search.
To learn more about SQL, see SkyServer's SQL Tutorial and guide to Using SQL with SkyServer.
- In the large textbox of the SQL Search tool, type the following query (or see it in the textbox at the bottom of this page):
SELECT TOP 1000 P1.objID AS P1_ID, P1.ra AS first_ra, P1.dec AS first_dec, P2.objID AS second_ID, P2.ra AS second_ra, P2.dec AS second_dec -- return object IDs and positions for both objects FROM PhotoTag P1, -- P1 is the first object Neighbors N, -- N is the pre-computed neighbor objects PhotoTag P2 -- P2 is the second object WHERE P1.objID = N. objID -- P1 and P2 are neighbors AND P2.objID = N.NeighborObjID AND N.Distance < .05 -- objects are within 3 arcseconds
- The query will return the object ID, ra, and dec of each of the two objects in each pair for each of 1,000 pairs.
- Note that the query is limited to 1,000 objects, which are selected in no particular order from all over the sky. Removing the "TOP 1000" would in theory return all pairs of objects, but would also cause the query to time out.
- If you would like to see thumbnail images of each of the objects that matches the query, go to the Image List tool, see the View Thumbnails example below. You can also access this tool from the astronomers' main page, look under Advanced Tools. From the public main page, look under SkyServer Tools.
View thumbnails
- In the Image List tool, click on the Use query to fill form link, near the top left of the tool. You will see a textbox appear in the main panel of the window.
- Queries in the Image List tool must take a slightly different form than queries in the SQL Search tool. All Image List queries must have the following for their SELECT blocks:
SELECT name, ra, dec
So you must rewrite your query as:SELECT TOP 100 P1.objID AS name, P1.ra AS ra, P1.dec AS dec FROM PhotoTag P1, -- P1 is the first object Neighbors N, -- N is the pre-computed neighbor objects PhotoTag P2 -- P2 is the second object WHERE P1.objID = N. objID -- P1 and P2 are neighbors AND P2.objID = N.NeighborObjID AND N.Distance < .05 -- objects are within 3 arcseconds
Note that this will return only the name and position of the first object in the pair (although you should be able to see both objects in the thumbnail image). Also, note that the top 100 means that the query will be limited to return 100 objects.
- Click Submit, then Send to List. You will see thumbnail images for each of the objects that match your search criteria. The object at the center of the image will be only one of the objects, but both should be visible in the frame. You may find it helpful to turn on the Grid and PhotoObjs checkbox options.
- Note that if you run this query without the top 100, the query will return many results. To get all results you will probably need to use CasJobs. See the CasJobs help pages for more information.