Sherpa modelsΒΆ

The sherpa package is a modeling and fitting application which can be used to fit a variety of data from spatial morphology to forward-folding spectral analysis. It is part of the Chandra analysis software pacakage (CIAO), but it can be easily installed standalone by using the Anaconda Python distribution. Once you have a Python 2.7 Anaconda environment set up, the standalone Python version of sherpa can be installed along with Naima as follows:

$ export PATH=PATH_TO_ANACONDA/bin:$PATH
$ conda config --add channels sherpa --add channels astropy
$ conda install sherpa naima

where PATH_TO_ANACONDA is the path where you have installed Anaconda.

Naima provides wrappers for the Radiative Models to make it easier to use them in a sherpa session. The models available for use in sherpa are the four radiative models available in Naima (see Radiative Models) with a PowerLaw or ExponentialCutoffPowerLaw particle distribution:

Once within a python session or script, these models can be accesed through naima.sherpa_models and added to an analysis session with the sherpa command set_model. You can see the available parameters with show_model:

>>> from sherpa.astro.ui import *
>>> dataspace1d(0.1,10,0.1) # Data would be loaded at this step, here we fake it
>>> from naima.sherpa_models import InverseCompton
>>> set_model(InverseCompton('IC'))
>>> show_model()
Model: 1
IC
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   IC.index     thawed          2.1          -10           10
   IC.ref       frozen           60            0  3.40282e+38        TeV
   IC.ampl      thawed          100            0        1e+60    1e30/eV
   IC.cutoff    frozen            0            0  3.40282e+38        TeV
   IC.beta      frozen            1            0           10
   IC.TFIR      frozen           70            0  3.40282e+38          K
   IC.uFIR      frozen            0            0  3.40282e+38     eV/cm3
   IC.TNIR      frozen         3800            0  3.40282e+38          K
   IC.uNIR      frozen            0            0  3.40282e+38     eV/cm3
   IC.distance  frozen            1            0        1e+06        kpc
   IC.verbose   frozen            0            0  3.40282e+38

Initially, only the amplitude and index of the particle distribution are free parameters, see the sherpa documentation for information of how to modify the frozen parameters and thaw them. Note that sherpa models do not accept parameters as Quantity objects given that their units are fixed. You can see the units for each of the parameters with the show_model sherpa command.