getsky (Aug2004) | rjtools | getsky (Aug2004) |
The approximate mean, median, mode and standard deviation are computed and returned as task parameters 'smean', 'smidpt', 'smode' and 'srms'. The number of pixels used to compute these values and the minimum and maximum value among those pixels are returned as parameters 'snpix', 'smin' and 'smax'. If 'lower' and/or 'upper' are defined, values lower than 'lower' and higher than 'upper' are excluded from the statistics. Outlying data values are subsequently rejected in at most 'maxiter' iterations, using the 'lsigma' and 'usigma' rejection limits. If 'shrink = yes', in subsequent iterations these rejection limits are shrunk by a factor of 1/log10(10+n) sigma. Use this option with caution, since it tends to force more pixels to be rejected in every subsequent iteration (and, hence, to reject pixels well into the noise) and often does not converge (hence, perform the maximum number of iterations allowed).
If 'border = yes', the statistics are computed along the perifery of the image rather than in the full image, and the width of that image border is given by 'bwidth', either as a fraction of the full image size or explicitly in pixels. If 'bwidth' is given as a fraction (0.0 < bwidth < 0.5), the task will return the width in pixels corresponding to that fraction upon exit of the task.
This task is similar to task 'xdimsum.iterstat', but does not restrict the user to a simple image section. Unlike 'iterstat', this task --like all low level 'rjtools' tasks-- is meant to return the statistics of a single image; looping over multiple images can be implemented by calling 'getsky' from a wrapper script or within a calling routine.
rj> getsky N3795B.fits maxiter=10 lo=INDEF up=INDEF border+ verbose+ GETSKY: image="N3795B.fits" iter npix mean midpt mode stddev min max 0 94044 89.02441 88.20217 87.95200 35.72043 2.142487 3979.257 1 93976 88.36284 88.09306 87.35298 7.512115 2.142487 266.1988 2 93866 88.29318 87.92945 87.34640 6.934748 57.06718 125.6382 3 93854 88.28855 87.99965 87.59961 6.923052 57.06718 122.5781
2. As example 1. but now consider only the relevant portion of the image:
rj> getsky N3795B.fits[175:350,175:350] maxiter=10 border+ verbose+ GETSKY: image="N3795B.fits[175:350,175:350]" iter npix mean midpt mode stddev min max 0 10812 89.18510 89.02879 90.02815 7.044384 65.21137 124.6932 1 10811 89.18182 88.86336 89.93762 7.036426 65.21137 117.2023
3. As example 2. but now we force additional rejections by setting 'shrink' to "yes":
rj> getsky N3795B.fits[175:350,175:350] max=5 us=3. ls=3 shr+ bor+ verb+ GETSKY: image="N3795B.fits[175:350,175:350]" iter npix mean midpt mode stddev min max 0 10812 89.18510 89.02879 90.02815 7.044384 65.21137 124.6932 1 10775 89.14839 88.91618 89.81207 6.924227 68.12540 110.1293 2 10748 89.12794 88.80158 89.74479 6.856776 69.04175 108.7920 3 10728 89.11044 88.83663 89.69844 6.811915 69.80295 107.8384 4 10700 89.10789 89.05798 90.16695 6.753806 70.51555 107.1065 5 10666 89.12547 88.84386 89.87837 6.687073 71.39774 106.7239
4. Compute the sky background and error thereon and sky subtract a multi- extension FITS image:
getsky (img//"[SCI]", show+, label-) | scan(iter,ipix,iavg,imed,imod,isig) printf("Subtracting sky background %8.2f +/- %7.2f DN ...\n", imed, isig) imcalc (img//".fits[SCI]", img//"_s", "im1-"//str(imed)) imcalc (img//".fits[ERR]", img//"_e", "sqrt(im1**2+"//str(isig)//"**2)") imcopy (img//"_s.fits", img//".fits[SCI][*,*]", verbose+) imcopy (img//"_e.fits", img//".fits[ERR][*,*]", verbose+) delete (img//"_s.fits,"//img//"_e.fits", yes, verify-)