Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2010

AHELP for CIAO 4.3 Sherpa v1


Context: sherpa


Introduction to Sherpa, the CIAO modeling and fitting package


The CIAO 4 release includes a new, more powerful version of Sherpa, the CIAO modeling and fitting package. Sherpa enables the user to construct complex models from simple definitions and fit those models to data, using a variety of statistics and optimization methods.

This document provides an introduction to Sherpa; more information is available on the Sherpa website.

Sherpa is designed for use in a variety of modes: as a user-interactive application and in batch mode. Sherpa is an importable module for the Python scripting language and is available as a C/C++ library for software developers. In addition, users may write their own Python scripts for use in Sherpa.

The Sherpa session can be saved into a platform-independent state file. The session can then be restored at any time.

Starting Sherpa

From the CIAO command line, type:

unix% sherpa [-x|-n|-b|-rcfile|-norcfile] <file>

Any or all of the following options which may be supplied when Sherpa is started:

  • -x : launch Sherpa shell in separate display terminal.
  • -n : prevents the Sherpa banner from being displayed on startup.
  • -b : runs Sherpa in batch mode
  • -rcfile : specify a specific .sherpa.rc file to use; refer to "ahelp sherparc" for details.
  • -norcfile : do not load any .sherpa.rc file; overrides "-rcfile" if both are set.
  • <file>: a file of Sherpa commands to run

The startup script loads the Sherpa module, as well as the CRATES module, which handles file input and output ( "ahelp crates"), and the ChIPS module, used for customizing the plots ("ahelp chips").

The "Starting Sherpa" thread has more details.

The Sherpa Resource File: .sherpa.rc

When Sherpa is started, it processes the $HOME/.sherpa.rc resource file. The resource file defines default behavior for the Sherpa commands and can be customized to the user's preferences; refer to "ahelp sherparc" for details.

Loading Modules

To import the Sherpa, CRATES, and ChIPS modules in Python without using the "sherpa" startup script:

from sherpa.astro.ui import *
from pychips.hlui import *
from pycrates import *

You may also find it useful to load the numpy module

import numpy as np

Getting Help

There are several ways to access the Sherpa help files.

From the CIAO command line

Syntax, description and examples for a specific command:

unix% ahelp <command>

Within Sherpa

Within the Sherpa application, ahelp or the native Python help system can be used:

sherpa> ahelp("<command>")
sherpa> ,ahelp <command>
sherpa> !ahelp <command>
sherpa> help <command>

It is also possible to do a wildcard search:

sherpa> plot* ?
sherpa> *psf ?

Changes in CIAO 4.3

Removal of S-Lang Support

The CXC no longer supports the S-Lang scripting language as of CIAO 4.3. As a consequence, the Sherpa S-Lang interface has been removed and there is no means of importing Sherpa as a S-Lang module.

Users may contact the CXC HelpDesk for assistance in transitioning to Python.


See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

Last modified: December 2010
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: Smithsonian Institution, Copyright © 1998-2019. All rights reserved.