Cooking with Sloan: General Tasks: Find Data for Objects
 
DR7 Help
 Site News
 Introduction
 Cooking with Sloan
     - General
     - Solar System
     - Stars
     - Galaxies
     - QSOs/Cosmology
     - Teaching/Labs
 FAQ
 
 Search Form Guide
 SQL Tutorial
 SQL in SkyServer
 Sample SQL Queries
 Graphing
 Query Limits
 Searching Advice
 
 Archive Intro
 Table Descriptions
 Schema Browser
 Glossary
 Algorithms
 Web Browsers
 
 Download
 Data Publications
 API
 SkyServer Sites
 
 Contact Help Desk
Check Flags

Back to General Tasks index

Get objects with clean photometry (open in new window)


By using several flags together, you can limit your searches to return only objects that have clean photometry, thereby ensuring that you have a good sample. The flags you use differ depending on whether you are looking at stars or extended objects.

The queries below run slowly. These are test versions that use TOP 10 to return only the first 10 matching objects. To return all matching objects, remove the top 10 and use the CasJobs batch query system (link opens in a new window), which lets you run queries that take up to 8 hours. Also, note that lines that start with "--" are comments that are not executed as SQL statements.

For stars, use the following query to return IDs, positions, colors, and flags:

SELECT TOP 10 objid, ra, dec, u, g, r, i, z,
dbo.fPhotoFlagsN(flags) as flags
FROM star
WHERE ((flags & 0x10000000) != 0)       -- detected in BINNED1
AND ((flags & 0x8100000c00a4) = 0)     -- not EDGE, NOPROFILE, PEAKCENTER,
       -- NOTCHECKED, PSF_FLUX_INTERP, SATURATED, or BAD_COUNTS_ERROR
AND (((flags & 0x400000000000) = 0) or (psfmagerr_g <= 0.2))
       -- not DEBLEND_NOPEAK or small PSF error
       -- (substitute psfmagerr in other band as appropriate)
AND (((flags & 0x100000000000) = 0) or (flags & 0x1000) = 0)

 

For extended objects, use the following query to return IDs, positions, colors, and flags:

SELECT TOP 10 objid, ra, dec, u, g, r, i, z,
dbo.fPhotoFlagsN(flags) as flags
FROM galaxy
WHERE ((flags & 0x10000000) != 0)       -- detected in BINNED1
AND ((flags & 0x8100000c00a0) = 0)     -- not NOPROFILE, PEAKCENTER,
       -- NOTCHECKED, PSF_FLUX_INTERP, SATURATED, or BAD_COUNTS_ERROR
       -- if you want to accept objects with interpolation problems for PSF mags,
       -- change this to: AND ((flags & 0x800a0) = 0)
AND (((flags & 0x400000000000) = 0) or (psfmagerr_g <= 0.2))
       -- not DEBLEND_NOPEAK or small PSF error
       -- (substitute psfmagerr in other band as appropriate)
AND (((flags & 0x100000000000) = 0) or (flags & 0x1000) = 0)
       -- not INTERP_CENTER or not COSMIC_RAY – omit this AND clause if you
       -- want to accept objects with interpolation problems for PSF mags.

 

The form below will let you practice searching for flags with SQL, using the example queries on this page. Press Query 1 or Query 2 to load the queries, and Submit to run the queries.

 

Format HTML XML CSV



Enter your SQL query in the text box. The query is limited to 10 minutes and 100,000 rows.


 Go to the previous page

Back to Cooking with Sloan main page
Back to Help main page
Contact Help Desk