Setup
⚠️ WARNING! ⚠️ BXA requires a working form of PyXspec and/or Sherpa.
Make sure either of these are installed before doing the exercises! Also note the exercises were written for BXA v4.0.5 - if some commands are not working as expected, check which version you are running.
For PyXspec users
First, install PyXspec:- Using PyXspec requires a source distribution of HEASoft. See install instructions here:
https://heasarc.gsfc.nasa.gov/docs/software/heasoft/
- Create a new conda environment:
$ conda create -n xspecbxa python=3.8
- Activate the new environment:
$ conda activate xspecbxa
- Install BXA:
- With Anaconda:
$ conda install -c conda-forge bxa
- With
pip
(see warning below):
$ pip install requests corner astropy h5py cython scipy tqdm pandas $ pip install bxa
- With Anaconda:
- Check PyXspec works:
$ python -c 'import xspec'
- Check UltraNest works:
$ python -c 'import ultranest'
- Check BXA works:
$ python -c 'import bxa.xspec as bxa'
For Sherpa users
- First, install CIAO and Sherpa in a conda environment:
https://cxc.cfa.harvard.edu/ciao/download/ - Once the install process has finished, check Sherpa works:
If there are no errors, Sherpa should be working as expected.$ conda activate ciao-environment-name $ sherpa
- Activate the environment:
$ conda activate ciao-environment-name
- Install BXA:
- With Anaconda:
$ conda install -c conda-forge bxa
- With
pip
(see warning below):
$ pip install requests corner astropy h5py cython scipy tqdm pandas $ pip install bxa
- With Anaconda:
- Check UltraNest works:
$ python -c 'import ultranest'
- Check BXA works:
$ python -c 'import bxa.sherpa as bxa'
*⚠️ Warning!
Installing packages with
conda
and pip
can lead to package conflicts, such as:
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
If this occurs, from inside your
conda
environment use:
pip uninstall ultranest
conda install -c conda-forge ultranest
Download spectra
If you don't have your own, download the following spectral data to use with the tutorial, simulated from the X-ray space telescopes NuSTAR and Chandra.
The zip file contains:
nustar_src.pha
: NuSTAR source + background spectrumnustar.rmf
: NuSTAR response filenustar.arf
: NuSTAR effective area filenustar_bkg.pha
: NuSTAR background spectrumchandra_src.pi
: Chandra source + background spectrumchandra.rmf
: Chandra response filechandra.arf
: Chandra effective area filechandra_bkg.pi
: Chandra background spectrum
For an explanation of the roles each of these files plays, see the CXC X-ray Primer.
Depending on the fitting method being used, make sure to bin your spectra appropriately before fitting (see Exercise 0.1).