We draw random points with a density of 100 points per arcmin2 for each patch and each filter. These random points can be used for several purposes; (1) a random sample for clustering analysis, (2) to identify problematic areas, (3) to compute the survey area and the fraction of masked areas, etc. Available information carried by the random points, per filter and per patch, is:
- whether a point is in a non-overlapping region of a patch/tract (
patch_inner and tract_inner
) - pixel flags such as
pixelflags_interpolatedcenter
- number of visits contributed to the point (
inputcount_value
) - local PSF size: recorded as the second moment of the PSF model (see FAQ: how to measure the size of an object, to convert into FWHM)
sky_mean
: mean of sky value in 2″ diameter apertures for the sky objects (merge.footprint.sky == True
objects, see FAQ). Constant within patch.sky_std
: standard deviation of sky value in 2″ diameter apertures for the sky objects (merge.footprint.sky == True
objects). Constant within patch. To compute the limiting magnitude at 5 sigma, do:lim_mag = -2.5 log10(5*sky_std) + 27.0
adjust_density
parameter: a random number between 0 and 1 to adjust the sky density. A cut likeadjust_density < 0.5
will decrease the sky density by a factor of twopix_variance
: pixel variance at random point position (note that the variance given for the object is the sum of the pixel variance over the source footprint).
Examples
Query the database
-- This is a simple sql query to get all columns from the random database in one single patch
-- Use tractSearch(object_id, tract) function or skymap_id (= tract * 10000 + patch_x * 100 + patch_y)
-- For the randoms, the "NOT i_pixelflags_edge" is mandatory
-- near the border of the survey.
SELECT *
FROM pdr3_wide.random AS ran
WHERE tractsearch(object_id, 8523)
AND patch_s = '3,5'
-- AND skymap_id = 85230305
AND i_pixelflags_bright_objectcenter is not True
AND i_pixelflags_edge is not True
LIMIT 10;
Compute the survey area
The random point density is 100 per arcmin2. Thus the area in deg2 is simply the number of random points given a selection:SELECT COUNT(*) / 100.0 / 3600.0
FROM pdr3_dud.random
WHERE i_inputcount_value > 10 AND isprimary = True;
Adjust the random local density
The "adjust_density" is a random number in the interval [0:1]. For example, to divide the random point density by a factor of two (to get 50 /arcmin2), set:adjust_density < 0.5
Mean sky and sky variance in a patch
The mean and standard deviation of the sky object in 2" diameter aperture per patch is stored as sky_mean and sky_std. To get these quantities per patch and compute the limiting magnitude, e.g. at 5 sigma, one may do this directly using the database-- This query gets the patch mean sky and variance
-- Use tractSearch(object_id, tract) function or skymap_id (= tract * 10000 + patch_x * 100 + patch_y)
SELECT i_sky_mean, i_sky_std, -2.5*LOG(5.0*i_sky_std)+27.0 as imag_limit
FROM pdr3_wide.random
WHERE tractsearch(object_id, 8523)
AND patch_s = '3,5'
-- AND skymap_id = 85230305
LIMIT 1;
Compute the masked fraction
-- This query returns the masked fraction in bright object masks for tract 8523.
-- Use tractSearch(object_id, tract) function
SELECT 1.0 - CAST(SUM(CASE WHEN i_pixelflags_edge is not True AND i_pixelflags_bright_objectcenter is not True
THEN 1 ELSE 0 END ) AS DECIMAL)
/ CAST(SUM(CASE WHEN i_pixelflags_edge is not True
THEN 1 ELSE 0 END ) AS DECIMAL) AS masked_fraction
FROM pdr3_wide.random AS ran
WHERE tractsearch(object_id, 8523);
Get seeing sizes
-- This query gets 1% of random objects in the entire Wide and record the position as well as the local seeing FWHM.
SELECT ra, dec,
shape_detradius(array[g_sdssshape_psf_shape11, g_sdssshape_psf_shape22, g_sdssshape_psf_shape12])*2.0*sqrt(2.0) AS gPSF,
shape_detradius(array[r_sdssshape_psf_shape11, r_sdssshape_psf_shape22, r_sdssshape_psf_shape12])*2.0*sqrt(2.0) AS rPSF,
shape_detradius(array[i_sdssshape_psf_shape11, i_sdssshape_psf_shape22, i_sdssshape_psf_shape12])*2.0*sqrt(2.0) AS iPSF,
shape_detradius(array[z_sdssshape_psf_shape11, z_sdssshape_psf_shape22, z_sdssshape_psf_shape12])*2.0*sqrt(2.0) AS zPSF,
shape_detradius(array[y_sdssshape_psf_shape11, y_sdssshape_psf_shape22, y_sdssshape_psf_shape12])*2.0*sqrt(2.0) AS yPSF
FROM pdr3_wide.random
WHERE adjust_density < 0.01
LIMIT 10;