Chandra X-Ray Observatory (CXC)
Skip to the navigation links
Last modified: 11 December 2012

How do I change the AtomDB version used by X-Spec Apec models?


The X-Spec Apec models - xsapec, xsbapec, xsbvapec and xsvapec - default to using version 1.3.1 of the AtomDB atomic database. To use a different version you need to change the value of the APECROOT variable used by the X-Spec model, using the set_xsxset command, as described elsewhere.

Using the versions distributed with Sherpa

The model distributed as part of Sherpa provides data for the following AtomDB versions: 1.10, 1.2.0 and 1.3.1. So, to change to use 1.2.0 you would say:

sherpa> set_xsxset("APECROOT", "1.2.0")

and all X-Spec Apec model components will use this version of the database whenever they are evaluated (e.g. in fitting, error analysis, calculating statistics or plotting).

Using version 2.0.0 of AtomDB

AtomDB has recently (January 10, 2011) been updated to version 2.0.0. This version includes a number of improvements in the data as well as additional elements. Unfortunately the X-Spec apec models do not support these additional elements, but they can take advantage of the improved data. To do this you first need to download the AtomDB 2.0.0 package, making sure you get the X-Spec version, namely atomdb_v2.0.0_xspec_runs.tar. This file unpacks into a directory, as shown below (in this example we assume the data is going to reside in /soft/data/):

unix% tar xf atomdb_v2.0.0_xspec_runs.tar
unix% cd atomdb_v2.0.0
unix% ls -1
Release_Notes.txt
VERSION
apec_v2.0.0_xspec.out
apec_v2.0.0_xspec.par
apec_v2.0.0_xspec_coco.fits
apec_v2.0.0_xspec_line.fits
apec_v2.0.0_xspec_linelist.fits
unix% pwd
/soft/data/atomdb_v2.0.0

Once the data has been unpacked, Sherpa can be told to use these new files by saying:

sherpa> set_xsxset("APECROOT", "/soft/data/atomdb_v2.0.0/apec_v2.0.0_xspec")

and any X-Spec apec model will use these new files for the rest of the Sherpa session (or until the APECROOT variable is changed).

Example: Comparison of 2.0.0 with 1.3.1

In the following script, we show how you can compare the values from the xsapec model for versions 1.3.1 (the default) and 2.0.0 of the AtomDB. The choice of energy range and model parameters made here was for didactic reasons rather than to highlight any specific feature in the new database.

# Create an instance of the XS apec model
mdl = xsapec.mdl
mdl.kt = 1.5
mdl.abundanc = 1

# Energy range over which to evaluate the model
#   x1 uses a bin width of 1 eV and
#   x2 uses                0.1 eV
#
# The lo/hi arrays give the left and right values
# of each bin for the model evaluation.
#
x1 = np.arange(1.05, 1.061, 0.001)
lo1 = x1[:-1]
hi1 = x1[1:]

x2 = np.arange(1.05, 1.061, 0.0001)
lo2 = x2[:-1]
hi2 = x2[1:]

# Evaluate using version 1.3.1 (the default setting)
set_xsxset("APECROOT", "1.3.1")
y131_1 = mdl(lo1, hi1)
y131_2 = mdl(lo2, hi2)

# Use version 2.0.0 
set_xsxset("APECROOT", "/soft/data/atomdb_v2.0.0/apec_v2.0.0_xspec")
y200_1 = mdl(lo1, hi1)
y200_2 = mdl(lo2, hi2)

# Plot the results
add_window(8, 6, "inches")
strip_chart(2)
add_histogram(lo1, hi1, y131_1, ["line.thickness", 2])
add_histogram(lo1, hi1, y200_1, ["line.color", "orange"])

log_scale(Y_AXIS)
set_plot_title(r"AtomDB: 1.3.1  vs  \color{orange}2.0.0")
set_plot(["title.size", 24])

current_plot("plot2")
add_histogram(lo2, hi2, y131_2, ["line.thickness", 2])
add_histogram(lo2, hi2, y200_2, ["line.color", "orange"])

log_scale(Y_AXIS)

set_plot_xlabel("Energy (keV)")

current_plot("all")
set_plot_ylabel("Photon/cm^2/s")
set_yaxis(["offset.perpendicular", 60])
set_axis(["label.size", 18, "ticklabel.size", 16])

current_plot("plot1")
add_label(0.95,0.85,"kT_x = 1.5 keV", ["coordsys", PLOT_NORM,
   "halign", 1, "size", 18])
add_label(0.95,0.75,r"A = 1_\sun", ["coordsys", PLOT_NORM,
   "halign", 1, "size", 18])

print_window("compare.131-200.png", ["clobber", True])
print("Created: compare.131-200.png")

If these files are stored in the file qcomp.py then they can be run by saying:

unix% sherpa qcomp.py
-----------------------------------------------------
Welcome to Sherpa: CXC's Modeling and Fitting Package
-----------------------------------------------------
CIAO 4.4 Sherpa version 1 Friday, December 2, 2011

Created: compare.131-200.png
sherpa-2> 

which creates the following plot:

[There are small differecnces in the two models]

Using the default version

To get back to the default version of the AtomDB, clear the APECROOT setting by saying:

sherpa> set_xsxset("APECROOT", "")

WARNING

The set_xsxset call to change the APECROOT value needs to be made each time Sherpa is used (analagous to how changes to the X-Spec abundance setting, using set_xsabund, must be made each session).



Last modified: 11 December 2012
CXC logo

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2012. All rights reserved.