Today, we will finally get to the standard method for removing thermal noise from CCD images. To illustrate, we'll switch to a different set of images.
There is a new sub-directory in the main course directory:
Please copy all the images from the sep20_2003 directory into your own sub-directory. If you need help doing that, ask the instructor.
The image v585.fit is a 30-second image of the field of V585 Lyrae, a variable star in the constellation Lyra. We'll work with this image quite a bit, so get familiar with it. Display the image with parameters like this:
tv v585.fit z=850 l=500 zoom=2It should look something like this:
We want to get rid of the thermal contribution to this image. Some of the bright spots are real stars, but others are hot pixels where many thermal electrons have accumulated.
What is the mean level of the single dark image dark30-001.fit? For the example below, I'll assume it's 120, but use the actual value you find.
Let's make a COPY of the real image, so that we can go back and try again later.
cp v585.fit copy1.fit
Okay, now we'll subtract the mean level of one dark frame from the copy. Remember to replace the "120" below with the actual value of the dark image you measured.
sub copy1.fit const=120
tv v585.fit z=850 l=500 zoom=2
Okay, that didn't work very well. Let's try subtracting a single dark image from the raw target image. We'll pick the first 30-second dark frame. As before, we'll make a COPY of the target image so that we can use the original for future work.
cp v585.fit copy2.fit sub copy2.fit dark30-001.fit
Again display the subtracted image copy2.fit at a zoom level of 2. Find a set of z= and l= parameters which cause it to look similar to the original image when displayed like this:
tv v585.fit z=850 l=500 zoom=2
Hmmm. Cosmic rays seem to be a problem. Suppose that we average together all 10 of the 30-second dark frames, and subtract THAT from our target image. The way to average together two images is with the add command; you have to include some extra parameters:
add image1.fit image2.fit norm outfile=average.fit
You can add together more than 2 images. The norm keyword means "normalize the sum at the end by dividing by the number of input images." So you could add together four images like this:
add image1.fit image2.fit image3.fit image4.fit norm outfile=average.fit
But this could get pretty annoying if you need to add together 10 images, or 20, or 50. In that case, it makes sense to the use the Unix wildcard character "*" to specify "all files which have names containing a particular pattern." Look:
Can you figure out how to add together all the 30-second dark images to make an average dark frame?
Rats. Even averaging together 10 dark frames still leaves a residue at the location of a cosmic ray in just one of those dark frames; and that residue could screw up our calculations on the target image.
When you reach this point, look around. If someone nearby is still working on earlier stages of this assignment, offer to help. We'll all do the next part together.
Suppose that you take a survey of incomes among a set of people who work in the Seattle area.
You want to describe the results of your survey with just a single number. What best represents the typical income of Seattle residents?
Perhaps you could use the mean, also called the average.
A statistic which does a better job of ignoring isolated outliers is the median. It is simply "the number in the middle of the distribution." Here's how to calculate the median of a set by hand:
If there are N elements in a set, then the median is just element number N/2 in the sorted set.
To create an image which is the pixel-by-pixel median of a set of images, you can use the median command (surprise!).
median dark30-0*.fit outfile=dark-med.fit
box 1 sr=150 sc=120 nr=30 nc=30 tv copy1.fit box=1 zoom=6 z=650 l=500 tv copy2.fit box=1 zoom=6 z=650 l=500 xo=200 tv copy3.fit box=1 zoom=6 z=650 l=500 xo=400 tv copy4.fit box=1 zoom=6 z=650 l=500 xo=600
Using the median of a set of dark images is the standard operating procedure for astronomers who use CCDs. It's easiest if all your target images have the same exposure length, say, 30 seconds. At the start of the night (and sometimes at the end, if you are really paranoid), you take a set of 10 or 20 or 50 dark images, each 30 seconds long. You can create a "master dark image" by taking the median of all these individual darks, and then subtract it from your target images.
Images we take near sea level don't suffer much from cosmic rays -- they only appear every now and then. The median technique is a bit better than simple averaging, but the difference isn't large.
On the other hand, telescopes on mountaintops, high above much of the Earth's atmosphere, are exposed to much greater levels of radiation from space. And telescopes in orbit are even more vulnerable. The Hubble Space Telescope circles the Earth not far from regions of the Earth's magnetic field which are full of high-energy electrons and protons. Cosmic rays can be really annoying in images taken by these instruments. Take a look at this raw image from HST:
Yuck! There are actually several different kinds of nasty stuff in this image:
We can't do anything about the regions of the chip which were not illuminated, but look what happens when we take the median of just two raw HST images of this field.
What is the "median" of two numbers? The smaller of the two.
That's much better. Most of the cosmic rays are gone, though some single-pixel events are still present. The satellite trail is reduced in prominence, too.
After combining about 20 images of this field (taken in the V and I filters), all the cosmic rays are gone, and the satellite trail has completely disappeared.
Copyright © Michael Richmond. This work is licensed under a Creative Commons License.