This document highlights important changes and additions to Sherpa functionality in the CIAO 4.5 Sherpa release.
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 below for the complete list of CIAO 4.5 additions and enhancement 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 to filter the default source data set over the 1 to 7 keV range and its associated background component, with bkg_id=1, over the range 2 to 7 keV:
sherpa> notice(1, 7) sherpa> notice(2, 7, bkg_id=1)
or to group the source and background so that it 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> arf1 = get_arf() sherpa> rmf1 = get_rmf() sherpa> bkg1 = get_bkg() sherpa> fake_pha(1, exposure=400000, arf=arf1, rmf=rmf1, bkg=bkg1) # To include ONLY simulated source counts, no background added. sherpa> fake_pha(1, exposure=400000, arf=get_arf(), rmf=get_rmf())
- New Models
- Optical Models
Several issues have been fixed with the following optical models:
- 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 the "limit" parameter where it was mistakenly using "skew" and the skew parameter is now frozen by default.
- 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.
- 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.