The original spectra collected with
the SGS must be corrected before they can be analyzed. This chapter describes how to perform these
corrections with an image-processing program called Iris. The first section of this chapter is a brief
primer on digital imaging. This is
followed by a description of bit depth and file formats. The final section is the actual processing
procedure.
5.1
A Brief Look at the Nature of Digital Images
When a digital image is taken, it is
generally displayed in a traditional visual format. It is easy to qualitatively analyze an image displayed this
way. For example, Figure 5.1 is an
image of two stars. We quickly see that
one is slightly brighter than the other is, and that their shapes are close to
an ideal round airy disc. However, what if we wanted to know how much
brighter one star was than the other? To find out we would have to measure the image, which would mean
converting it into some form of numerical information.
Figure
5.1
With traditional photography, a
great deal of time was spent making this conversion, and eventually it
developed into its own science. Digital
images, of course, make this easier because they are already in a numerical
format. Each pixel in the picture has
three values, its x-axis or column coordinate, its y-axis or row coordinate,
and its z-axis or intensity coordinate. Thus, a digital picture is a three dimensional array of
information. The pixel value can
represent any unit. When the image
comes directly from the CCD camera’s analog-to-digital converter, the pixel
values are in ADU’s (analog-to-digital units). However, if we calibrated the camera with a source of known intensity,
we could develop a conversion factor and change the ADU’s into units of power,
such as ergs/cm2/sec (Berry 24).
The numerical nature of a digital image also lends itself to various
ways of displaying the information. Figures 5.2a and 5.2b are alternate ways of viewing Figure 5.1. Figure 5.2a is a numerical representation of
a part of the image. The numbers in the
gray regions are the x and y coordinates of the pixels, and the numbers in the
white are the respective intensities of the pixels. Figure 5.2b is a surface plot of the image. I made both pictures using a program called
Transform, a data visualization program by Fortner SoftwareLLC.
Figure
5.2a
Figure
5.2b
Both of these images are
accurate representations of the image; however, we need to consider how useful
each is to us. It is difficult to
visualize the image from just a chart of numbers. After studying the numbers in Figure 5.2a, we can see that this
is a section of the image containing a star. This is difficult work though, and if we did not already know the image
was of stars, we might not recognize it. However, this format does let us analyze the image pixel by pixel. The surface plot in figure 5.2b can give us
a good idea of the relative intensities of the stars, but we would have a
difficult time comparing their relative position in the image. The original grayscale image, Figure 5.1, is
better for this, but does not show us individual pixels or relative intensities.
The pixels in Figure 5.1 can range from values of 0 to 255. However, our eyes can only see about 30
shades of gray, making our perception somewhat inaccurate (Ross 33). We would like to see our stars as white and
our background as black. We can assign
the background levels, below 90 ADU’s, to be black, and our stars, at 255 ADU’s
to be white, and then assign the values in between to other gray values on a
linear scale. The result is shown in
Figure 5.3a, while the original image is displayed in Figure 5.3b. Adjusting the black level and the white
level is known as adjusting the threshold.
Figure 5.3a
Figure
5.3b
We are not limited to representing
images in grayscale. Our eyes are only
able to distinguish 30 shades of gray, but they can distinguish millions of
different colors. We can add a pseudo
colors to make intensity variations more apparent. The two images below, Figure 5.4a and 5.4b are again representations
of the sample image, but now our eyes measure intensity through color.
Figure 5.4a
Figure
5.4b
Another benefit of the quantitative
quality of digital images is that we can alter them easily. Because the image is simply an array of
numbers, we can apply almost any mathematical process on them. Some of these processes can be quite
complicated. However, in our work with
spectrometry, we can limit ourselves to some basic arithmetic. In Figure 5.5, we have subtracted 70 ADU’s
from our original image.
Figure
5.5
Notice the
background is much darker, representing lower intensities, and the stars no
longer make it into the yellow intensity region. The subtraction has changed our information and therefore we have
to be careful about how we can use it. For example, we could not compare intensities with another image unless
we did the same subtraction. However,
it is still safe to compare the ratios of the intensities of these two stars,
or to measure their position.
We can also multiply our image. Figure 5.6 has been multiplied to be 150% of
the original. Again we must be careful
in what data we take from the image. For example, the ratios of variations in the background are the same. However, notice that the peak intensities
are above the range of allowed pixel values. The stars have had their tops chopped off in this picture. Therefore, we cannot accurately measure
their position or relative intensities.
Figure
5.6
It is also possible to multiply or
divide by other images. Flat fielding,
for example, is a division of the light intensity variation along different
parts of the CCD chip. Some operations
involving other images are legitimate, but some result in loss of data or
misrepresentation of data. It is too
difficult to make a general rule about what data you can retain after applying
a process. However, we do not reap the
full benefits of a digital image by taking a purist approach and avoiding
alterations altogether. Using good
scientific judgment and understanding the process on a mathematical level is
the best way to avoid misrepresentation of data.
5.2
Pixel Depth and Image Format
The maximum pixel value of the
previous images was 255. This is true
only of 8-bit images. The bit number
refers to the number of binary digits that are used to store information for
the intensity of the pixel. An example
of an 8-bit binary number is 11001010,
which is 202. The maximum value an 8
bit binary number can have is 28, which equals 256. One of these values has to represent zero,
so the scale is moved down one and the maximum pixel value is 255. For a 16-bit number, the maximum value is 216,
or 65536, and if this is scaled down one, the maximum value becomes 65535. A 16-bit image can store 28 or
256 times more data than an 8-bit image. For some imaging applications, this added information is not
needed. For example, if a biologist
wanted to photograph the movement of cells, only the outline of the cells may
be of interest. The outline of the cell
could be represented by a difference of 50 or 100 ADU’s, a range of values that
falls easily into an 8-bit image. Astronomers however, require a far deeper range of pixel values. In one image, there may be a star that is
100 ADU’s above the background level and another that is 40000 above. The majority of astronomical images are
therefore 16 bit or higher.
Figures 5.7 illustrate the need for
a 16-bit pixel depth. The star in
Figure 5.7a was imaged at 16-bit. In
the surface plot of this 16-bit image, Figure 5.7b, we can see the star has a
definite center. The intensity quickly
drops off away from the center, producing an intense point with a fading airy
disk around it. If the image is cut off
at the 255 level, the star is no longer an intense point, but an intense disk
with only a small amount of fading around it. The surface plot of the 8-bit image, Figure 5.7c, shows what looks like
a stump of a tree. Having lost the rest
of the tree, we have lost the majority of our information.
Figure 7.7a
Figure
5.7b
Figure
5.7c
The spectral images produced at
Wheaton are 16-bit. Figure 5.8a is a
low-resolution spectrum of Betelgeuse with its intensity plotted against its
pixel column below, Figure 5.8b.
Figure
5.8a
Figure
5.8b
The spectrum clearly
has the pixel depth to support the data. In Figure 5.9a and b, the same spectrum was subjected to an 8-bit cut
off level. Only a small portion of the
spectrum falls below this threshold. It
is impossible to retrieve any data from this image.
Figure
5.9a
Figure
5.9b
The format of an image describes how the data of the image are arranged. Various types of formats exist, each
tailored to different applications. The
FITS file is the preferred format for astronomers. FITS stands for Flexible Image Transport System. It was designed to allow equipment with
different hardware configurations to share images with minimal data loss (http://fits.gsfc.nasa.gov/fits_intro.html). A FITS file is composed of a header, the
image data, and a trailer. The header
contains mandatory information about the format of the file and how it is to be
read, as well as optional information such as when the image was made and what
camera was used. In CCDops, it is
possible to edit some of the information on the header. The trailer is a filler to ensure that the
file is of a standard length.
The image data comes in several bit depths and data arrangements. The original basic FITS supported 8-bit
unsigned and signed integers, 16-bit and 32-bit bit signed integers, and 16 and
32 free float point data (Berry 31-32). A 16-bit signed image has data values that range from –32768 to
32767. The same amount of information
is available as if the image ranged from 0 to 65535. However, over the years the FITS format has taken on other data
arrangements. Many analog/digital
converters, such as the one in our camera, save in an unsigned format that FITS
did not originally support (http://fits.gsfc.nasa.gov/fits_intro.html). CCDops and other programs, such as MaxIm
DL, save in the unsigned format. This
creates a problem because other programs, such as Transform and Iris, adhere to
the original FITS protocol and lose data when they open this unsigned
format.
Below is an example of the data loss
when Iris opens an unsigned FITS file. Again, we begin with a 16-bit star,
Figure 5.10a. The surface plot in
Figure 5.10b is the original unsigned version of the star; notice that we can
see the full range of information as the star comes to a nice peak. The peak value is well above 32767. The plot in Figure 5.10c is the unsigned
version opened in Iris. Pixel values
above 32767 are lost because the program registers values only from –32768 to
32767.
Figure
5.10a
Figure
5.10b
Figure
5.10c
This data loss is a serious problem
if we want to process in Iris. Supposedly,
Iris has a command that will open unsigned images in signed format, but this
has not worked for me. However, there
is another way around it. Dividing the
original image by 2 brings all pixel values below 32767. The operation is linear, so the relative
proportions of the data are maintained. Some information is lost because values are rounded to the nearest
integer; however, this is more acceptable than losing all data above a certain
value. Under the “Utilities” menu in
CCDops there is a “Pixel Math” command. Before saving the image in FITS format, divide the image by 2. Figure 5.11 shows the FITS file opened in
Iris, notice it maintains the shape of the original, Figure 5.10b.
Figure
5.11
I believe this is the biggest
drawback to processing in Iris. I have
contacted Christian Buil, the designer of Iris in hopes that he can repair the
bug in the unsigned/signed conversion.
5.3
Processing with Iris
Iris is a freeware program for processing astronomical digital images
and designed by amateur astronomer Christian Buil. Buil updates this program frequently and it can be downloaded
at http://www.astrosurf.com/buil/us/iris/iris.htm. There is a helpful manual in Adobe Acrobat format. The command lines used in the following
operations were taken from this manual.
Iris has several commands specially tailored to spectrometry. The command Full_Spec, for example, dark
subtracts, flat fields, rotates the spectrum, subtracts the background level,
and registers the spectrum so you can add multiple images together. I do not use this command because I do not
flat field my spectra. Also, this
command merely subtracts the average background noise level. It is better to subtract the sky spectrum
near the spectrum of interest (Berry 284). Iris does not have a command directly for this.
Images are originally collected in
CCDops and initially saved in SBIG format. CCDops can save directly to FITS format; however, once this is done,
CCDops cannot reopen the file. Iris
reads only FITS or PIC files so SBIG images must be manually re-saved in FITS
format. Saving in both formats is
tedious, but it is better to keep software options open. CCDops has commands to easily average
multiple dark frames and then perform dark subtractions. I find it easier to dark subtract images in
CCDops. After dark subtraction, I
divide the image by 2, as described earlier, and then convert the image to FITS
format.
I begin by first creating a
temporary folder for Iris to work with. I then set this folder as Iris’s working path. This is done from File/Settings/Working Path. In command line mode, Iris will open and
save files from and to this directory only. Next, I copy the files I wish to work with into this file. It is easy to save your processed image over
your original image when working with Iris, so it is important to copy the
images and leave originals in a safe location.
To access Iris’s command line option click on this icon,
. A command line window will appear. Commands can only be entered after a >,
otherwise an error line will appear. Begin by loading an image. The
command is “>load [file name]”. If
at anytime you are not sure of the syntax of a command, simply type in the
command without anything after and Iris will reply with the required
syntax. For example, typing “>load”
produces “Syntax: load [name]”. One
image can be loaded into Iris at a time.
Captured spectra are a combination
an object’s spectrum and the spectrum of the background sky. At the center of the image, there is a faint
emission line from local street lamps. This emission line runs through the stellar spectrum, therefore the
spectrum for the local sky must be removed before analysis. For point source objects, such as a star or
planet, a sample of the background sky can be extracted from the original
image. Figure 5.12 shows a spectrum of
Seginus with the sample sky region and sky and spectrum region labeled.

Figure 5.12
Extended objects, such
as nebulae may have emission lines that are across the whole width of the
image. In these cases, it is impossible
to acquire a sky background sample from the same image. Instead, another
picture of a near by part of the sky with the same exposure is required (Berry
284-285).
To remove the sky background we
first isolate the spectrum. In the
lower right hand side of the screen, Iris displays the x and y coordinates and
pixel intensity of the cursor position. By scrolling over the spectrum with the curser and looking at the
intensity level, identify the y range of pixels in which the spectrum
lies. Then use the “>l_add” command
to add the pixel values in the y-axis columns of this region. The syntax for this command is “>l_add
[ymin] [ymax]”. This creates a new
image with the same x dimension, but with a y dimension of 20 pixels. However,
each row is identical. It is important
that the spectrometer be calibrated so that spectral lines are perfectly
vertical in order for this to work. This method also allows us to ignore the tilt of the spectrum.
Save this as something
recognizable. I use the name of the
original image with an “l” added to designate spectral “line.” To save, type “>save [file name]” and
Iris will save it in the temp folder. DO
NOT SAVE OVER THE ORIGINAL IMAGE. You
will have to return to the image to isolate the sky background sample. Also, make note of the y value range. In the case of the sample image, we use the
command “>l_add 30 45”, which has a y range of 15 pixels, see Figure 5.13.
![]()
Figure 5.13
Because the spectrum was tilted, we
include a fair amount of the sky background on top of the sky background
already included in the spectrum itself. This does get subtracted however. We sample the sky back ground in a similar manner. First, reload the original image, “>load
[file name]”. Using the cursor, we
isolate a y range that does not contain our object spectrum. This range does not have to be the same size
as the spectrum’s range, in fact, the larger the sky background sample range,
the better. Instead of adding this
range, we take the median pixel value along the vertical axis. The command for this is “>l_median [ymin]
[ymax]”. The median has the advantage
of avoiding noisy or dead pixels. It is
very easy for a noisy pixel to appear as a bright emission line when adding
over a vertical range. In Figure 5.14,
I artificially added a hot pixel to the image by changing one pixel to its
maximum value. I then vertically added
the range.
Figure 5.14
Using a median eliminates this
problem and takes a statistically better model of the sky background. However, the median is the value of only one
row. In order to model the sky
background in our spectrum, we must multiply the median by the range over which
the spectrum was sampled from. In this
case, we multiply our median by 15, thus modeling the sum of the 15 rows of sky
value that were added together in the spectrum’s range. This is done through the “>mult [value]”
command. After multiplication I save
the image as “sky.”
Next, we want to subtract the sky
background from our object spectrum. We
reload our spectral image and then use the subtract command, “>sub [file
name] [offset]”. The [file name] is the
image we want to subtract, in this case “sky”, and the offset is a value that
is added or subtracted from the final image. The offset is important because the program we use to analyze our
spectrum does not register negative values. If at some point the sky background is more intense than the spectrum,
perhaps at a strong absorption line, Iris will return a negative number. However, it is not necessary to initially
enter the proper offset value. I
always begin by entering zero into the offset value. After subtraction, I use the cursor and the intensity indicator
to check that no pixels have negative intensities. If there are negative intensities, it is possible to add a value
to the whole image that will bring these intensities above zero. The command is “>offset [value]”. After that, recheck and then save your
changes.
After this, it is possible to
analyze the spectrum. However, the
spectrometer produces spectra that decrease in wavelength from left to
right. Vspec can easily calibrate this,
but because the wavelength decreases from left to right, the program calculates
a negative dispersion. Vspec cannot
perform an instrument response calibration on a profile with a negative
dispersion. To fix this, use Iris’s
“mirror y” command to flip the spectrum. Once this is done, save the spectrum as something different, I use the
original name with an “r” added to designate “reversed.”
The following is the entire
procedure as typed into Iris’s command lines:
>load seginus
>l_add 35 50
Max: 172094.000
>save seginusl
>load castor
>l_median 60 120
>mult 15
>save sky
>load seginusl
>sub sky 0
>offset 500
>save seginusl
>mirror y
>save seginusr
Figure 5.15 shows the profile of the
final spectrum in blue and the profile of the sky background in red. We can clearly see that the background does
contain information that could affect our analysis of the spectrum.
Figure
5.15
Before saving, it is often helpful,
but not essential to adjust the threshold of the image. This process was described earlier in the
chapter. Iris has a convenient
threshold slider that allows you to adjust levels by dragging the curser. Iris has an auto threshold function that
sets levels by determining a small, predefined number of pixels to be above the
white value and a similar percentage below the black level. Levels can also be defined in the command
line code “>visu [high] [low]”. After this, I find it helpful to save the spectrum in FITS format, for
analysis, and in Bitmap (BMP) format, which allows you to display the image on
documents such as this. Remember, adjusting
the threshold is purely a matter of display and does not change the data of the
FIT file.