To add entries to the stack, use the addstack command or the appendstack command. The addstack command adds a sequence of entries using parameters that describe the first entry, last entry, and increment. The appendstack command appends an array of indices to the stack. For example:
emptystack ; clears the contents of the stack addstack, 15 ; Add only index 15 addstack, 18, 21 ; Add indices 18 through 21 addstack, 22, 26, 2 ; Add indices 22 through 26 with an increment of 2. (22, 24, 26) appendstack, [29, 35] ; Adds indices 29 and 35 to the stack
The tellstack command lists the indices currently contained in the stack. The GBTIDL global variable !g.acount contains the total number of entries in the stack. The power of the stack will become more evident in the discussion on averaging data. For now, here is a simple example of using the stack to show spectrum headers for scans 6, 8, 10 and 12:
emptystack addstack, 6, 12, 2 for i=0,!g.acount-1 do getnod, astack(i) & header & end
The following procedure gives an example of one way the stack could be put to use. The procedure averages Nod data identified by scan numbers listed in the stack. To use a procedure like this one, first populate the stack with the appropriate scan numbers then call the procedure.
pro myavg,_extra=extra freeze for i=0,!g.acount-1 do begin getnod,astack(i),plnum=0,units='Jy',_extra=extra accum getnod,astack(i),plnum=1,units='Jy',_extra=extra accum endfor ave unfreeze show end
The following stack commands are available.
Command | Purpose |
addstack | Adds a sequential list of indices to the stack, using addstack,begin,end,increment syntax |
appendstack | Adds a single index or array of indices to the stack |
astack() | Returns the value of a specific stack entry, given an index, |
avgstack | Averages the records associated with the stack entries |
delete | Removes a stack entry from the list |
deselect | Removes indices from stack based on criteria such as source, polarization, and integration number. |
emptystack | Clears the stack |
liststack | Runs a list on records identified by the stack. |
select | Adds indices to stack based on criteria such as source, polarization, and integration number. |
tellstack | Shows the indices in the stack |
or returns all of the stack entries if no index is specified |