Skip to main content

Sherpa deprojection package (X-ray analysis of Galaxy Clusters, Groups, and Galaxies)

Project description

Deproject is a Sherpa extension package to facilitate deprojection of two-dimensional annular X-ray spectra to recover the three-dimensional source properties. For typical thermal models this would include the radial temperature and density profiles. This basic method has been used extensively for X-ray cluster analysis and is the basis for the XSPEC model projct. The deproject module brings this functionality to Sherpa as a Python module that is straightforward to use and understand.

The basic physical assumption of deproject is that the extended source emissivity is constant and optically thin within spherical shells whose radii correspond to the annuli used to extract the specta. Given this assumption one constructs a model for each annular spectrum that is a linear volume-weighted combination of shell models.

Version 0.2 of deproject is limited to circular annuli.

Further documentation is available at


The deproject module is released under the BSD 2-Clause license, available as the file LICENSE in the source distribution.


The installation assumes that you are installing deproject into the CIAO environment (CIAO 4.14 or later), since this is the easiest way to get the XSPEC models along with Sherpa. The standalone Sherpa version can be used, but in this case you will need to build Sherpa with XSPEC support.

The following Python packages are required:


For Standalone Sherpa or CIAO versions newer than CIAO 4.14, you should be able to install deproject with the command:

pip3 install deproject

The installation requires pip version 19 or higher, but as that was released in early 2019 it should be available.

The installation documentation describes how to build a development version from the GitHub repository.


If you have a set of X-ray PHA spectra called src<n>.pi, where <n> is an integer representing the annulus number, and the files contain the XFLT0001 to XFLT0005 header keywords used by the XSPEC projct model, then a Deproject object can be created using the deproject_from_xflt helper routine with the commands:

>>> from deproject import deproject_from_xflt
>>> from astropy import units as u
>>> dep = deproject_from_xflt('src*.pi', 0.492 * u.arcsec)

where, in this example, the XFLT0001 and XFLT0002 keywords, which specify the inner and outer radii of the annulus, are in ACIS pixels, and so need to be multiplied by 0.492 arcseconds to convert to an angle (the second parameter).

This will automatically load the spectra into separate Sherpa datasets, which can be fitted individually, but it is generally easier to use the object returned by deproject_from_xflt. For instance, the following will set the data range to be fit for each spectra and ensure that the background is subtracted before fitting:

>>> dep.ignore(None, 0.5)
>>> dep.ignore(7.0, None)
>>> dep.subtract()

Sherpa functions are used to change the statistic and optimiser:

>>> from sherpa.astro import ui
>>> ui.set_stat('chi2xspecvar')
>>> ui.set_method('levmar')

The data can be fit, and errors estimated for all the parameter, using the onion-skin deprojection approach, with the following commands:

>>> onion =
>>> errs = dep.conf()

The return value includes the density (and errors, if appropriate), as an Astropy Quantity.

>>> print(onion['density'])
      1 / cm3
Length = 20 rows

The on-line documentation contains more information, including creating the Deproject object directly (without the need for the XFLTxxxx keywords).

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deproject-0.2.2.tar.gz (33.5 kB view hashes)

Uploaded source

Built Distribution

deproject-0.2.2-py3-none-any.whl (32.7 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page