Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: 10 December 2012

URL: http://cxc.harvard.edu/sherpa/updates.html

Latest Updates


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

To compare the features and functionality of Sherpa in CIAO 4.5 to Sherpa in CIAO 3.4, refer to the pages About Sherpa and Sherpa 3.4 to 4.5 Conversion.

[New]Sherpa for CIAO 4.5 was released in December 2012, including important bug fixes to the interface for grouping and filtering data, as well as a new sample_flux() function for calculating the flux due to a subcomponent of a Sherpa model. See the complete list of CIAO 4.5 additions and enhancement to Sherpa functionality, below.

CIAO 4.5 Updates to Sherpa Functionality


New IPython 0.13 Profile

Sherpa and ChIPS use IPython (included in the CIAO OTS directory) to provide command-line user interfaces, creating an IPython profile in the directory $HOME/.ipython-ciao. In CIAO 4.5, a new Sherpa profile is installed in ~/.ipython-ciao4.5 (profiles for CIAO 4.4 and earlier will remain unchanged in ~/.ipython-ciao).

Note: IPython 0.13 profiles are incompatible with IPython 0.10, and vice-versa, which is why the IPython 0.13 profile is stored in a new directory. Users can switch back and forth between CIAO 4.4 and CIAO 4.5 versions of Sherpa.

The Sherpa IPython 0.13 profile does not import Python code from the current working directory while Sherpa is being imported, to avoid sherpa startup errors, though this capability is restored after Sherpa is finished importing.

Grouping and Filtering Data

Many enhancements have been made to the grouping and filtering interfaces in Sherpa in CIAO 4.5; notable items are listed below.

  • In previous Sherpa releases, a filter applied to a data set using one of the notice or ignore commands had to be reinstated after issuing one of the dynamic grouping commands on the same data set, because the grouping functions erased the existing data set filter. Now, filters are retained after dynamic grouping, and after calling the group/ungroup functions.
  • When a dynamic grouping scheme, or filter, is applied to a data set, it is also automatically applied to all associated background data sets. A different grouping scheme or filter for a background can still be imposed afterward using the bkg_id parameter of the grouping or filtering function. For example, to filter and group background data separately from the associated source data, one could do the following:
    # Filter source data set 1 and its associated background to include the 1-7 keV range and  2-7 keV range, respectively.
    sherpa> notice(1,7)
    sherpa> notice(2,7,bkg_id=1)
    
    # Group source data set 1 and its associated background such that each group of data bins has a minimum signal-to-noise ratio of 3 and 10, respectively.
    sherpa> group_snr(3)
    sherpa> group_snr(10,bkg_id=1)
    
  • Filters can now be defined in channels, when working in channel space, whether the data are grouped or ungrouped.
  • Multiple filters in non-X-ray spectra (i.e. no instrument response) are now correctly treated when fitting using XSPEC models.

Simulating X-ray Spectra

The function fake_pha has been updated to include background counts. If background counts have been supplied with a previously read PHA file, then the background counts are appropriately scaled, a Poisson draw is taken of the scaled background counts, and then that is added to the simulated source counts. (If there are multiple backgrounds, then the average of the backgrounds is added to the simulated source counts.)

The option can be used as shown below:

sherpa> load_pha("data.pha")
sherpa> set_source("xsphabs.a1 * xspowerlaw.p1")
    
# To include background counts read in from a data file. 
sherpa> fake_pha(1,arf=get_arf(),rmf=get_rmf(),exposure=400000,bkg=get_bkg())

# To include ONLY simulated source counts, no background added.
sherpa> fake_pha(1,arf=get_arf(),rmf=get_rmf(),exposure=400000)
New Models

The Sersic2d model, a generalization of the de Vaucouleurs profile, is now available to model surface brightness.

Optical Models

Several issues have been fixed with the following optical models: absorptionedge, absorptiongaussian, absorptionvoigt, emissiongaussian, emissionvoigt, opticalgaussian , emissionlorentz. absorptionlorentz

  • Fixed incorrect NumPy slices used in several models such as OpticalGaussian and AbsorptionGaussian.
  • AbsorptionEdge model corrected in order to be multiplicative.
  • EmissionGaussian updated to use "limit" parameter where it was mistakenly using "skew".
  • AbsorptionVoigt updated to correctly scale FWHM in both Gaussian and Lorentzian input models.
  • EmissionLorentz "kurt" parameter fixed to be set to 2 and frozen by default.
  • EmissionVoigt "lg" is now set to 1 and frozen by default.
  • EmissionGaussian "skew" should be frozen by default.
Calculating Model Component Flux

A new function, sample_flux, has been added to calculate the flux due to a subcomponent of a Sherpa model. The function returns a sample of parameters with a corresponding flux and flux uncertainty for a model component, or a combination of model components. The model components have to be previously defined and used in the fit. The samples are generated from the multi-variate normal distributions with the scales defined by covariance (if at the best fit) or supplied (as "scales"). The flux is calculated for each set of simulated parameters. The returned flux value is given by a sample's median with the lower and upper quantiles defined by the confidence level supplied to the function.


Last modified: 10 December 2012
CXC logo

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-2012. All rights reserved.