S-Lang(ID:2508/sla011)


Stack-based postfix scripting language, first used in the JED editor, later elsewher besides. Later versions no longer stack-based

John E. Davis

Places
Structures:
References:
  • Doe, S.; Freeman, P.; Smith, R.; Burke, D.; Siemiginowska, A. "Extending Sherpa Data Analysis with S-Lang" Astronomical Data Analysis Software and Systems XIII ASP Conference Series, Vol. 314, 2004 view details Abstract: Sherpa is the fitting application of the Chandra Interactive Analysis of Observations (CIAO) package. In this paper, we discuss how we have extended the capabilities of Sherpa in CIAO3.0 with the S-Lang programming language. Users are now able to load Sherpa data sets into S-Lang variables, and vice versa. Users also now have access to many new S-Lang functions which are the equivalents of Sherpa commands. Thus, it is now possible for users to write their own S-Lang scripts that load data into Sherpa, perform fits, and then copy the fit results out to S-Lang variables for further analysis in their scripts. Such scripts can be run from within Sherpa; it is also possible to load a Sherpa runtime module into another S-Lang application, and then run the same scripts in that application. We have also made it possible for users to run S-Lang scripts that modify the appearance of plots generated by Sherpa plotting commands. Finally, settings that affect the execution of many Sherpa commands can be changed via S-Lang variables. These settings can be stored and read back in at the start of a Sherpa session. These extensions to Sherpa follow from our efforts to embed S-Lang in CIAO, first described in Doe et al. (2001).  
    External link: Online copy Extract: Introduction: What Are Sherpa And S-Lang?
    Introduction: What Are Sherpa And S-Lang?
    Sherpa is the modeling and fitting tool of CIAO software package. We have developed it with the primary goal that a user should be able to take full advantage of Chandra's unprecedented observational capabilities and be able to analyze data in up to four dimensions (energy E or wavelength , time t, and spatial location [x,y]) with a wide variety of models, optimization methods, and fit statistics. We have also made it as general as possible, so that users can analyze data from other X{ray missions (e.g., ROSAT, XMM) and from other wavebands.
    S-Lang is an interpreted language created by John Davis of the Center for Space Research at MIT. S-Lang is a popular language, with several hundred users, and several applications that use it as an extension language. Embedding such a language into an application can enhance its  exibility and power by
    allowing users to more easily extend its capabilities. We have added S-Lang to CIAO, where it is currently used most heavily in ChIPS (Chandra Imaging and Plotting Software) and Sherpa. Extract: S-Lang Access To Sherpa Data
    S-Lang Access To Sherpa Data
    Embedding S-Lang in Sherpa was an important first step. This allows users to call their own S-Lang functions from Sherpa. But simply calling new S-Lang functions is of limited use unless such functions can analyze data that have already been read into Sherpa.
    Thus, we have added S-Lang functions that provide interfaces to Sherpa data structures. Among them are functions that copy Sherpa data from C++ to S-Lang variables. S-Lang scripts can now obtain copies of Sherpa data sets, and their associated errors and weights, as well as model values calculated from models fit to the data.
    Data residing in S-Lang variables can also be copied back into Sherpa. S-Lang scripts can now copy data from a Sherpa data set, perform some analysis on the data, and then copy the data back into Sherpa. A Sherpa model can then be fit to this modified data set. We also provide other S-Lang functions to access other Sherpa information (e.g., values and ranges or model parameters). The Sherpa documentation1 has a complete list of the S-Lang functions we provide, including examples using these functions.
    These functions are available from the Sherpa command line; they are also available from a S-Lang module we distribute along with Sherpa itself. S-Lang modules are shared objects which can be dynamically linked to other S-Lang applications. Sherpa S-Lang functions, and thus, a Sherpa fitting session, can be run from any other S-Lang application (e.g., ChIPS, slsh). Extract: User Models in S-Lang
    User Models in S-Lang
    Sherpa provides a number of mathematical and physical models to which data can be fit. But Sherpa cannot possibly provide every model that every user might want. Therefore, we provide an interface to models written in S-Lang. Users can write their own models in S-Lang and then load the model into Sherpa. Once the model is in Sherpa, it can be used just as a native Sherpa model would be - the syntax is identical.
    Resources