Go to sdss.org
DR7 Home
Where to Start
   Database (CAS)
   Files (DAS)
   Older Releases
About DR7
   Sky Coverage
   Data Processing
   Known Issues
   DR Papers

How do I...

Find data for all objects in a given RA/Dec/Magnitude/Absolute Magnitude range?

Jump to:
Using the Imaging Query Form Find by Position Find by Magnitude or Color Find by Absolute Magnitude

You can use search tools from the SDSS's Catalog Archive Server to find all objects that meet certain criteria, such as position, magnitude, color, or absolute magnitude. For position, magnitude, and color, you can use the Imaging Query Form (link opens in a new window). For absolute magnitude (and any other criteria), you can write queries in SQL (new window).

See the directions for using the Imaging Query Form below to see how to use the form's general features. Then see the RA and Dec and Magnitude pages of this guide to learn how to search for those parameters. See the Absolute Magnitude page to learn how to use SQL to search for objects by absolute magnitude.

Using the Imaging Query Form (open in new window)

  1. In the Limit number of output rows textbox, enter the number of objects you would like the search to return. If you want unlimited number of rows returned, enter 0.
  2. In the Output Format textbox, enter the format you want for your output. HTML will output results as a table in your browser. CSV output can be read by many graphing programs.
  3. In the Parameters section, select what types of Imaging data you would like returned. Typical returns the most common parameters. You can also select any parameters from the menu. To select more than one, hold down CTRL while clicking on each one.
  4. Select what type of Spectroscopy data you would like returned. If you select None under Spectroscopy, the tool will not return any spectral data. If you select any of the other options, the tool will return spectral data for all objects, including those for which no spectrum has been observed – but objects without an observed spectrum have zeroes for all spectroscopic data.
  5. You can use the Filters checkboxes to choose which filter names to return. The Imaging Query Form will return only the names of the filters, not the images. You can then use the filter names as part of a query to the Data Archive Server (DAS).

Next, you will set constraints based on positions or imaging data. Constraints are characteristics of the objects that you are interested in. The Imaging Query Form will return data for objects that meet your constraints.

Find by Position (open Imaging Query Form in new window)

One of the constraints you can use is to find objects only in a specific part of the sky. Use the Position Constraints box to choose constraints. You can choose not to use any position constraints (None), or you can choose one of three types (Rectangle, Cone, and Proximity).

  1. Rectangle finds objects within a rectangle between a minimum and maximum RA and Dec. Enter minimums and maximums for RA and Dec, either in decimal degrees or in HMS/DMS. HMS input can be formatted as either HH:MM:SS.ss or HH MM SS.ss.
  2. Cone finds objects within a radial patch of sky defined by a center RA/Dec and a radius. The default value is a search around RA = 180, Dec = 0.2.
  3. Proximity finds objects near to a list of positions. You give the list, either by pasting into the textbox or by uploading a file. You can optionally specify a maximum separation in which to search.
  4. When you have finished entering all your constraints, click Submit Request. The tool will return only the objects you asked for, in the output format you specified. You now have your results; read the next step to see how to get the same results using SQL.
  5. If you would rather use SQL to search by position, write your query so that it uses one of the position functions, either dbo.fGetNearbyObjEq(ra,dec,radius) or dbo.fGetObjFromRect(ra1,ra2,dec1,dec2). Specify the function in the FROM block, and be sure to check that the object IDs are the same in the WHERE block. So here is a query to search a radial patch of sky, returning IDs and positions (click Submit to run):
    SELECT p.objid, p.ra, p.dec
    FROM PhotoObj p, dbo.fGetNearbyObjEq(180,0.2,5) n
    WHERE n.objID = p.objID

Find by Magnitude or Color (open Imaging Query Form in new window)

Instead of, or in addition to, searching by position, you can also tell the Imaging Query Form to search by magnitude. To do this, use the Imaging Constraints section. The default is no constraints (that is, to return objects with any magnitudes and colors).

  1. First, select the Type of magnitude on which you would like to search: Petrosian, Model (the better fit of a DeVaucouleurs and exponential profile), or PSF.
  2. Next, enter the magnitudes you would like to search for in the Magnitudes textbox. You can enter constraints on any of the SDSS's five filters (u, g, r, i, z), and you can enter minima and/or maxima for each value.
  3. You can search by color instead of or in addition to magnitude. Your choices for colors are u-g, g-r, r-i, and i-z. You can enter minima and/or maxima for each value.
  4. You also search for specific types of object: extended sources, point sources, sky, or unknown.
  5. You can also search for the presence or absence of specific flags. See the tutorial Find out if SDSS's imaging data for an object are reliable? to see what flags mean and how to use them.
  6. When you have finished entering all your constraints, click Submit Request. The tool will return only the objects you asked for, in the output format you specified. You now have the data you requested. See the next step to learn how to get the same data using SQL.
  7. If you would rather search by magnitudes with SQL, add the following line to the WHERE block of your query: WHERE g < 17

    Substitute any of the filters, any operator (=, <, >, <=, >=, !=), and any value. You can also use BETWEEN to specify a range of magnitudes.

    For example, here is a query to find objects with r magnitudes between 15 and 19:

    SELECT top 10 objid,ra,dec,r
    FROM PhotoObj
    WHERE g BETWEEN 15 and 19

Find by Absolute Magnitude (open SQL Search in new window)

Unfortunately, the Imaging Query Form allows you to search only by apparent magnitude, which is what is observed and stored in the database. To find objects by absolute magnitude, you will need to perform a SQL search.

Absolute magnitude relies on a distance calculation, which the SDSS can supply through redshift. Assuming Hubble Cosmology, the distance is equal to (4,280 MPc) x redshift. So the equation for absolute magnitude is:

Equation for absolute magnitude: M = m - 5 log (4,280 MPc x d)

SQL can perform simple mathematical calculations. But, to find magnitude and distance data together, you will need to search the specPhoto view, which has both photometric and spectroscopic data. To search this view, and add a statement like this to the WHERE block of your query:

WHERE modelmag_r-5*log10(4.28E+08*z) < -21

For example, this query returns the object IDs, positions, and apparent and absolute r magnitudes for all objects with absolute magnitude less than -21:

SELECT top 10 objid,ra,dec,modelmag_r,modelmag_r-5*log10(4.28E+08*z) as abs_mag_r
FROM SpecPhoto
WHERE modelmag_r-5*log10(4.28E+08*z) < -21

Back to Tutorials index