# Finding the background level

Let's look at the images from Sep 20, 2003, again. Use the "tv" command to display the image v585.fit. You should see lots of stars, and lots of hot pixels, all superimposed on a roughly uniform background.

Suppose we are interested in the background level -- how could we determine its value?

One way is the use the "mn" command to compute the arithmetic mean, or average, of all the pixel values.

1. What is the mean value of this image?
2. What is the standard deviation (or "rms") of this image? In theory, the standard deviation ought to be roughly the size of the scatter in pixel values.

Check these values by zooming in on a small section of the image and picking 10 different pixels. Make sure that each pixel is not a hot pixel, and that it has no starlight. Write down the values of those 10 pixels.

1. What is the mean value of those true background pixels?
2. What is the standard deviation of those true background pixels?

Do you see a problem here?

You can learn a lot about the statistical properties of an image by making a histogram of the pixel values.

1. Make a histogram of the image with the "hist" command.
2. Plot the histogram using "gnuplot". Make a graph which has an x-axis running from 900 to 1200, so that you can see how many pixels in the image have values between 900 and 1200 counts.
3. Where is the peak of this histogram
4. How does the peak value compare to the mean value you computed earlier?

It turns out that when there are even a small number of pixels with values which are MUCH higher than the typical background value (due to stars, or cosmic rays, or a bright nebula, or whatever), those pixels can affect the calculation of the mean value greatly. If what you really want to know is the typical value of the background, it might be better to ignore all those high pixels and concentrate on the majority of the pixels, which are clustered around relatively small values. The XVista command "sky" tries to do that: it fits a gaussian function to the histogram of pixel values, and reports the location of the peak, as well as the "sigma" of the gaussian function. This "sigma" is roughly 40 percent of the Full-Width at Half-Maximum (FWHM) of the gaussian fit.

1. Use the "sky" program to compute the background value of the image, like so:

sky v585.fit

2. How do the results of the "sky" program compare to the histogram of pixel values you made?