Observing a Variable Star – The Observations COSMOS Astronomy Project, Summer 2004

Patrik Jonsson, UC Santa Cruz David Lai, UC Santa Cruz Kathy Cooksey, UC Santa Cruz

1 The Observations

This write-up describes the observing part of the variable star project. It talks about what you will do at the telescope, and what we will do with the images to extract the information we want afterwards.

To do the observations, we will use the large 40 inch telescope on Mount Hamilton. We will look at a variable star, chosen more or less at random, called SZ Her.

What kind of a name is SZ Her? Her is an abbreviation of the Latin name for the constellation The Strongman, Hercules. Astronomers often name stars after the constellation in which they’re found. Stars that vary their brightness are called variable stars, and the first one to be found in a constellation was named A, the next B and so on. When they reached the end of the alphabet with Z, they started over with AA, then AB, and so on. So the name of our star, SZ Her, means that it was about the 500th variable star to be discovered in the constellation of Hercules.

SZ Her can’t be seen with the naked eye, but is still a fairly bright star, so with the large telescope we can take very short exposures. On the other hand, we want to see how its brightness changes with time, so we will have to take many images of it over a time span of several hours. In every one of these images, we will measure how bright the star is, and from this reconstruct how the star is varying.

Professional astronomers that use telescopes practically never actually look through the telescopes themselves, observations are instead done by taking pictures of the object of interest using a computer and a device called a CCD. A CCD is a very sensitive light detector, and by registering how much light is falling on different parts of the CCD an image is made. This is the same type of device that takes images in most digital cameras.

With a telescope you want to look at faint things, so to make a single picture light is collected for many seconds, minutes or sometimes even hours. When the image is taken, the result is a bunch of numbers. There is one number for every little point in the image, called a pixel, and the number basically tells you how many light particles, photons, that hit that part of the CCD during the exposure. (This number is often called “counts”, because it counts the number of photons.) You will learn more about how CCD’s work in a separate lecture during COSMOS, and this will be useful for you when you start analyzing your observations.

After the observations are done, there are a number of steps that have to be done to get the information we want out of the images. This is called reducing the images, and to do this we will use a computer program called IRAF, which is what some professional astronomers use almost daily.

2 Observing – Using the Telescope

For your observations, you will be using the 40 inch Nickel telescope on Mount Hamilton, a real research telescope that professional astronomers use. Since the telescope is located on Mount Hamilton, you will use the telescope remotely. A telescope operator will be in the control room on Mount Hamilton, communicating with you using a videoconferencing system. The telescope operator will move the telescope and make sure it’s pointing at the right object, and then you will use a computer to run the camera used to take images. During your visit to Lick Observatory, you will see the telescope and the control room where the telescope operator will be.

2.1 Keeping an Observing Log

It’s important that you keep a log of what’s going on while you’re observing, and afterwards when you’re analyzing the data. When you’re observing you should write down things like the time, exposure time, which color filter was used, and what’s in the image. (It’s remarkably hard to figure out what’s in an image afterwards...) As you’ll read about below, most of this information is also saved in the image itself, but it’s better to be on the safe side in case that information would be incorrect, because you won’t have an opportunity to get more images.

Later, when you’re analyzing and working with your images, it’s important to keep track of what you call the various images you’ve created and what you’ve done with them. Your project advisor will point out important things to write down as you’re working with the project.

2.2 Moving the Telescope

Moving the telescope across the sky is done from the telescope control room on Mount Hamilton. The telescope operator will use two controls, four large buttons to “slew”, move the telescope quickly to another part of the sky, and a little joystick that moves the telescope slowly so it points at the right object.

Positions on the night sky are given in a coordinate system that works kind of the same as latitude and longitude on the surface of the Earth, but instead of latitude and longitude it’s called RA and Dec. You can see what position the telescope is pointing at on the large readout in the telescope control room, and you will also have a display on your computer.

Since the telescope operator will move the telescope for you, you won’t actually have to do this, but you will have to tell the operator the coordinates of the object you want to look at. The position of SZ Her is:

RA: 17 39 37, Dec: +32 56 47 However, because of various effects like the starlight bending when it enters the Earth’s atmosphere, and the telescope itself bending and not pointing quite where you want it to, you have to aim the telescope at a slightly different spot. There is a computer program that calculates where you should point the telescope to get the object you want to look at to appear in the camera. The program is called “setel-on-axis” (for Set Telescope, using the On-Axis encoders, don’t worry about it...), and will be running on your computer.

Because of the rotation of the Earth, the stars, like the Sun, seem to move very slowly from East to West during the night. Once the telescope is pointing at an object, it will slowly move to keep pointing at that object as the Earth rotates. It does a fairly good job, but for many reasons it’s very hard to make a telescope that will track stars perfectly accurately. If you were to expose an image for a minute or so, you would see that the stars would look slightly elongated, because the telescope isn’t tracking them perfectly. To get perfect images, a more accurate way to keep the stars in exactly the same spot on the image must be used.

2.3 Long Exposures and Guiding

As we mentioned above, the telescope won’t track stars perfectly and if you take an exposure longer than maybe 10 seconds the stars will appear elongated on the image, see Figure 1. To overcome this problem the telescope has a little TV camera, in addition to the CCD camera you will be using to take images. While looking at the object, the telescope computer will monitor the position of a star on the TV camera and nudge the telescope as necessary to keep the star in exactly the same place in the image. This is called “guiding”, and is absolutely necessary to make nice images. The telescope operator will make sure the telescope is guiding, so you won’t have to worry about this.

Figure 1: This is an example of the difference that good guiding can make. See how nice and round the star in the image on the left is? That image was properly guided, as opposed to the image on the right where the star looks like more like a loaf of bread!

2.4 Color Filters

It turns out that it’s often very helpful to know the colors of things in astronomy. (For example, a star with a blue color is a young star.) The CCD camera is not color sensitive in itself, it just detects all light coming from the object, regardless of the wavelength of the light. The way we figure out the colors of objects is by putting different color filters in front of the camera. For example, if we want to make an image with the colors like in the real world, we can take an image with a red filter, one with a green filter and one with a blue. If we then display the image taken with the red filter in red, the one taken with a green filter in green and the one taken with a blue filter in blue, and blend them together, we’d get something that has colors like in real life. This is the same principle by which a color TV or color film works.

The telescope has a holder for four color filters, and you can switch between them using the computer. Astronomers use loads of different filters, but the most common ones (and the ones you will be using) are called U (for Ultraviolet), B (for Blue), V (for Visual, which means green) and R (for, you guessed it, Red).

Our observations will be taken mostly using the V filter, but because it’s also interesting to see if the color of the star is varying along with the brightness, we will also take some images using the B filter.

2.5 Taking Images

The program you will use to control the CCD camera is called “dx”, and has a couple of different windows you will use. There is a text window, which is used to give commands to tell the camera to take an image, to change the exposure time or to change which color filter to use. There is also an image window where the image you take will show up and which you can use to do some basic checks on the image.

Figure 2: These are the two windows you will use when observing. The window on the left is used to give commands to the camera on the telescope, the one on the right is used to examine the images you get.

“dx” uses a simple text interface, see Figure 2, where typing different letters will activate different functions. There are only a few options you will need to use here:

• “R” takes an image

• “B” changes the exposure time

• “I” lets you enter the name of the object in the image, so you know for later

• “K” lets you change which color filter is used

Once you have taken an exposure, the image will automatically be displayed. You can then use the image manipulation window to examine various aspects of the image. You can zoom in on a small part of the image, and you can change the colors to bring out detail in the bright parts or the dark parts of the image. There is also a function that will give a rough estimate of the brightness of a star in the image, something you will use to get a quick idea of what our variable star is up to during the night we are observing. It’s much easier to understand how this works when you’re actually sitting at the computer, so your project advisor will show you this.

2.6 Flat fields

The images from the CCD contain artifacts that we will have to take into account if we are going to be able to measure exactly how bright stars are. Ideally, every little pixel on the CCD would be equally sensitive to light. If this was the case, we wouldn’t have a problem, but as you may have guessed by now that’s not the case. Every little pixel varies in sensitivity, and there’s also dust on the optics of the telescope, which produce faint shadows in the images. The way to deal with this is to take an image called a “flat field”, which is just an image of something that is uniformly bright. Since we know that the image is supposed to be uniformly bright everywhere, all the features that we see must be due to the camera itself. If you look at flat field image, you will see doughnut-shaped features. These are the dust grains in the optics, and they look like doughnuts because they’re not in focus (only objects on the sky are in focus). You will also see that some pixels are just brighter than others, that’s because those pixels are simply more efficient at collecting light. There is a picture of a flat field image in Figure 4.

The good thing is that by taking a flat field, we know exactly what the sensitivity of every pixel in the camera is, and we can use that to correct for this effect in the images we have. More on that later when we talk about analyzing the images.

So, how can we take an image of something that is uniformly bright? The way to do this is to take a picture of the sky before it gets dark, just before sunset. At that time we can’t see any stars, so all we get on the image is the uniform light of the sky itself, which works very well. In fact, we want to take a bunch of flat field images so we can average them and get a better idea of what it actually is. Because this has to be done early, before it gets dark, the telescope operator will do this for you. (If no flat fields were taken, you might have to stay up until sunrise to do it then... ;-)

2.7 FITS files – the file format of choice for astronomers

When you take an image, it is automatically saved to disk, with a number that increases every time you take a new image. (This number is under option “C” in the datataker window in Figure 2.) Astronomers don’t use common image file formats like gif or jpg, but something called FITS files. (It means Flexible Image Transport System, or something like that.) There are two advantages to FITS files: the first is that they are much more accurate than other formats, it saves the actual number that came from the CCD camera, unlike a gif in which all numbers are between 0 and 255. This is essential, because in astronomy one object can be thousands of times brighter than another.

The other advantage is that FITS files not only saves the image itself, but lots of information about what’s in it. The so-called image “header” contains keywords that tell you, for example, at what time the image was taken, what the exposure time was, what camera was used, what is in the image (assuming that you actually told the computer that when you saved it), and so on. This is very handy, because it saves you from having to write down all information about the images you take. Since we want to measure how the brightness of our star changes with time, we need to know exactly at what time every image was taken. If this information wasn’t recorded in the header, someone would have to check their watch and write this information down every time, which not only would be a pain, but if they made a mistake in the time that image would be wasted.

3 Data Reduction and Analysis

3.1 What is data reduction and why is it necessary?

As you may have already realized, reading the text about the telescope, the instruments used to take images aren’t perfect. The images will contain artifacts, and we must do our best to remove these artifacts. When we try to understand the object that is on the image, we want the image to be as close as possible to what the object really looks like. Astronomers try to build instruments that create as few artifacts as possible, but that is very hard and tends to make the instruments very expensive. Luckily, a lot of these problems can be corrected for, and this is called “reducing” the images.

There is one main kind of correction that has to be done to your images, and we’ve already mentioned it: flat fielding. Flat fielding corrects for the fact that some pixels on the CCD are more sensitive to light than others.

3.2 IRAF

To do your reduction, you will use the software package called IRAF (Image Reduction and Analysis Facility), which is what professional astronomers use. IRAF is very powerful and can do everything you can possibly imagine, which makes it kind of complicated and intimidating to use. Don’t hesitate to ask your project advisor for help if things don’t seem to behave the way they should.

IRAF has no fancy graphics interface, everything is done by typing commands into a text window. This may sound archaic (it is...), but it actually works very well. Your project advisor will have moved the images you took with the telescope to the computer you will be using to reduce your data.

3.3 Displaying Your Images

To look at an image, you tell IRAF to display it in a separate window called “DS 9” with the command

   cl> display imagename 1

where imagename is the name of the image file, and the number 1 tells IRAF to display it in frame 1. There are 4 frames you can display your images into, and by doing that you can flip back and forth between them if you want to compare what the images look like.

If you’re actually sitting at the computer reading this, try playing around with the display window a little. Move the mouse around over the image. You will see some numbers at the top of the image window, it will tell you the row and column in the image that the mouse pointer is on, and it will also tell you the “counts” in that pixel. A blank piece of the sky should have at most a few hundred counts, while the center of a bright star may have tens of thousands.

If you click one of the mouse buttons, the following will happen:

• The left button marks the region with a circle or some other figure.

• The middle button recenters the image on the point you click.

• The right button changes the colors of your display. This is useful if you want to look at very dark things.

There’s also a bunch of buttons above the image. When you click on these buttons, new buttons will appear with more functions.

• “Frame” allows you to select which frame you look at. “Prev” and “Next” flips to the previous and next frame, respectively.

• “Zoom” brings up buttons that allows you to zoom in and out.

• “Color” allows you to display your image in different sets of colors instead of a gray scale.

While you’re working with your reduction and analysis, feel free to display any image you make. It’s good to look at a few just to make sure that everything seems OK, but you don’t want to look at them all since you will have several hundred of them.

3.4 Combining Images

You may remember that when we talked about flat fields, we said that it was better to take a couple of them and use the average. So, how do we get the average of the images? The IRAF command imcombine does this for you.

Figure 3: this is an example of what the settings for imcombine look like. The settings are appropriate for combining flat field images.

Like many IRAF commands, imcombine has a long list of settings. To change the settings for a command, type

   cl> epar command

If you do this for imcombine, you get a window that will look something like Figure 3.

Don’t freak out, you won’t need to deal with most of these settings. “Input” are the images that will be combined, and “output” is what the result will be called. “Combine” tells imcombine what to do, in this case to average the images. When you’re satisfied with the settings, you can tell IRAF to go ahead and do what you want by typing “: go”. If you want to get out of the window without actually running the command, you can hold down the Ctrl key and press “D”.

3.4.1 Combining Flat Field Images

To combine your flat fields, you should use exactly the settings for imcombine that are shown in the image above. This has to do with the fact that the flat fields are images of the evening sky, and the evening sky gets darker and darker, so the brightness in the flat field images aren’t the same. Imcombine will take care of this for you, if you use the settings shown in Figure 3:

There is one more thing that has to be done. When you correct your star images using the flat field images, you will divide the star image by the flat field image. The flat field images have very large counts, so dividing the star image by them will make the resulting image look like it had very small counts. To avoid this, we divide the combined flat field image by its average value. To find out the average value of your combined flat field image, use the command imstat (for “image statistics”):

   cl> imstat flatname

This will print a bunch of numbers, one of them being the average value of the image. Write down the average value, and then divide the flat field by that value using the imarith (for “image arithmetic”):

cl> imarith flatname / averagevalue outputflatname Now your flat fields are ready to be used to correct your images!

3.5 Using the Flat Field

Once we have prepared a good flat field by combining several images, like we talked about before, applying the correction is easy. We want to divide the images by the flat field image. We use the imarith command again:

cl> imarith starimage / outputflatname flatfieldedstarimage What does the flat field image look like? Figure 4 is an example. You can clearly see the doughnut-shaped shadows that come from dust on the optics. The doughnuts come in two sizes, that’s because the dust grains are lying on two different places in the telescope. It’s also obvious that some pixels are more sensitive than others, and you can also see that around the edges there is less light.

The flat field correction isn’t obvious to the naked eye, the difference in sensitivity between the pixels is about 5%, but it’s very important that we deal with it if we want to be able to measure the brightness of the stars accurately.

3.6 Working with Many Files

Now that you’ve seen how we would divide the flat field to make a nice looking image, you may be getting worried that this seems like a lot of typing... After all, you have maybe a hundred Figure 4: This is an example of a flat field image. Notice the doughnut-shaped shadows that come from dust on the optics. You can also see that some pixels are more sensitive to light than others, and that there is less light around the edges. The difference between the most sensitive and the least sensitive pixels is about 5%.

images from the telescope, do we really have to type all this for every single image? No, we can tell IRAF to perform the operations on all images at once!

If we make a file which contains a list of images, we can tell IRAF to look in that list for the images to work with. Here’s an example, suppose our images that we took at the telescope are called “star1, star2, star3 and star4”. We want to divide all these images by our flat field, and have the resulting files be called “flatstar1, flatstar2, flatstar3, flatstar4”. We could do this by putting the first image names in a file called “inputlist” and the resulting image names in another file called “outputlist”. We then use the imarith command like this:

   cl> imarith @inputlist / flatimage @outputlist

The @’s tell IRAF to look in that file for the names of images it should use. Does this sound confusing? Don’t worry, your advisor will help you to make sure you get it right.

4 Analyzing the Data

Now that we have removed the artifacts from our images, it’s time to do what we came here for: measuring the brightness of our stars.

4.1 Photometry – Measuring How Bright Things Are

Measuring how bright an object is called “photometry”, which comes from Latin and means something like “measuring light”. A very suitable name, because that’s exactly what we’re doing... In principle, this is simple: the CCD counts light particles, so if we want to know how much light comes from a particular star, we can just add up the number of light particles that the CCD registered for that star (adding up the “counts” in the image). In practice, it’s a little more complicated. Because the telescope does not make perfect images, and even more importantly, because the atmosphere makes images blurry, a star will look like a small fuzzy spot on the image. Deciding how big the fuzzy star is isn’t always so easy. To make matters worse, there is light coming from everywhere on the sky, even if there is no star there. This light comes from stars that are too faint to be seen, from scattered city lights and, if the Moon Figure 5: This is an example of how IRAF measures the brightness of a star. The light from the star is added up from the pixels that are within the smaller circle, and the pixels that are between the smaller and larger circle are used to determine the background sky brightness. You can see that even where there are no stars, there is some light. This light does not come from the star we want to measure, so it has to be removed.

is up, moonlight. If we want to know how much light is actually coming from the star, we need to subtract this diffuse skylight, just like we had to subtract the dark current.

The way this is done is to add up light within a circle around the star, the smallest circle in Figure 5. The sky brightness is determined from the region between this circle and another larger circle, also shown. We then assume that the sky brightness within the smaller circle is the same, and subtract that amount of light to get the light that comes from the star. This works well if care is taken to choose the sizes of the circles so that:

• All the starlight fits inside the smaller circle.

• No other stars fits inside the smaller circle.

• The larger circle is not so large that there are many other stars inside it.

The actual amount of light that we get from the star will vary even if the star itself has a constant brightness. There may be thin clouds in the sky, which take out some of the light. Also, because the star we look at moves across the sky as the Earth rotates, we will first see it in the East, then high overhead, and finally in the West. As the star moves, the light has to pass through different amounts of air. When the star is overhead, the light comes straight down through the atmosphere, but when it’s rising or setting the light comes in at an angle, and we pass through more air. Air isn’t perfectly transparent, so the star will look a little brighter when it’s overhead then when it’s lower in the sky. (This is the same effect that makes the sun look dimmer at sunset, the sunlight has to go through a lot of air.) If we were to just measure how bright the star appeared, we would see all these effects in addition to the fact that the star itself is actually varying in brightness, and it would be very hard to disentangle the effects. The way we overcome this is by comparing our varying star to another star in the same image. All the effects we talked about above will make all the stars in the image look fainter, so by comparing one star to another we don’t have to worry about that.

Figure 6: These are the settings for the qphot command.

4.2 Photometry in IRAF: qphot

OK, so we talked about how to measure the brightness of a star. How do we actually do it? We’ll use the IRAF command qphot (for “Quick PHOTometry”. There are much slower and more complicated ways. Ask one of the star cluster people what DAOPHOT means... ;-)

There are many parameters for qphot, and as usual you change them by typing

   ap> epar qphot

This will bring out the window that looks something like Figure 6. As you can see, there are quite a lot of settings. “Image” is the name of the image that has the stars you want to measure. “annulus” and “dannulus” are the sizes of the two circles from Figure 5. “Coords” is a file that tells IRAF where the stars are in the image. “Output” is the name of the output file that contains the brightness of the stars we wanted to measure.

We don’t have to go through the rest of the settings here, but they should be set to what they are in Figure 6.

After adjusting the settings, and making sure that we have made a file with the positions of the stars, we can just run the qphot command, and IRAF will take care of the rest for us. It will then spit out a number for every star which indicates its brightness. This number is called a magnitude.

4.3 The Magnitude System or: Why Astronomers Do Everything Backwards

Astronomy is an old science that goes back thousands of years, and there are quite a few things that seem backwards, and the only reason they’re used is because “if it was good enough for every astronomer before us, it must be good enough for us...” The way astronomers measure brightness, in something called magnitudes, is one of these backward things.

Back in the day, in this case something like the 17th century, when astronomers started to make catalogs of the positions and brightnesses of stars, they called the brightest stars “first magnitude”, the ones that were a little fainter “second magnitude”, and so on until they came to the stars that were barely visible to the naked eye, which they called “sixth magnitude”. This system continued to be used, but as astronomers became more and more exact the system had to be refined. It turned out that the very brightest stars were much brighter than first magnitude:

Sirius, the brightest star in the sky, has a magnitude of about -1.5. Our Sun, a really bright star, has a magnitude of -27. Going the other way, stars that are too faint to be seen with the naked eye have magnitudes larger than 6. Our favorite star, SZ Her, has a magnitude of 9.2 when it’s at its brightest. The faintest things that can be seen with the largest telescopes on Earth have a magnitude of about 30.

So, here we are, stuck with a system where the brighter something gets, the smaller the number! Confusing? Don’t feel bad – every astronomer gets this wrong from time to time...

4.4 Registering the Images

During the night you will probably have taken on the order of a hundred images. The stars will have moved a little between every image, and clearly we don’t want to pick out the stars we want to look at in each one of those images. Luckily, IRAF can look at all of the images and shift them so that the stars are in the same place in every image. This is called “registering”. Once the images are registered, we can just give the positions of the stars that we want to look at to IRAF and it will do the photometry in all the images for us at once! Pretty nifty!

To do the centering we will use the IRAF commands imcentroid and imalign. They are kind of hard to use and there is some voodoo going on in figuring out the correct settings, so your project advisor will help you with this.

4.5 Getting the Final Result – the Light Curve

Okay, we’re getting close! Once we have gotten the magnitudes (brightnesses) of the stars from IRAF, we will run those through a little computer program that formats the data nicely and does the comparison of SZ Her to the other stars in the image. It will also pick out the time the image was taken from the image header so we can make a graph of brightness vs. time. This is called the light curve.

Most variable stars vary in a periodic manner, the same way over and over again. If this is the case, we can get a better idea of what’s going on by “folding” the light curve. This means that we plot all the cycles on top of each other, so instead of using time as the x-axis, we use the fraction of the period. This is called “phase”. Your project advisor will show you how to plot the light curve, and print it out on paper if you want.

Now the fun begins! Using the light curve from your observations, plus data that comes from two other observing nights within the past month, it’s time to try to figure out what kind of a star SZ Her is. This will be described in another handout.

Figure 7: This is an example of a “folded” light curve. These observations may have been taken years apart, but because we plot the variations as a function of phase and not actual time, we can see them all on one plot.