xnslm: Sky subtract images using running mean

Package: xdimsum

Usage

xnslm inlist omasks nmean outlist

Parameters

inlist
The list of input images to be sky subtracted. The input image list is assumed to be in order.
omasks
The list of object masks associated with each input image or the input image keyword containing the name of the object mask normally OBJMASK. Object masks contain 1's in object regions and 0's elsewhere.
nmean
The number of neighboring images used to computed the sky image for each input image.
outlist
The list of output sky subtracted images.
hmasks = ".hom"
The list of output holes masks or the string appended to the output image name to create the holes mask name. The holes masks are only created if the input object masks are defined, and there is at least one undefined sky image pixel. Holes masks contain 0's in undefined sky regions and 1's elsewhere. The holes mask is required by later processing steps and is normally not deleted on task termination.
forcescale = no
Force recalculation of the input image statistics even though they have been previously computed and stored in the keyword "SKYMED".
useomask = yes
Use the input object masks if any to compute the sky statistics as well as create the sky images ?
statsec = ""
The input image section used to compute the sky statistics for each input image. By default the entire input image is used.
nsigrej = 3.0
The rejection limits used to compute the image statistics in number of sigma.
maxiter = 20
The maximum number of rejection cycles used to compute the image statistics.
nskymin = 3
The minimum number of input images used to compute the sky image.
nreject = 1
The number of high and low side pixels to reject when computing the sky image.
cache = yes
Enable the caching the input image data in memory ?
del_hmasks = no
Delete the holes masks at task termination ?

Description

XNSLM computes the average sky image for each image in the input image list inlist and subtracts it from the input image to create the output list of sky subtracted images outlist. The input image list is assumed to be ordered by time of observation. If the input object masks list omasks is defined then input image pixels in object regions are removed from the sky image computation. XSLM also creates a list of holes masks hmasks.

XNSLM estimates the median for each input image using iterative rejection around the mean, pixels in the region defined by statsec, and the bad pixel rejection parameters nsigrej and maxiter. If useomask = yes and an object mask is defined for the input image, then pixels in object regions are also rejected from the sky statistics computation. The reciprocal of the median value is stored in the keyword "SKYMED". New sky statistics are computed if forcescale is yes or if the SKYMED keyword is undefined. The XRSKYSUB task is used to compute the image statistics.

XNSLM computes the sky image for each input image by multiplying each input image by the value of the SKYMED keyword, and then computing the mean of the nmean neighbor images after rejecting the nreject high and low pixels. For example if the number of input images is 25 and nmean is 6 then images 2-4 are used to compute the sky image for image 1, images 10-12 and 14-16 are used to compute the sky for image 13, and images 22-24 are used to compute the sky image for image 25. There must be a minimum of nskymin neighbor images or the sky image will not be computed. If the input object masks are defined then pixels in object regions are also rejected from the sky image computation. The XRSKYSUUB task is used to compute and subtract the sky images.

After the sky image is computed XNSLM divides it into the input image and computes the median of the ratio image. The final sky subtracted image is computing by multiplying the sky image by the median of the ratio image and subtracting it from the input image. The XRSKYSUB task does this as well. More about XRSKYSUB can be found in the appropriate help page.

If input image masking is enabled then it is possible for pixels in the sky image and the output sky subtracted image to be undefined. If at least one such pixel is undefined in the output image then XNSLM creates a holes mask hmasks. The holes masks are used by the XMSKCOMBINE task tp create a combined mask for the XNREGISTAR tas.

If cache is yes then XNSLM will attempt to cache image in memory as needed. This can significantly speed up the statisticis computation and the image combining step.

If del_hmasks is enabled then the holes masks are deleted at task termination.

Examples

1. Sky subtract the demo images with object masking.

cl> type demo.list
demo01
demo01
...
demo25

cl> xnslm @demo.list "" 6 ".sub" nsigrej=5.0 maxiter=10

cl> dir *.sub.imh
demo01.sub.imh
demo01.sub.imh
...
demo25.sub.imh

2. Repeat the previous example but specify an output image list.

cl> xnslm @demo.list "" 6 @outlist  nsigrej=5.0 maxiter=10

3. Repeat example 1 with object masking assuming that the object mask names are stored in the keyword "OBJMASK"

cl> xnslm @demo.list "OBJMASK" 6 ".sub"  nsigrej=5.0 maxiter=10

4. Repeat example 2 with object masking assuming that the object mask names are stored in the image list objmasks.

cl> xnslm @demo.list @objmasks 6 @outlist nsigrej=5.0 maxiter=10

Time requirements

Bugs

See also

xslm