### 5 Deriving accurate background values

Probably the most important factor limiting the accuracy of a galaxy profile is the accuracy of the image background value used. If this value is significantly too high (or too low) the profile will be distorted at the faint isophotes. This will modify any scale length value determined for the galaxy by SECTOR or by GRAPHS. Great care should be taken to ensure the most accurate possible value is found.

To this end, two ESP applications are provided: HISTPEAK and LOBACK. HISTPEAK derives a global value for an image by considering all the image pixels apart from those defined as bad by an optional ARD file. This is most useful when the image is well flatfielded. LOBACK, by comparison, determines values for discrete parts of the image centred on image co-ordinates provided in a text file. This is most useful when an image is not perfectly flatfielded.

#### 5.1 Global background value determination

The application HISTPEAK examines the pixel values within an image and determines a number of statistical quantities.

The application can be used with the following syntax:

% histpeak in=p2 use=w sfact=4 device=x2w

This leads to the NDF p2 being examined, using the whole image, smoothing the histogram with a filter of radius 4 counts and displaying the histogram on device x2windows. Full details of the parameters may be found in Appendix 0.

The alternative to using the whole image is to use an ARD file to define the parts of the image to be ignored. In that case the syntax is:

% histpeak in=p2 use=a ardfil=^areas.dat sfact=4 device=x2w

In this example the source image p2 is used together with the ARD file definition areas.dat (note the use of the ‘ ̂’ character). The histogram generated to calculate the modal value is smoothed using a Gaussian filter of radius 4 counts. The histogram generated is displayed on device x2w. Other examples are shown in Appendix 0.

Full details of ARD files may be found in Appendix C.

The program output generated is in the the following format:

Filename:   p2
Title:      Raw Plate Image
Shape:      201 x 201  pixels
Bounds:     x = 1700:1900  y = 600:800
Image size: 40401 pixels

HISTPEAK Results: p2

Pixels (used):              40401     Pixels (bad):                0
Lowest count:            4768.000     Highest count:        9388.000
Skewness:                   0.516     Kurtosis:                1.795

Mean:                    6226.607     Median:               6210.462

Histogram modal values:
Unsmoothed:              6179.000     Smoothed:             6176.000
Projected:               6175.306     Interpolated:         6193.840

Absolute dev.:            333.494     Variance:              183890.
Standard. dev.:           428.824     Back. st. dev.:        365.752

Smoothing filter radius:
Radius request:                 4     Radius actual:               4

Contents of the most occupied histogram bin:
Unsmoothed:                60.000     Smoothed:               46.204
Interpolated:              39.609

The first section gives the name of the file used, the shape of the image, its title and the co-ordinate range involved. This is output as soon as the file name has been input, thereby allowing you to exit the application at an early stage if the wrong file has been requested.

The later sections are data derived either directly from the pixel values in the file or are determined following the construction of a histogram containing the pixel values. Each of the histogram bins has a default width of 1 count (or larger if the count range present in the image is large). The peak in the histogram is used to determine the modal value by a number of routes. The methods are as follows:

Unsmoothed:
The histogram bins are examined to identify the most occupied bin.
Smoothed:
The histogram is smoothed using a Gaussian filter of radius SFACT and then searched to identify the most occupied bin.
Projected:
A number of chords through the histogram peak at different heights are taken. The length and midpoint of each of these is calculated and an extrapolation used to determine the location of the midpoint of a zero length chord.
Interpolated:
The part of the smoothed histogram near to its peak is identified and data from that region ‘fitted’ with a Gaussian curve. The location of the fitted peak is calculated. Under normal conditions this should be the most accurate estimate of the modal pixel value.

The standard deviation of the pixel values in the image is calculated using the standard equations for a Normal distribution. A value (SIGMA) is also derived, evaluating the standard deviation of the pixel value distribution in the region of the histogram immediately surrounding the modal value. For a pure noise image these two values would be expected to be the same, but the presence of any objects or image flaws acts to skew the distribution, generating ‘outliers’ which quickly causes the standard deviation of the image as a whole to become large compared to the value obtained for parts of the image where no objects are imaged.

A crude estimate of the influence of the outliers may be obtained by considering the ratio of the normal standard deviation to the absolute deviation of the image. Alternatively, the skewness and kurtosis (third and fourth moments of deviation from a Gaussian distribution) may also be considered. It should be noted that the kurtosis value provided has had its base value of three subtracted to allow more digits to be displayed.

As a result of the default bin width used (1), images with a pixel count range less than 3 will not be examined by HISTPEAK. To overcome this, images may be manipulated using KAPPA’s CMULT to increase their range by a suitable factor.

#### 5.2 Local background value determination

If you are intending to determine profiles for a large number of galaxies on an image and the image is not perfectly flatfielded then the background values in the image region surrounding each of the galaxies may be determined using LOBACK.

The first requirement for this is a text file containing a list of the coordinates of the objects on the image. This may be derived in a number of ways. The most obvious is to use the KAPPA application CURSOR (with LOGFILE assigned a value). This method is convenient when only a small number of galaxies are required from each image. However, if all the galaxies/objects on an image are to be examined then the text files generated by PISA, RGASP’s IMAGES or IRAF’s FOCAS might form the the basis of an input file to LOBACK.

The input file for LOBACK should (in the simplest case) contain two columns, they represent the $x$ and $y$ co-ordinates respectively in the Current co-ordinate system of the NDF. LOBACK then determines modal pixel values, pixel value standard deviation and background standard deviation values at each of the image locations described in the text file. Optionally (parameter THIRD=FALSE), you may define a third column representing the minimum number of pixels to be used in determining the modal pixel value or alternatively (parameter THIRD=TRUE) the number of pixels believed to be in the object found at that location. In the latter case the number of pixels used, and the size of the image area they are taken from is adjusted to ensure the sample contains a significant number of non-object pixels - hopefully sky. In either case, the software imposes a lower limit on the number of pixels to be used, thereby reducing the effect of a sparse pixel value histogram.

The application can be used with the following syntax:

% loback in=p2 infile=coords.dat sfact=2 third=true out=backs.dat width=64

This reads the galaxy co-ordinates from a file called coords.dat. The information in the third column of the text file is assumed to be the number of contiguous pixels found in the galaxy by PISA, IMAGES or FOCAS. The pixels used to make up the histogram required will be taken from an area of the image 64x64 pixels in size. In the unlikely event of an image being smaller than the requested number of pixels required, all the non-bad image pixels will be employed. Other examples are given in Appendix 0

If an object location is not within the bounds of the image requested then an error message is generated for that object, but the program continues reading the object list working on each in turn. The modal pixel values generated use the same methods as HISTPEAK, i.e. (un)smoothed histogram, projection and interpolation (see HISTPEAK).

An example output file is shown in Appendix F and described in Section 15.