This document describes how PypeIt performs object extraction. The standard run will perform both boxcar and optimal extractions of every object discovered with the Object Finding algorithm.


The boxcar extraction is based on the boxcar_radius set in ExtractionPar Keywords.


The optimal extraction is the standard Horne algorithm.


The following are some tips for customizing extractions.

Suppress Masking

If you are extracting a source with bright emission lines which differ spatially from the continuum (e.g. a galaxy), the code may reject a set of the related pixels. These will, by default, not be extracted.

You can, however, turn off the rejection of these pixels based on their different spatial profile by setting the use_2dmodel_mask parameter in ExtractionPar Keywords to False, e.g. add the following to your PypeIt Reduction File:

         use_2dmodel_mask = False

This may lead to a few additional cosmic rays entering your extraction.

And when viewing the 2D spectrum using the pypeit_show_2dspec script, you should use the --ignore_extract_mask option.

For very extended, bright emission lines you may need to use no_local_sky to avoid poor local sky subtraction. See Sky Subtraction for further details.


If you need to extract an object that is too faint to be detected with the Object Finding algorithm, even by adjusting its parameters, then you may do a Manual Extraction.

Custom FWHM for optimal extraction

If you want to perform an optimal extraction using a defined FWHM (i.e., not letting PypeIt to compute it from the flux profile), you can set the parameter use_user_fwhm in ExtractionPar Keywords to True. In this case, PypeIt will assume for the object a Gaussian profile with a FWMH equal to find_fwhm (see FindObjPar Keywords).

It may be occasionally necessary to set no_local_sky = True in SkySubPar Keywords to avoid a bad local sky subtraction.

Additional Reading

Here are additional docs on somewhat common edits that PypeIt users make: