About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: 15 May 2009

URL: http://cxc.harvard.edu/sherpa4.1/updates.html

Latest Updates


This document highlights important updates to Sherpa functionality, most of which become available with each CIAO release. Such updates include the incorporation of new functions and models into Sherpa, improvements to existing functions, bug fixes, among others. Release-specific information may also be found in the "Sherpa" section of the CIAO Release Notes.

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

CIAO 4.1.2 Updates to Sherpa Functionality

New Models

Sherpa includes XSpec version 12.5 models and all the relevant model patches up to 12.5.0q; the C interface has been used for the XSpec models when available. Sherpa provides access to the following new models:

        xskerrdisk (S-Lang or Python help) : broad iron line from a disk around a Kerr BH
        xsnsmax (S-Lang or Python help)    : NS magnetic atmosphere
	xsnthcomp (S-Lang or Python help)  : thermally Comptonized continuum
        xsspexpcut (S-Lang or Python help) : super-exponential cut-off
        
New Functions

  • The following CEPHES functions are now available from the Sherpa prompt:
          gamma (S-Lang or Python help)gamma(z), gamma function [-171 <= z <= 171]
          lgam (S-Lang or Python help)lgam(z), natural log of the gamma function
          igamc (S-Lang or Python help)igamc(a,x), complement of the incomplete gamma (upper) function [a>0; x>0]
          igam (S-Lang or Python help)igam(a,x), the incomplete gamma (lower) function [a>0; x>0]
          incbet (S-Lang or Python help)incbet(a,b,x), the incomplete Beta function [a>0; b>0; 0<=x<=1]
         
  • A new function 'script' (S-Lang or Python help) is included in the CIAO 4.1.2 patch which saves every command typed in a Sherpa session to a file.
	 sherpa> script(filename="sherpa.log", clobber=False)
         
Improvements to PSF interface

The PSF interface has been updated to include the kernel information and default parameter values after issuing the set_psf() command; see the examples in the set_psf ahelp file (S-Lang or Python help) for details.

Updates to 'projection' and 'covariance'

  • The full covariance matrix is now available after covar() (S-Lang or Python help) is run, via the "extra_output" field from get_covar_results() (S-Lang or Python help). The square root of the diagonal elements represents the set of 1 σ errors that are returned by the covar() function.
         sherpa> cov_mat=get_covar_results().extra_output
	 sherpa> sigma=numpy.sqrt(cov_mat).diagonal
         
  • The projection (S-Lang or Python help) method has been updated so that the status of the completed search for parameter confidence limits is printed to the screen. The feedback given is of the form:
	   sherpa> proj()
	   ...
	   Confidence limits search for g2.fwhm finished (1 of 3)
	   Confidence limits search for g2.pos finished (2 of 3)
	   Confidence limits search for g2.ampl finished (3 of 3)
	   ...
	   sherpa>
	 

In this example, proj() searches for the limits for three parameters, g2.fwhm, g2.pos, and g2.ampl. This update more closely matches the feedback from Sherpa 3.4.

Energy/wavelength analysis compatibility

The functions calc_photon_flux (S-Lang or Python help) and calc_energy_flux (S-Lang or Python help) have been modified to return accurate results in both energy and wavelength space, and with single or multiple responses. Before the fix, if set_analysis("wave") (S-Lang or Python help) had been issued to work in wavelength space, the flux values returned for a wavelength or energy range specified in calc_energy_flux (S-Lang or Python help) were inaccurate.

There is one remaining caveat: regardless of choice of energy or wavelength analysis, Sherpa models still assume that relevant model parameters (e.g., line positions) are always in keV. (Note that filtering in wavelength is still allowed.) Refer to the set_analysis bug page for details on this issue.

Loading ASCII files with DM ASCII

The 'load' functions used with ASCII files (load_ascii (S-Lang or Python help), load_data (S-Lang or Python help), load_table (S-Lang or Python help)) have been updated to accept DM ASCII syntax and therefore recognize the column definitions in file headers.

By default, if there is a header (i.e., the first N lines are comments, indicated by a '#' character), the last line of the header is assumed to be a list of columns, and only the first two columns are loaded into Sherpa. However, if an ASCII file predates Sherpa's use of the ASCII kernel, and there are no column names contained in the last line of the header, then Sherpa will try to load the first two words in the line as columns. If only one word is contained in the last line, then by default only one column will be loaded.

The patch is to catch when only one column has been loaded, and to try again to open all columns. If enough columns are found on this try, Sherpa loads them; if the file has only one column, an exception is raised.

See the "Command Comparison" Sherpa FAQ #3 for example syntax.

Improvements to plotting

  • Source model plots are now plotted as histograms, similar to PHA model plots, and are correctly labeled when working in wavelength space. Also, ARF plots are now histograms and support wavelength space.

  • A bug in plot_bkg_fit() (S-Lang or Python help) has been fixed, to plot the correct background by background ID (bkg_id).

  • plot_fit_delchi() (S-Lang or Python help) and plot_fit_resid() (S-Lang or Python help) now support the ChIPS 'clearwindow' keyword correctly. This allows users to add multiple ChIPS frames to a plotting window, creating a tiled plot with multiple data set IDs.

  • A bug was fixed so that one can now plot model values with plot_source() (S-Lang or Python help) and plot_model() (S-Lang or Python help) in wavelength space, with either XSpec or non-XSpec models. Before the fix, non-XSpec models were incorrectly plotted in wavelength space because, by default, all model parameters were computed on an energy grid, regardless of whether set_analysis("wave") (S-Lang or Python help) had been issued. This was done to ensure that XSpec models (those with prefix "xs") received the intended energy grid for evaluation.
Last modified: 15 May 2009


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