Creative Commons License Copyright © Michael Richmond. This work is licensed under a Creative Commons License.

Using computers to analyze images

The plan today is for you to use the Windows machines in the Gosnell lab to connect to the computer, which contains some image processing programs. We'll use these programs to analyze data gathered at the RIT Observatory. The first step is for you to learn how to connect to this machine:

Once you have connected to spiff, how can you work with astronomical images? The enhanced goals of today's session are

If we run out of time, we'll continue on Monday.

Connecting to spiff

Sit down at one of the Gosnell Windows classroom machines and log in. You should see a desktop like this:

One of the items in the "Start" menu is "xming". Choose the XLaunch program. When it runs, select "Multiple Windows"

then "Start a program"

Fill in the information as shown below

Just click "next" for this screen

And then "Finish" at last

If all goes well, you'll see a new window on the desktop

It's possible to alter the properties of the window to some degree -- I'll discuss this in class.

Navigating the directory structure

The spiff computer runs an operating system called "Linux," which is a member of the Unix family. It has a hierachical structure of directories. All students are logged in as the user called "phys445". Inside phys445's home directory, each student has a subdirectory of its own. When you first connect to iceberg, you will be in the home directory of the "phys445" user. The prompt should look like this:

The last portion of the prompt is the name of the directory in which you are currently working. If you change to another directory, say, richmond, by typing

     cd richmond
you'll see the prompt change:

In general, you will do all your own work inside the subdirectory with your own name. It is a very bad idea for you to play around with material in any other student's directory.

The command

prints a list of files and sub-directories on the screen. By default, it lists the contents of the current directory,

You can print out the contents of another directory(s) by typing its name as the argument(s) to the "ls" command.

Copying files

There is a directory into which I'll place data for all of us to analyze during class. That directory has a special name: $dd. To copy a file from this directory to your own, use the cp command. Here's how to copy one particular image from the $dd directory to your own subdirectory:

The point is, if you make a copy of an image in your own directory, you can modify, edit, or delete the image. You can always go back to retrieve another copy of the original without worrying about errors you might have introduced via improper processing. I would like each student to do all of its work in its own sub-directory.


  1. Copy all the images in the $dd directory into your own directory.

When you reach this point, please pause and look around. If somone nearby is having problems, please help him or her.

Examining images with XVista

Okay, you have the copy in your own sub-directory. Now what? I have written a set of programs for processing astronomical images, called the XVista package. These programs aren't user-friendly, and lack a GUI. You'll have to type the commands by hand -- horrors! Of course, if you want to put together a script of your own commands, you can then run it repeatedly on images ... without having to sit in front of the computer and click mouse buttons.

There is some information available on-line for each XVista command via the man command. For example, for help on the tv command, just type

     man tv

To see more of the man page, type the spacebar. To quit reading the man page, type the "q" key.

You can see a list of the XVista commands and a very brief description of each with

     man xvista

If you prefer, you can read this list of commands in HTML format.

So, let's start with two XVista commands.


Astronomical images in the FITS format have two components: a header, containing human-readable information about the image, and a data section. You can print out the header of an image with the buffers command.

If information scrolls off the top of your xterm window, use the scrollbar to look back at it.

If your terminal doesn't have a scrollbar, you can create one:
  1. move the cursor into the xterm window
  2. press and hold down the "Control" key
  3. press and hold the middle mouse key (press down on the wheel)
  4. slide the mouse to highlight the Enable Scrollbar item
  5. release the mouse buttons

You can use the scrollbar to review text which has scrolled off the top of the window. Place the cursor into the scrollbar region, then press the middle key (wheel) and move the mouse.


  1. On what date did we acquire the "" image?
  2. At what time did we acquire the "" image?
  3. How many pixels high is this image? How many pixels wide?

When you reach this point, please pause and look around. If somone nearby is having problems, please help him or her.


The tv command is a workhorse: it displays a FITS image in a new window, and also allows you to do look at individual pixel values, zoom in, zoom out, and make several types of measurement.

The simplest way to use it is like so:

     tv hst.fts
which should pop up a new window to display the image:

If you receive an error message like this:
     read_property: XGetWindowProperty returns wrong number of items
then you need to type
and then try tv again.

You can control the contrast and base level of the displayed image with command-line options to the tv command.

    tv z=0 l=70
where Compare these two versions of the same image: first, displayed via
    tv hst.fts z=0  l=1000

Next, displayed via

    tv hst.fts z=0 l=80

You can also use the invert option to switch from white-stars-on-black to the reverse:

    tv hst.fts z=0 l=200 invert

After you specify invert, all subsequent displays will show the same scheme (black on white) until you explicitly type invert again.

Exercises: Display an image, and find out what all the following things do. Write down the answers to each.
  1. Moving the cursor within the image window.
  2. Clicking the left mouse button.
  3. Clicking the middle mouse button (wheel) holding it, and moving the mouse
  4. Clicking the right mouse button
  5. Pressing the following keys:
    • 'r'
    • 'a'
    • 'z'
    • 's'
  6. What do the following command-line options to the tv command do?
    • zoom=2
    • xo=300
    • yo=100

When you reach this point, please pause and look around. If somone nearby is having problems, please help him or her.

For more information

If you have never used any Linux or Unix system in the past, you may want to read a book or web site which describes the basic shell commands. Here are some possibilities:

Creative Commons License Copyright © Michael Richmond. This work is licensed under a Creative Commons License.