next up previous
Next: Saving Reduced Data for later
Up: A More Complete Introduction to SPECX
Previous: Gaussian models

The Stack

 We have alluded a couple of times to the presence of internal arrays in which data is stored once in a while. Now is the time to formalize that knowledge. SPECX uses a `stack' to keep spectra in order. The stack is modeled after the Hewlett-Packard calculator reverse Polish logic, which some people seem to have trouble with.

Most of the time all you have to remember is that the current spectrum (the one that gets plotted with the n command) is in the x-register. This may (in the case of f-p-b) be a fitted baseline. If you load one spectrum and then another, the first is pushed down into the y-register, and the second goes into the x-register. The command ave averages the two, and places the result into the x-register. This is all carefully described in the SPECX manual. However, in case you need to understand more (that is, you happen to be a Luddite who likes the typical department-store calculator better than an HP), you can see the contents of the stack using the command

$\gt\!\gt$ show-stack

For department-store calculator people it's important to know that the stack is upside-down. Position X is the bottom and T is the top. The spectrum in the bottom register is the current one.

There are four operations you can do to move the stack registers around and one command to clear the stack which is, of course, clear-stack. The four operations are; xy-interchange, roll-stack, push-stack-up, and pop-stack-down. xy, roll, push and pop will suffice.

Table [*] shows the results of these four commands.


 
Table: Understanding stack operations
Stack posn Scan no   Stack posn Scan no
X 001   X 002
Y 002 $\Longrightarrow$ Y 001
Z 003 XY-INTERCHANGE Z 003
T 004   T 004
         
X 001   X 002
Y 002 $\Longrightarrow$ Y 003
Z 003 ROLL-STACK Z 004
T 004   T 001
         
X 001   X 001
Y 002 $\Longrightarrow$ Y 001
Z 003 PUSH-STACK-UP Z 002
T 004   T 003
         
X 001   X 002
Y 002 $\Longrightarrow$ Y 003
Z 003 POP-STACK-DOWN Z 004
T 004   T  
 



next up previous
Next: Saving Reduced Data for later
Up: A More Complete Introduction to SPECX
Previous: Gaussian models

Specx Cookbook Reduction of millimetre wave data
Starlink Cookbook 8
Henry Matthews, Tim Jenness
1st March 1997
E-mail:ussc@star.rl.ac.uk

Copyright © 2005 Council for the Central Laboratory of the Research Councils