wiki:db/queries/033
Last modified 6 years ago Last modified on 02/01/2013 12:15:30 AM

Find all galaxies with a deVaucouleours profile (r¼ falloff of intensity on disk) and the photometric colors consistent with an elliptical galaxy

This query will be a full table scan on the Object table.

  SELECT * 
  FROM   Object
  WHERE  extendendess > 0.8 -- is galaxy
    AND  ( ( r-i - (g-r)/4 - 0.18 ) BETWEEN -0.2 AND 0.2 )
    AND  ( ( r-i - (g-r)/4 - 0.18) >  (0.45 - 4* (g-r) ) )
    AND  (   g-r > ( 1.35 + 0.25 * r-i ) )
    AND  flags ...

Note that:

  • g = fluxToAbMag(gFlux_SG)
  • r = fluxToAbMag(rFlux_SG)
  • i = fluxToAbMag(iFlux_SG)

Todo: rework flags.

This query originally came from SDSS (S-5):

declare @binned    bigint;                              -- initialized "binned" literal
set     @binned =  dbo.fPhotoFlags('BINNED1') + -- avoids SQL2K optimizer problem
                   dbo.fPhotoFlags('BINNED2') +
                   dbo.fPhotoFlags('BINNED4') ;
declare @blended   bigint;                              -- initialized "blended" literal
set     @blended = dbo.fPhotoFlags('BLENDED');          -- avoids SQL2K optimizer problem
declare @noDeBlend bigint;                              -- initialized "noDeBlend" literal
set     @noDeBlend =    dbo.fPhotoFlags('NODEBLEND');   -- avoids SQL2K optimizer problem
declare @child     bigint;                              -- initialized "child" literal
set     @child =   dbo.fPhotoFlags('CHILD');    -- avoids SQL2K optimizer problem
declare @edge      bigint;                      -- initialized "edge" literal
set     @edge =    dbo.fPhotoFlags('EDGE');     -- avoids SQL2K optimizer problem

SELECT  objectId
FROM    Galaxy AS G                     -- count galaxies
WHERE   lnlDev_r > log(.1) + lnlExp_r   -- red DeVaucouler fit likelihood greater than disk fit
  AND   lnlExp_r > 0                    -- exponential disk fit likelihood in red band > 0
  -- Color cut for an ellipical galaxy courtesy of James Annis of Fermilab
  AND (G.flags & @binned) > 0  
  AND (G.flags & ( @blended + @noDeBlend + @child)) != @blended
  AND (G.flags & (@edge + @saturated)) = 0  
  AND  G.petroMag_i > 17.5
  AND (G.petroMag_r > 15.5 OR G.petroR50_r > 2)
  AND (G.petroMag_r < 30 AND G.g < 30 AND G.r < 30 AND G.i < 30)
  AND ((G.petroMag_r-G.extinction_r) < 19.2
  AND ((G.petroMag_r - G.extinction_r) < (13.1 +        -- deRed_r < 13.1 +
                        (7/3)* G.grColor +              -- 0.7 / 0.3 * deRed_gr
                        4 * G.riColor -4 * 0.18 ))      -- 1.2 / 0.3 * deRed_ri          
  AND (( G.riColor - G.grColor/4 - 0.18) BETWEEN -0.2 AND 0.2 ) )
  OR (
        ((G.petroMag_r - G.extinction_r) < 19.5 )
        AND (( G.riColor - G.grColor/4 -.18) >   -- - deRed_gr/4 - 0.18 -- cperp = deRed_ri             
                (0.45 - 4* G.grColor ))          -- 0.45 - deRed_gr/0.25
        AND (G.grColor > ( 1.35 + 0.25 * G.riColor ))          
     )