About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: 29 October 2007

URL: http://cxc.harvard.edu/sherpabeta/lang.html
Hardcopy (PDF): A4 | Letter

Should I Use Sherpa in Python or S-Lang?


Sherpa can be run in two different languages: S-Lang and Python. There is no difference in the results obtained from either version, just a few syntax differences in the commands used. Compare these two commands:

# Python
fit(1,2)

% S-Lang
fit(1,2);

All Sherpa S-Lang commands end in a semicolon (;) and Python commands do not. Python uses square brackets ([]) and S-Lang uses curly ones ({}). Python comments are denoted by the pound sign (#), while S-Lang comments use percent (%). The syntax is otherwise identical. (There are other differences between the S-Lang and Python languages; this list is limited to Sherpa syntax.)

Some users will have a clear reason to choose Python over S-Lang, or vice-versa:

  • If you have experience scripting with one of the languages or use other programs written in it, use that version.

  • If the science community at your institution favors Python or S-Lang, choose the one for which local support is available.

Otherwise, you can try both versions and determine which you prefer using.

Hardcopy (PDF): A4 | Letter
Last modified: 29 October 2007


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.