Skip to the navigation links
Last modified: 17 November 2020

URL: https://cxc.cfa.harvard.edu/sherpa/updates.html

Latest Updates


This document highlights important changes and additions to Sherpa functionality in the CIAO 4.13 Sherpa release.

Sherpa version for CIAO 4.13 was released on December 15, 2020. Sherpa in CIAO runs under Python 3.8, 3.7, or 3.6 (when installed using the conda package manager) and Python 3.7 (when installed with ciao-install). The full list of the Sherpa updates is given in the Release Notes. The major updates in this release include:

XSPEC

Update to version 12.10.1s of the XSPEC model library, from version 12.10.1n in CIAO 4.12 (so there is essentially no change).

Users who want to use XSPEC 12.11.1 will need to build Sherpa themselves.

Support for XSPEC convolution models has been added: xscflux, xsclumin, xscpflux, xsgsmooth, xsireflect, xskdblur, xskdblur2, xskerrconv, xskyconv, xslsmooth, xspartcov, xsrdblur, xsreflect, xsrfxconv, xsrgsxsrc, xssimpl, xsvashift, xsvmshift, xsxilconv, xszashift, and xszmshift.

Changes to the Sherpa configuration file

The default Sherpa configuration file has been updated for CIAO 4.13 to add the multiprocessing section, which contains the multiprocessing_start_method, and to remove the chips section, as it is no-longer used.

If you have trouble running Sherpa it is worth removing your existing resource file and then re-starting Sherpa (which will create a new version) to see if this fixes problems: for example

unix% mv ~/.sherpa.rc ~/.sherpa.old.rc
unix% sherpa
...
Multiprocessing, Python 3.8, and macOS

In Python 3.8 on macOS the multiprocessing module has changed how it starts processes. As the new default does not work for Sherpa, the multiprocessing.multiprocessing_start_method setting has been added to the Sherpa configuration file to allow this setting to be changed, but please contact the CXC Helpdesk for help if you find you need to change this setting.

Plotting improvements

CIAO 4.13 continues the improvements made in CIAO 4.12 to the plotting functionality, and includes:

  • changes to the display of PHA and histogram data and models;
  • the transparency of the data or model can be changed by setting the alpha argument to a value between 0 and 1;
  • the plot function can now accept keyword arguments, with the settings applied to each plot;
  • and the overplot option now works for the plot_fit_xxx and plot_bkg_fit_xxx family of commands (e.g. plot_fit_ratio and plot_bkg_fit_resid).
Flux calculations

Extending the CIAO 4.12.1 changes to the calc_energy_flux and calc_photon_flux commands, there have been a number of improvements to the sample_energy_flux and sample_photon_flux commands. The main change is the introduction of the model parameter, so you can now calculate the flux for a component (e.g. the unabsorbed flux). The documentation has been improved and the support for the scales array no correctly handles both NumPy and list inputs.

The How do we calculate a flux in Sherpa Jupyter notebook has been updated to discuss this new functionality.

PHA data handling

There have been a number of improvements and fixes to PHA data handling. In particular fitting a model to the background dataset has been re-worked and can result in different results if the source and background PHA datasets have different exposure times.

The load_pha command will now use the id argument when loading in a PHA2 file: it defines the first dataset which will be loaded whereas previously it always started at 1.

The ungroup and unsubtract commands will no-longer error out if used on ungrouped or unsubtracted data.

Documentation

The Sherpa ahelp files have been updated to match the Python docstrings. Each command now has its own ahelp file, rather than combining multiple commands into a single file.

Jupyter notebooks

Many of the objects created by Sherpa will now take advantage of Jupyter notebooks to display a HTML table or an actual plot. As an example, load a PHA file with load_pha and then call get_data, or call get_source to display a model.

Handling asymmetric errors

The resample_data routine, used to estimate the effect of asymmetric errors, has seen a number of improvements in behavior and the data that is returned.

Numpy masked arrays

Numpy masked arrays can now be used to create a dataset with load_arrays or any of the Data classes.

Model combination

The dimensionality of models is now checked, so it is no longer to add a 1D model to a 2D model.

The voigt1d and pseudovoigt1d models

The absorbtionvoigt and EmissionVoigt models were problematic and have been removed. They have been replaced by the more-generic voigt1d and pseudovoigt1d models.

Documentation

Help can be found either via Python's native help function (that is, Python docstrings), or with the ahelp command (which can be used from both the command line and within the Sherpa interactive environment.

If you spot any errors, or missing information, please submit a pull request to fix it or report the problem.

A recent development for "standalone Sherpa" is the creation of the Sherpa documentation website. This provides on-line access to the Python docstrings, as well as general documentation on how to use Sherpa. It is aimed at users who want to use the more object-orientated interface provided by Sherpa rather than the functions from the sherpa.astro.ui module documented on this site, as well as not being tailored to CIAO users, but it is useful for the more advanced Sherpa users who want to use Sherpa in complex Python pipelines.

Bug Fixes

A full list of the bug fixes can be found on the CIAO 4.13 release notes page, or by viewing the changes made to the 4.13 release branch on GitHub.