Quick Scripts
This page provides quick access to the Sherpa 4.17 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.
Fitting Data
- Introduction to Fitting PHA Spectra
-
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.
- Introduction to Fitting ASCII Data with Errors: Single-Component Source Models
-
Empirically fit 1-D 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.
- Changing the grouping scheme of a data set within Sherpa
-
Change the grouping of a data set after it has been read into Sherpa with the group commands.
- Simultaneously Fitting Two Data Sets
-
Simultaneously model multiple independent data sets.
- Fitting a PHA Data Set with Multiple Responses
-
Fit a source and/or background spectrum with a single model expression including components convolved by different responses.
- Fitting PHA Data with Multi-Component Source Models
-
Fit a spectral data set with a multi-component source model.
- Simultaneously Fitting Source and Background Spectra
-
Simultaneously fit source and background spectra with proper and distinct RMFs and ARFs.
- Using A Pileup Model
-
Include a pileup model in the source model expression used to fit a data set.
- Fitting FITS Image Data
-
Perform a basic fit to a FITS image data set.
- Radial and elliptical profiles of Image Data
-
Plot radial and elliptical profiles of an imaging fit.
- Using an Exposure Map in Fitting Image Data
-
Use a file-based exposure map model to fit image data.
- Accounting for PSF Effects in 2D Image Fitting
-
Fit image data using a PSF image as the convolution kernel.
- Fitting Image Data with Convolved and Unconvolved Model Components
-
Fit image data with a manually defined model expression which includes both convolved and unconvolved components.
- Fitting Grating Data
-
Perform a basic fit to a ACIS-S/HETG grating data set.
- Fitting Multiple Orders of HRC-S/LETG Data
-
Fit the overlapping spectral orders of a HRC-S/LETG data set.
- Measuring Line Parameters with an HETG/ACIS-S Spectrum
-
Perform a simple fit to a line feature in an ACIS-S/HETG spectrum. Calculate the error bars on the line normalizations, positions, and widths, and calculate the line equivalent widths.
- Measuring Line Parameters with an LETG/ACIS-S Spectrum
-
Perform a simple fit to several line features in an ACIS-S/LETG spectrum. Calculate the error bars on the line normalizations, positions, and widths, and calculate the line equivalent widths.
- Creating an Input Spectrum for MARX and ChaRT Simulations
-
Create the unconvolved source spectrum required as input to ChART or MARX for simulating the Chandra PSF.
- Bayesian Analysis in Sherpa
-
Conduct Bayesian Low-Counts X-ray Spectral (BLoCXS) analysis in the Sherpa environment with the pyBLoCXS routine.
Plotting Data
- Plotting in Sherpa Using Common Options
-
Plot spectral data in Sherpa using common options.
Computing Statistics
- Step-by-Step Guide to Estimating Errors and Confidence Levels
-
Estimate confidence intervals for fit parameters.
- Calculating Uncertainties by Simulating Flux Distributions
-
Determine flux uncertainties by sampling fit parameter values using an uncorrelated, normal distribution.
- Calculating Model Flux and Flux Uncertainty
-
Calculate the flux and associated flux uncertainty due to a Sherpa model, and any of the model subcomponents.
Simulating Data
- Simulating X-ray Spectral Data (PHA): the fake_pha command
-
Perform a basic 1-D data simulation using the fake_pha command.
- Simulating Chandra ACIS-S Spectra with Sherpa
-
Simulate a spectrum of a point source obtained with the ACIS-S detector aboard Chandra, with and without consideration of a background component.
- Simulating Chandra ACIS-S LETG Spectra with Sherpa
-
Simulate a spectrum of a point source as observed with a different Chandra instrument configuration than that used to produce an existing data set.
- Creating an Input Spectrum for MARX and ChaRT Simulations
-
Create the unconvolved source spectrum required as input to ChART or MARX for simulating the Chandra PSF.
Miscellaneous
- Calculating K-corrections using Sherpa
-
Learn how to calculate the K-correction for a given spectral model, redshift, and energy range using the Sherpa calc_kcorr command.