Table of Contents
Sherpa is a modeling and fitting application for Python. It contains a powerful language for combining simple models into complex expressions that can be fit to the data using a variety of statistics and optimization methods. It is easily extensible to include user models, statistics, and optimization methods. It provides a high-level User Interface for interactive data-analysis work, such as within a Jupyter notebook, and it can also be used as a library component, providing fitting and modeling capabilities to an application.
What can you do with Sherpa?
- fit 1D (multiple) data including: spectra, surface brightness profiles, light curves, general ASCII arrays
- fit 2D images/surfaces in Poisson/Gaussian regime
- build complex model expressions
- import and use your own models
- use appropriate statistics for modeling Poisson or Gaussian data
- import new statistics, with priors if required by analysis
- visualize the parameter space with simulations or using 1D/2D cuts of the parameter space
- calculate confidence levels on the best fit model parameters
- choose a robust optimization method for the fit: Levenberg-Marquardt, Nelder-Mead Simplex or Monte Carlo/Differential Evolution.
Documentation for Sherpa is available at Read The Docs and also for Sherpa in CIAO.
A Quick Start Tutorial
is included in the notebooks
folder and can be opened with an ipython notebook
.
If you use Sherpa for work/research presented in a publication please cite the Sherpa papers:
Sherpa Paper 2024 (ADS BibTex)
Sherpa Paper 2007 (ADS BibTex )
Sherpa Paper 2001 (ADS BibTex)
If you are using AASTeX and plan to submit an article to one of the AAS journals, we recommend adding a \software{...} tag to your manuscript that cites Sherpa (see the AASTeX guide for more information), e.g.:
\software{Sherpa \citep{2001SPIE.4477...76F,2007ASPC..376..543D,2024arXiv240910400S}}
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version. A copy of the GNU General Public License can be found in the
LICENSE
file provided with the source code, or from the
Free Software Foundation.
Full installation instructions are part of the Read The Docs documentation, and should be read if the following is not sufficient.
It is strongly recommended that some form of virtual environment is used with Sherpa.
Sherpa is tested against Python versions 3.10 and 3.11 with experimental support for Python 3.12.
The last version of Sherpa which supported Python 2.7 is Sherpa 4.11.1.
Sherpa is provided for both Linux and macOS operating systems running
Python 3.10, 3.11, and (experimental) 3.12. It can be installed with the conda
package manager by saying
$ conda install -c https://cxc.cfa.harvard.edu/conda/sherpa -c conda-forge sherpa
Sherpa is also available on PyPI and so can be installed with the following command (which requires that the NumPy package is already installed).
% pip install sherpa
Source installation is available for platforms incompatible with the
binary builds, or for when the default build options are not sufficient
(such as including support for the
XSPEC
model library).
The steps are described in the
building from source
documentation.
Sherpa is developed by the Chandra X-ray Observatory to provide fitting and modelling capabilities to the CIAO analysis package. It has been released onto GitHub for users to extend (whether to other areas of Astronomy or in other domains).