Imagine the Universe!
Imagine Home  |   Teachers' Corner | HERA Overview  | Using HERA for Spectroscopy  |  

Plotting the Model and Data

With the first fit of your data complete, you should look at the data and model to see how well they match up. Xspec can plot the data and model for you to inspect.

First, however, you will want to change one of Xspec's defaults. By default, Xspec will plot the "channel" of the data on the x-axis. The channel is related to energy of the detected light. However, the channel-to-energy conversion will be different for different detectors, and in the same detector, it may change over time. To make the results more meaningful, you will want to have the plot display photon energy on the x-axis.

To change the plot from "channel" to energy, type the following in the Xspec command window:

setplot energy

Now, to put Xspec into plot mode, type to following:

iplot data

With Xspec in plot mode, you can make the plot prettier by changing the limits on the x-axis and adding color to the data to make the model stand out more. The following commands will do this for you:

rescale x 0.2 5.0
color 2 on 1

Plot of the initial 
	fitted model

Plot showing the data (red) and model (black) for the initial fit of the SNR spectrum in Xspec.

If you are able, you may want to print the graph, so you can compare this graph with the final version. (Click here if you need instructions on printing the graph.)

When you are finished tweaking the look of the plot, you will want to leave Xspec's plot environment by typing:


During the rest of this activity, you can update the plot with changes you make to the model and fit using the easyplot command like this:

easyplot 0.25 5.0

The 0.25 and 5.0 in the above command set the x-axis limits.

Answer these questions about your current model and plot:

  • Note the chi-squared for this fit. (Found in the Xspec Command Window.)
  • How well does the model match the data?
  • Are there places where the model matches particularly well? Where?
  • Are there places where the model matches particularly poorly? Where?
  • Do you think that you have found the best model for these data? Why or why not?
  • If not, then describe what features of the data the model seems to be missing.

Imagine the Universe is a service of the High Energy Astrophysics Science Archive Research Center (HEASARC), Dr. Alan Smale (Director), within the Astrophysics Science Division (ASD) at NASA's Goddard Space Flight Center.

The Imagine Team
Acting Project Leader: Dr. Barbara Mattson
All material on this site has been created and updated between 1997-2012.

DVD Table of Contents
Educator's Index