profoundSkyEst: Old Sky Estimator (Somewhat Defunct)

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/profoundSky.R

Description

A high level utility to estimate the sky properties of a supplied image. This is closely related to the equivalent routines available in the LAMBDAR R package.

Usage

1
2
3
profoundSkyEst(image = NULL, objects = NULL, mask = NULL, cutlo = cuthi/2,
cuthi = sqrt(sum((dim(image)/2)^2)), skycut = 'auto', clipiters = 5, radweight = 0,
plot = FALSE, ...)

Arguments

image

Numeric matrix; required, the image we want to analyse. The galaxy should be approximately central within this image since annuli weighting is done to avoid brighter central regions dominated by galaxy flux.

objects

Boolean matrix; optional, object mask where 1 is object and 0 is sky. If provided, this matrix *must* be the same dimensions as image.

mask

Boolean matrix; optional, non galaxy parts of the image to mask out, where 1 means mask out and 0 means use for analysis. If provided, this matrix *must* be the same dimensions as image.

cutlo

Numeric scalar; radius where the code will start to calculate the sky annuli around the central object. Should be large enough to avoid significant object flux, i.e. a few times the flux 90 radius. Default is half of cuthi.

cuthi

Numeric scalar; radius where the code will stop calculating the sky annuli around the central object. Default is the corner edge of the image.

skycut

Numeric scalar; clipping threshold to make on the image in units of the skyRMS. The default scales the clipping to the number of pixels in the image, and will usually work reasonably.

clipiters

Numeric scalar; How many iterative clips of the sky will be made.

radweight

Numeric scalar; what radius power-law weighting should be used to bias the sky towards sky annuli nearer to the central object. radweight>0 weight the sky value more towards larger radii and radweight<0 weight the sky values towards the image centre. The default of 0 means there is no radial weightings. This becomes clear when plotting the radrun output (see Examples). Note this behaves differently to the similarly named option in LAMBDAR's sky.estimate.

plot

Logical; should a diagnostic plot be generated?

...

Further arguments to be passed to magplot. Only relevant is plot=TRUE.

Details

This function is closely modelled on the sky.estimate function in the LAMBDAR package (the basic elements of which were written by ASGR). The defaults work well for data where the main objects (usually a galaxy) is centrally located in the image since the cutlo default will usually ignore contaminated central pixels. On top of this it does pretty aggressive object pixel rejection using the skycut and clipiters options.

The defaults should work reasonably well on modern survey data (see Examples), but should the solution not be ideal try modifying these parameters (in order of impact priority): skycut, cutlo, radweight, clipiters.

It is interesting to note that a better estimate of the sky RMS can be made by using the output of profoundImDiff (see Examples).

Value

Returns a list with 5 elements:

sky

The value of the estimated sky.

skyerr

The estimated uncertainty in the sky level.

skyRMS

The RMS of the sky pixels.

Nnearsky

The number of sky annuli that have error bars encompassing the final sky.

radrun

The output of magrun for radius versus sky pixels values.

Author(s)

Aaron Robotham

See Also

profoundMakeSegim, profoundMakeSegimExpand

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
## Not run: 
image = readFITS(system.file("extdata", 'KiDS/G266035fitim.fits',
package="ProFit"))$imDat
sky1 = profoundSkyEst(image, plot=TRUE)
image_sky = image-sky1$sky
sky2 = profoundSkyEst(profoundImDiff(image_sky), plot=TRUE)

#You can check whether you are contaminated by the central objects by plotting the radrun
#object in the list (it should be flat for a well behaved sky):
sky = profoundSkyEst(image, cutlo=0, plot=TRUE)
magplot(sky$radrun)
abline(h=sky$sky)

#The above shows heavy contamination by the central object without. We can either mask
#this out using the output of profoundSegImWatershed, set cutlo to be larger or weight
#the sky towards outer annuli.

profound=profoundProFound(image)
sky = profoundSkyEst(image, mask=profound$objects, cutlo=0, plot=TRUE)
magplot(sky$radrun)
abline(h=sky$sky)

#The above is better, but not great. A more aggressive mask helps:

sky = profoundSkyEst(image, mask=profound$objects_redo, cutlo=0, plot=TRUE)
magplot(sky$radrun)
abline(h=sky$sky)

#Or weighting the sky to outer radii

sky = profoundSkyEst(image, mask=profound$objects, cutlo=0, radweight=1, plot=TRUE)
magplot(sky$radrun)
abline(h=sky$sky)

#Finally we can leave the central cutlo mask turned on:

sky = profoundSkyEst(image, mask=profound$objects, plot=TRUE)
magplot(sky$radrun)
abline(h=sky$sky)

## End(Not run)

ProFound documentation built on Jan. 8, 2021, 5:37 p.m.