Last modified 6 years ago Last modified on 01/31/2013 11:19:10 PM

Create a count of galaxies for each of the predefined areas which satisfy a certain color cut, generate output adequate for visualization

declare @RightShift12 bigint;
set @RightShift12 = power(2,24);
select (htmID /@RightShift12) as htm_8 ,        -- group by 8-deep HTMID (rshift HTM by 12)
        avg(ra) as ra, 
        avg(dec) as [dec], 
        count(*) as pop                         -- return center point and count for display
from  Galaxy                                    -- only look at galaxies
where  (0.7*u - 0.5*g - 0.2*i) < 1.25           -- meeting this color cut
and  r < 21.75                                  -- brightr than 21.75 magnitude in red band.
group by  (htmID /@RightShift12)                -- group into 8-deep HTM buckets.

This query originally came from SDSS (S-13).

Todo: rewrite. Issue: we currently don't have htmID in the LSST schema, need to come up with something equivalent first.