A Python code for the spectral analysis of Gamma-ray and X-ray data in a unified framework, using physically-motivated spectral models. The data handling and fitting relies on the Gammapy architecture, while the multi-wavelength spectral modeling can be performed using an arbitrary combination of the functions included in the Gammapy, Xspec and Naima libraries.
This code is built on Numpy, Scipy, Astropy, Gammapy, Naima, Sherpa and Xspec. A working example is provided in the tutorial.ipynb
notebook.
If you wish to give us your feedback, report bugs or ask for help please open an issue or send us an email.
If you use GammapyXray for work/research presented in a publication (whether directly, or as a dependency to another package), we ask that you please cite:
These instructions assume that you have previously installed a version of Anaconda or Miniconda on your machine. Optionally, if you want to speed up the installation, you can also use Mamba. In that case, simply install it using:
conda install mamba -n base -c conda-forge
and substitute all the occurrences of the conda
command with mamba
in the following steps.
Set-up the work environment:
conda create -n gammapyXray conda activate gammapyXray conda install -c https://cxc.cfa.harvard.edu/conda/ciao -c conda-forge ciao sherpa conda install -c conda-forge gammapy=0.20.1
Install JupyterLab or Jupyter Notebook (recommended).
If you need to use physically-motivated radiative models, install Naima following these instructions (optional, but needed to run the
tutorial.ipynb
).Download the ZIPped contents of this folder directly from the main GitHub page, or equivalently from the Zenodo archive. Then extract under your home or work directory and navigate to the
gammapyXray-0.1
folderCheck that the installation has succeeded and start using the package, executing the tutorial notebook:
jupyter notebook tutorial.ipynb
If you wish to execute the tests associated to this code (using pytest) you need to:
set up the
XMM_DATA
environment variable:export XMM_DATA=<absolute path>/gammapyXray/XMM_test_files/
run pytest from the
gammapyXray
folder:pytest gammapyXray/tests/test_models.py pytest gammapyXray/tests/test_ogip_spectrum_dataset.py
This folder is licensed under a 3-clause BSD style license - see the LICENSE.rst file.