Quick Scripts
This page provides quick access to the Sherpa 4.16 Python scripts used in the Sherpa threads. Each script below is also included in the "Scripting It" section at the bottom of the corresponding thread.

Perform a basic fit to a PHA data set. Load the data and instrument responses, filter the data, subtract the background, define a source model expression, fit the model to the data, and examine the quality of the fit.

Empirically fit 1D data from an ASCII file with polynomials of several orders. Define a parameter expression to link the polynomial offset with one of the constants. Plot the data and fits, and customize the plots with ChIPS commands.

Change the grouping of a data set after it has been read into Sherpa with the group commands.

Simultaneously model multiple independent data sets.

Fit a source and/or background spectrum with a single model expression including components convolved by different responses.

Fit a spectral data set with a multicomponent source model.

Simultaneously fit source and background spectra with proper and distinct RMFs and ARFs.

Include a pileup model in the source model expression used to fit a data set.

Perform a basic fit to a FITS image data set.

Plot radial and elliptical profiles of an imaging fit.

Use a filebased exposure map model to fit image data.

Fit image data using a PSF image as the convolution kernel.

Fit image data with a manually defined model expression which includes both convolved and unconvolved components.

Perform a basic fit to a ACISS/HETG grating data set.

Fit the overlapping spectral orders of a HRCS/LETG data set.

Perform a simple fit to a line feature in an ACISS/HETG spectrum. Calculate the error bars on the line normalizations, positions, and widths, and calculate the line equivalent widths.

Perform a simple fit to several line features in an ACISS/LETG spectrum. Calculate the error bars on the line normalizations, positions, and widths, and calculate the line equivalent widths.

Create the unconvolved source spectrum required as input to ChART or MARX for simulating the Chandra PSF.

Conduct Bayesian LowCounts Xray Spectral (BLoCXS) analysis in the Sherpa environment with the pyBLoCXS routine.

Plot spectral data in Sherpa using common options.

Estimate confidence intervals for fit parameters.

Determine flux uncertainties by sampling fit parameter values using an uncorrelated, normal distribution.

Calculate the flux and associated flux uncertainty due to a Sherpa model, and any of the model subcomponents.

Perform a basic 1D data simulation using the fake_pha command.

Simulate a spectrum of a point source obtained with the ACISS detector aboard Chandra, with and without consideration of a background component.

Simulate a spectrum of a point source as observed with a different Chandra instrument configuration than that used to produce an existing data set.

Create the unconvolved source spectrum required as input to ChART or MARX for simulating the Chandra PSF.

Learn how to calculate the Kcorrection for a given spectral model, redshift, and energy range using the Sherpa calc_kcorr command.