The integration of the S-Lang programming language (http://www.s-lang.org) within CIAO has been a feature of the software since version 2.2. However it is only with the current 3.0 software version that the full S-Lang functionality has become easily accessible both within Sherpa and Chips (the CIAO modeling/fitting and plotting applications) and at the unix command line though the use of the "slsh" program, an S-Lang interpreter now distributed with CIAO.
One of the best examples of a CIAO application which has benefited greatly by the introduction of S-Lang is Sherpa. Sherpa was originally a classic 'black box': data were input from a file, and analyzed, with results possibly written out to disk; however, the data themselves could not be manipulated once they were read in. By embedding S-Lang into Sherpa we are moving from this old 'black box' paradigm to a new one in which numeric data can be freely moved into and out of the box, and freely manipulated outside that box (e.g., with S-Lang functions). This movement of data requires the functionality provided by the CIAO 3.0 Sherpa/ S-Lang library of functions (a so-called "module").
As one example of the many functions included in this new library, let's look at the "get" functions. More than 100 functions from "get_analysis" to "get_weights" (see "ahelp get" for a complete listing) allow the user to retrieve settings or data as convenient variables. Retrieving numerical data from Sherpa (e.g., model parameters, residual values, fluxes, etc.) allows users to manipulate them using S-Lang operators and/or functions and possibly to re-use them within Sherpa itself.
The inclusion of a programming language empowers both advanced and regular users. Advanced users now have the ability to automate their own complex tasks and also to import personal C or Fortran code in scripts. Regular users will benefit from a more rapid response from members of the CIAO team when specific scripts are needed on timescale shorter than the official CIAO releases. This latter approach has already been used (a number of "scripts" are already offered in addition to the standard CIAO tools, see http://cxc.harvard.edu/ciao/download/scripts/), but the CIAO team now plans to provide more new analysis features in form of scripts, some of which can become regular tools once the demand is assessed.
The choice of S-Lang as the CIAO scripting language did not come without in-depth analysis and discussion within both the CIAO development team and the larger community (see for example the "S-Lang as the CIAO Scripting Language" topic at http://cxc.harvard.edu/ciao/why/slang.html and the "Choosing a Scripting Language for CIAO" presentation at http://cxc.harvard.edu/ciao/presentations.html#slang). Scripting/programming languages are in a state of flux within the astronomical community and, apart from a large base of IDL users (IDL is, however, commercial software), there is still not a clear front runner at this time. Python, Tcl/Tk, Perl and ROOT have been some of the choices pursued by other projects. S-Lang, while new to astronomy, is popular among unix installations and, with its limited size, IDL/Matlab-like style, C-like syntax and powerful array-based numerical computing environment, is a fine choice for CIAO. Try it out!
We present the following as an example of the usefulness of SLang in data analysis. Figure 13 (courtesy of Dave Huenemorder) shows some of the capabilities of dynamic operations possible with histograms in S-Lang and with ACIS grating light-curve routines now in prototype stage. The data are from ObsID 1928, Vela X-1 at orbital phase 0.25, taken with the HETG and ACISS. The bottom panel shows a light curve for +1 and -1 orders of HEG and MEG binned from 1.5 to 10.5 Å. The bins were about 70 seconds, or one-quarter of the pulsar period, whose pulses show as the high-frequency peaks. (The y-axis is actually count-rate, and the exposure is computed appropriately for each chip before merging.)
FIGURE 13: Analysis of a Vela X-1 HETG observation. See text for discussion. |
The same selection based on hardness can be referenced to the light curve bins. The bins on the bottom panel have beencolored according to the selection in the top panel. It can be seen that the spectrum is hardest during the lowest state from about 25,000-30,000 seconds, but not exclusively, since there are also some higher count data which are also hard.
The program for ACIS grating light curves is in prototype stage, and currently being documented prior to release. Common sequences of operations will be bundled into command-line "tools" . The library of functions will be maintained for interactive applications.
Antonella Fruscione for the CIAO Team
References
M.Noble, Advances in
CIAO Interactive Analysis , 2001, Chandra News, Issue 8
J. Davis, S-Lang Library Information Page , http://www.s-lang.or
Presentations given at the CXC S-Lang classes in 2003:
http://cxc.harvard.edu/ciao/presentations.html#slang
Presentations given at CIAO workshops 2001, 2002, 2003:
http://cxc.harvard.edu/ciao/workshop/#info
Additional documentation
and examples about the use of S-Lang in CIAO, S-Lang functions and
modules available will appear on the CIAO web page in the next few
months.