J.D. Smith & Bruce Draine

PAHFIT is an IDL tool for decomposing Spitzer IRS spectra of PAH emission sources, with a special emphasis on the careful recovery of ambiguous silicate absorption, and weak, blended dust emission features. PAHFIT is primarily designed for use with full 5-35 micron Spitzer low-resolution IRS spectra.

PAHFIT uses a simple, physically-motivated model, consisting of starlight, thermal dust continuum in a small number of fixed temperature bins, resolved dust features and feature blends, prominent emission lines (which themselves can be blended with dust features), as well as simple fully-mixed or screen dust extinction, dominated by the silicate absorption bands at 9.7 and 18 microns. Most model components are held fixed or are tightly constrained.

The model was trained on a large set of high quality IRS spectra extracted over the central few square kpc of nearby galaxies drawn from the SINGS Spitzer Legacy Project. Since positions of the PAH bands do not shift significantly, it should also be perfectly capable of decomposing any spectrum with PAH emission, as long as the continuum model (fixed temperature starlight and thermal dust up to 300K) is compatible.

Note in particular that PAHFIT uses Drude profiles to recover the full strength of dust emission features and blends, including the significant power in the wings of the broad emission profiles. This means the resulting feature strengths are larger (by factors of 2-4) than are recovered by methods which estimate the underlying continuum using line segments or spline curves fit through fiducial wavelength anchors. See the paper below for a more thorough comparison of these methods.

NOTA BENE: PAHFIT v1.2 overestimates line fluxes by a constant factor of 1+z, which can be significant for high-redshift sources. A new version of PAHFIT due soon will address this issue. Line ratios are not affected, only absolute fluxes. To avoid this, you can shift your wavelenth and spectrum into the rest frame yourself before fitting.

NOTA BENE #2: There is a slight bug in the calculation of dust feature equivalent widths, causing them to be low by a factor of 1.4 (assuming them Gaussian rather than Drude). Both will be fixed in an upcoming release.


PAHFIT is described in detail in:
Smith, J.D.T., Draine B.T., et al., 2007, ApJ, 656, 770 [PDF]

See also the set of 5 noise-free galaxy templates mentioned in the paper.


PAHFIT is available under the terms of the GNU General Public License. Published use of results from PAHFIT should include the above reference.


PAHFIT is currently at version 1.2, and requires:
  1. IDL version 6.0 or later.
  2. Craig Markwardt's MPFIT library, with modification date of 2003 or later.
  3. The AstroLib library from NASA Goddard (which has many useful astronomy-related routines).

Download PAHFIT


Simply unpack the PAHFIT package in a directory on your IDL_PATH.


PAHFIT is straightforward to use. First, assemble a full matched IRS low resolution spectrum (including uncertainty), by averaging the spectrum in the regions of wavelength overlap. A recommended technique is to compare two orders in the region of overlap using a median or short linear segment, then scale SL2 to SL1, LL2 to LL1, and SL to LL. Alternatively, the segments can be scaled to their mean in the overlap region. Note that segment offsets larger than 10% can impact the shape and feature strength of the recovered PAH bands, and that PAHFIT does not account for this source of uncertainty.

Invoke PAHFIT like:

IDL> fit=pahfit(obs_lam, flux, flux_unc, REDSHIFT=cz, /PLOT_PROGRESS, XSIZE=1000, YSIZE=600, /SCREEN, /REPORT)

where obs_lam is a vector containing the observed-frame wavelength, flux and flux_unc are vectors containing the flux (or flux intensity) and uncertainty in f_nu units (MJy/sr, by default), cz is the redshift in km/s (defaults to zero). The boolean keyword flag /PLOT_PROGRESS will show an interactive view of the fit as it improves, while /REPORT generates a text report of the recovered fit parameters. All fits are performed in the rest frame. Note that many of PAHFIT's associated tools take wavelength in the rest frame, rather than observed frame wavelengths and redshift.

The returned fit structure contains a large number of decomposed parameters fit to the spectrum, including central wavelengths, FWHM, integrated feature strengths, and equivalent widths for all the various lines and dust features, as well as strengths of continuum components and mixed or screen extinction optical depth. See the header of the file for more information on this structure, and other calling options.

Note that all fit results are in the rest frame, except equivalent width, which is computed directly on the rest-frame spectrum, but is not diluted by 1+z.


After an apparently successful fit run, I get an error like:
% Variable is undefined: DF.
% Execution halted at: PAHFIT           1237
You have an out of date version of MPFIT. You need a version with last modification date of 2003 or later. Get it here. Note that SMART comes with two embedded versions of MPFIT which are out of date. Ensure that you have a more recent version on the IDL_PATH before the SMART directories (or just move SMART away temporarily).


PAHFIT was developed to recover faint and blended PAH, line, and silicate features by training on a set of nearby predominantly star-forming galaxy spectra. It does not consider contributions from very hot (~1000K) dust in strong AGN, and may not recover appropriate continuum levels in these types of sources. It also does not treat or recover silicate emission (from AGN tori or the integrated dust signature of AGB star winds), nor does it consider hydro-carbon, water and CO ice absorption sometimes seen in very deeply embedded sitelines, in the Galaxy and some classes of extragalactic objects (e.g. high-extinction ULIRGs).

The default set of lines and features chosen, the form and flexibility of the continuum components, and the shape of the extinction curve are all appropriate for galaxies and Galactic regions dominated by star-formation. That said, it is entirely possible to append to the line list, fit additional continuum components, or substitute alternative extinction curves; see advanced usage, below.

If using PAHFIT on spectra with more limited rest-frame coverage (e.g. only LL1), be aware that a profound degeneracy exists between silicate absorption and PAH emission in the rest-frame 7-12um range. In this case, try your fits with and without the /NO_EXTINCTION keyword (see below) to bracket this uncertainty.

Advanced PAHFIT Usage

PAHFIT is a flexible tool for fitting spectra, and you can add or disable features, compute combined flux bands, change fitting limits, etc., without changing the code. Here we present a few examples of these methods.

Combining dust features

Many dust features are blended, sometimes separably (17um complex), sometimes profoundly (e.g. the 7um complex). To combine the fitted strengths, use PAHFIT_MAIN_FEATURE_POWER:
IDL> main_features=pahfit_main_feature_power(fit,lam_rest,flux,flux_uncertainty)
where fit is the fit structure returned by a call to PAHFIT, lam_rest, flux, flux_uncertainty are the rest wavelength and flux with uncertainty used to produce the fit. The returned main_featuresstructure will contain combined feature powers for the most prominent dust features, taking into account the correlation between blended features to compute accurate error estimate. You can also compute the main feature powers for many fits at once by passing multiple fit structures as a vector, and arrays for wavelength, flux, etc. of matching length. See PAHFIT_MAIN_FEATURE_POWER.

Modifying the Fit Parameters

You can modify PAHFIT parameters in several ways. The simplest is to use the keywords provided for making several common modifications. E.g. STARLIGHT_TEMPERATURE, CONTINUUM_TEMPERATURES, LINES, DUST_FEATURES, NO_EXTINCTION. The latter is a boolean determining whether to fix the silicate extinction optical depth to zero. The former two are structures defining the line and dust features to be fit (see PAHFIT), and the first two are simple thermal dust and effective stellar temperatures for fitting the continuum. See PAHFIT (header documentation of

A more powerful method to modify the fit relates to the PARINFO structure, documented on the MPFIT pages (see CONSTRAINING PARAMETER VALUES WITH THE PARINFO KEYWORD). PAHFIT can be seeded with an arbitrary PARINFO structure, and can return the default structure without any fitting, for modification. An example of fixing the fitting details except for several dust features:

IDL> void=pahfit(lam,PARINFO=parinfo,/NO_FIT) ; get parinfo default
IDL> w=where(stregex(parinfo.parname,'dust_feature_(lam|cen|frac).*\[1[67]\.',/BOOLEAN)
IDL> parinfo.fixed=1b & parinfo[w].fixed=0b
IDL> fit17=pahfit(lam,flux,error,REDSHIFT=cz,/PLOT_PROGRESS,PARINFO=parinfo,ITERARGS={XRANGE:[15,20]})
This takes the standard parameter info structure, fixes all features except the 17um complex, and performs the fit with those constraints. Using the same method, you could zero out paramters, change, remove, or add fitting limits, etc. You might prefer to start with an existing fit and make modifications. The list of PAHFIT's default parameter info names, which can be used to select parameters for modification in this way, can be found with:
IDL> void=pahfit(lam,PARINFO=parinfo,/NO_FIT) & print,parinfo.parname

Plotting PAHFIT fit results

The PAHFIT_PLOT procedure allows you to plot saved fits, for example to save to postscript with object and chi_square labels.
set_plot,'PS' & device,/ENCAPSULATED,/COLOR,FILENAME='fit.eps'
pahfit_plot,pahfit,lambda_rest,flux,flux_uncertainty, TITLE='My Object Fit', $
xyouts,.85,.85,/NORMAL,ALIGNMENT=1.0,string(FORMAT='(%"red. chi-sq: %8.3f")',pahfit.reduced_chi_sq)
device,/close & set_plot,'X'

Quick-start guide for non-IDL users

Users who aren't familiar with IDL should be able to use PAHFIT without undue difficulty. The main concern is to allow IDL to find and compile the PAHFIT code. To accomplish this, you need to place it on your IDL_PATH. You can set this environment variable to point to locations of interest, e.g.:
setenv IDL_PATH setenv IDL_PATH ":+${HOME}/idl"
which adds to the IDL default paths ~/idl. Anything under this directory containing .pro files will be auto-discovered.

A complete session for reading a spectrum from a text file, running PAHFIT, and saving the results is below. This requires the installation of the excellent IDL astronomy user's library, a good resource for many astronomy related IDL capabilities.

IDL> cd,'/path/to/spectra'
IDL> rdfloat,'spectrum.txt',lambda,flux,error,SKIPLINE=2
IDL> fit=pahfit(lambda,flux,error,REDSHIFT=250.,/PLOT_PROGRESS,REPORT='pahfit.txt')


Feedback on the performance of PAHFIT with your spectra is very much appreciated (email below).

JD Email Last modified: Tue Mar 8 17:52:04 EST 2011