Imagine the Universe!
Imagine Home  |   Teachers' Corner | HERA Overview  |  
Calculate

Sometimes it may be useful to perform algebraic calculations on the data in a column, much like you would do with a spreadsheet. You might need to add or subtract a background value from the photon count data, for example, or multiply every data point by a constant. The Calculate tool allows you to do that. To demonstrate how this tool works, we will take a look at the TIME variable in the original data set. You may have noticed, when you looked at the ASCII dump of the FITs file, that the TIME variable is a rather large, seemingly arbitrary number. This variable is actually the number of days since the start of the mission, though these observations were made a while after the mission was launched. When plotting and analyzing the data by eye, it can be useful to have a more reasonable value for this variable. It might make sense, for example, for the starting day of observations to be "1" (the first day of observations, rather than the first day of the mission) and for the days to increase from there to the final day of the observations.

You will first need to know the current value of the start of the observations. If you go back to the File List output, you can get this value from the first row of data. If you need to, run File List again to get this value.

Now click on the data set gx301-2.lc to select it and click on the Calculate tool in the File Utilities. In the parameter box you will need to fill in the name of the FITs file that will be created as output (name it something similar to, but not the same as, the original file) and the Resultant Column Name. Since we are going to modify the TIME variable, you can name the new variable NEWTIME or something similar. The new file name and the new variable name have to be one word with no spaces.

You next need to type in the arithmetic expression used to generate the new variable. The form of the arithmetic expression to be filled in uses the standard symbols for +, -, * and /, as well as numbers and variable names. In order to offset the TIME variable, you would type in "TIME - XX" where XX is the offset time in the "Arithmetic Expression" section of the parameter box. Click on the RUN button to execute the tool.

Exercise E1

Generate a new FITs file where the starting time is equal to day 1 (i.e. offset by the starting day in the original FITs file). If you click on the "Refresh" button on the Hera GUI, you will see the new file in the lower right. Select it and use the File List tool to print out the first row of data from the new FITs file.

Your new FITs file should be exactly the same as the original data file, except that it will have a new variable (NewTime, or whatever name you chose) corresponding to Time. This new value for Time will begin with 1 and increase the same way the original Time variable did. You can use this new data file (available in the lower right area of the Hera GUI) in the rest of the exercises.

If words seem to be missing from the articles, please read this.

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
Project Leader: Dr. Barbara Mattson
Curator: Meredith Gibb
Responsible NASA Official: Phil Newman
All material on this site has been created and updated between 1997-2014.
This page last updated: Thursday, 28-Jul-2005 14:19:13 EDT