|
|
|
|
SynopsisThe S-Lang interface to the CXC stack library DescriptionThe stackio module is the interface between the S-Lang interpreter (see "ahelp slang") and the CXC stack library. Briefly, a stack consists of a list of strings stored in a text file (e.g. stk.lis), or a single string. In the former case, the stack is referred to via the @stk.lis convention. This will return an N-element stack, one item for each line in the input file. The latter case of a simple string, however, is also a legal stack, with a single element equal to the input string. See "ahelp stack" for more information. This document provides an overview of the features of the stack module, and tips for using it efficiently in a S-Lang program. Detailed descriptions of each function are provided by individual ahelp pages. The stackio module is not available by default; to use it in a S-Lang program, it must be loaded using the S-Lang require() function: require("stackio");Functions provided by the moduleThe following functions are provided by the module; use "ahelp <function>" to get a detailed description of a function:
Using Stack_Type variablesThe stackio module defines a new variable type, Stack_Type, which has a complex internal structure that cannot be printed using the S-lang print() command. To see the components of a Stack_Type variable, use the stk_disp() call. Stack_Type variables can be defined using the stk_build() function, which converts a CIAO stack string into a Stack_Type variable. Example 1
slsh> require("stackio");
slsh> stk = stk_build("acis_evt2.fits");
slsh> stk_disp(stk);
------
Stack position: 0
Stack size: 1
Stack allocated: 100
Stack entries:
1 :acis_evt2.fits:
------
slsh> () = stk_append(stk,"hrc_leg-1.fits");
slsh> () = stk_append(stk,"hrc_leg1.fits");
slsh> stk_read_num(stk,2);
hrc_leg-1.fits
slsh> stk_delete_num(stk,2);
slsh> stk_count(stk);
2
slsh> stk_close(stk);Example 2
slsh> require("stackio");
slsh> stk = stk_expand_n("acisf00#.fits",4);
slsh> stk_disp(stk);
------
Stack position: 0
Stack size: 4
Stack allocated: 4
Stack entries:
1 :acisf001.fits:
2 :acisf002.fits:
3 :acisf003.fits:
4 :acisf004.fits:
------
slsh> stk_read_next(stk);
acisf001.fits
slsh> () = stk_change_num(stk,"hrc_evt2.fits",2);
slsh> stk_current(stk) ;
1
slsh> () = stk_delete_current(stk);
slsh> stk_append(stk,"@/data/ciao/stack.lis",1);
slsh> stk_disp(stk);
------
Stack position: 1
Stack size: 6
Stack allocated: 6
Stack entries:
1 :hrc_evt2.fits:
2 :acisf003.fits:
3 :acisf004.fits:
4 :/data/ciao/a.dat:
5 :/data/ciao/b.dat:
6 :/data/ciao/c.dat:
------
slsh> stk_close(stk);BugsSee the bugs page for the stackio library on the CIAO website for an up-to-date listing of known bugs. See Also
|
![]() |
The Chandra X-Ray
Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA. Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2004. All rights reserved. |