Saturday, December 24, 2011

A couple of patches to relatively obscure xspec bugs

12.7.0r When using C-stat, if spectra with no backgrounds and different exposures and/or areascales are collected into the same data group, the renorming operation will miscalculate and can disrupt the fit. Our thanks to Jeremy Sanders for pointing this out. Report added on Dec 06, 2011.

12.7.0s Fix for bug which caused errors in the apec model when running v1.x of AtomDB and the wilm abundance option. Report added on Dec 08, 2011.

Thursday, November 17, 2011

xspec patches 12.7.0p and q

12.7.0p Fix for the obscure case of a model containing both 1) frozen norm parameters AND 2) an unfrozen norm for an additive component to the left of a multiplicative component. When these conditions exist the renorm operation may break, causing a fit to go astray. Our thanks to Hauke Worpel for pointing this out. Report added on Oct 28, 2011.

12.7.0q Enhancements for PyXspec. This adds the object attribute Model.expression which stores the model expression string. It also adds AllModels.sources to the global AllModels container. This is a dictionary object containing the current source numbers with their assigned active models. Its key:value pairs are: [source number]:[model name]. Our thanks to Adam Mantz for these suggestions. Report added on Oct 28, 2011.

Tuesday, October 18, 2011

xspec patches 12.7.0l-o

12.7.0l A crash can occur when trying to plot data while using a dummy response with no channel array. Our thanks to Randall Smith for pointing this out. Report added on Oct 05, 2011.

12.7.0m An enhancement for PyXspec. This adds the new function AllModels.simpars(), which provides the same functionality as standard XSPEC's tclout simpars command. The simulated parameter values are returned as a tuple of floats. Our thanks to Martin Sparre for this suggestion. Report added on Oct 05, 2011.

12.7.0n A fix for PyXspec. When a Parameter object's frozen attribute is toggled (to either freeze or thaw the parameter), the fit statistic's degrees-of-freedom doesn't get updated until a new fit is performed. It ought to be updated immediately. Our thanks to Sebastien Guillot for pointing this out. Report added on Oct 05, 2011.

12.7.0o An enhancement for PyXspec. This adds the new attribute Fit.covariance, which holds (in a tuple) the covariance matrix values from the most recent fit. Our thanks to Sebastien Guillot for this suggestion. Report added on Oct 11, 2011.

Tuesday, September 13, 2011

xspec patches 12.7.0i,j,k

12.7.0i This fixes an obscure case where erroneous usage of "?" for command summary display is causing a crash. Our thanks to Sebastien Guillot for pointing this out. Report added on Sep 07, 2011.

12.7.0j Fix needed to allow gain fit parameters to be used along with custom energy arrays supplied by the energies command. (This includes the energies extend option.) Our thanks to Dominic Walton for pointing this out. Report added on Sep 07, 2011.

12.7.0k For PyXspec only. This improves the output of the Model.folded() class method for the case where there are ignored channels. Previously, bins in the folded model array were set to zero when they corresponded to ignored channels. Now they are removed from the array altogether. This ensures that the length of the folded model array always matches the number of noticed channels. Our thanks to Nakisa Nooraee for pointing this out. Report added on Sep 08, 2011.

Friday, September 02, 2011

Two PyXspec patches

12.7.0g Minor fix for when retrieving plot arrays (using tclout plot in standard XSPEC, or Plot.x() and Plot.y() in PyXspec). This removes the trailing zeros that padded the arrays when plot points were removed with the ignore or setplot rebin commands. Our thanks to Alexander Gewering-Peine for pointing this out. Report added on Aug 12, 2011.

12.7.0h Fix for PyXspec only. Earlier patch 12.7.0f introduced a bug which occurs when a non-norm parameter is modified and set to a parameter link. In this case it does not perform the necessary automatic model recalculation. Our thanks to Adam Mantz for pointing this out. Report added on Aug 25, 2011.

Thursday, August 04, 2011

A model for fitting power spectra in xspec

A model from Adam Ingram and Chris Done for the power spectra from black hole binaries is now available from the new models page.

I've added a note based on their paper to the XSPEC wiki which explains how to read power spectra into XSPEC.

Thursday, July 28, 2011

New models available

Two new sets of models are now available through the XSPEC extra models page (

logpar and eplogpar are power-laws whose indices have a log parabolic energy dependence. These models are widely used in blazar research.

optxagnf and optxagn are models for AGN which combine a colour temperature corrected disc and energetically coupled Comptonisation.

Thursday, July 21, 2011

Update to PyXspec

A patch (12.7.0f) is available which adds the ability to set multiple parameters at the same time in PyXspec. This can be a significant speed-up since the current version evaluates the model after each individual parameter change.

Tuesday, July 05, 2011

XSPEC and Chandra grating spectra

I have recently become aware (thanks to Lijun Gou and Mike Nowak) that the Chandra HETG ARF files include an EXPOSURE keyword which may differ from that in the spectrum (PHA2) file. If you are using XSPEC to analyze these spectra you should check whether the EXPOSURE values differ and if so replace that in the PHA2 file with the value from the ARF. The difference should only be significant if CC-mode was used.

A note on the gabs model

Oleg Kargaltsev has pointed out that the gaussian absorption line (gabs) is badly documented. The third parameter is called Tau although it is not the optical depth. The on-line help page has been amended and the gabs entry in model.dat will be changed so that the third parameter is just called Strength. In practice, if the optical depth is small then the third parameter is the equivalent width of the line.

Tuesday, June 28, 2011

Patch to replace AtomDB 2.0 with 2.0.1 in xspec

We have updated the current HEAsoft release downloads to replace AtomDB 2.0 with AtomDB 2.0.1 following the discovery of an error in the 2.0 RRC data. If you have already downloaded HEAsoft 6.11 (containing XSPEC 12.7.0) you can either get the fix from the HEAsoft issues page ( or patch 12.7.0e from the XSPEC bugs page (

Thursday, June 09, 2011

AtomDB v2.0 support added to xspec in v12.7

The new release of xspec uses AtomDB 2.0 for the various apec models. Since AtomDB 2.0 includes all elements to Zn there are a couple of issues to note.

1. New models vvapec and bvvapec allow all AtomDB 2.o elements to be varied independently.

2. By default the apec, bapec, vapec and bvapec models set to Solar the abundances of the elements included in AtomDB 2.0 but not in earlier versions (we refer to these as the trace elements). To set these abundances to zero use "xset APEC_TRACE_ABUND 0.0". The trace element abundances can be set to any value or linked to the abundance of one of the more common elements e.g. "xset APEC_TRACE_ABUND Fe".

xspec v12.7 released

The latest xspec release is now available through the HEAsoft download page.

The major new feature is the beta release of the Python xspec module. This is built and installed automatically on most platforms if the source code distribution is downloaded. PyXspec is not intended as a replacement for the current user interface but provides an alternative method for scripting xspec.

To learn more see the PyXspec users' manual.

Tuesday, May 31, 2011

pexmon model

Paul Nandra's pexmon model has been added to the more models page. This is a modification of Paul's original code to work with recent versions of xspec.

Tuesday, March 08, 2011

eqpair model and redshift convolution models

The next xspec release (due April-ish) will include eqpair as a standard model. At the prompting of Andrzej Zdziarski, I have added the ability to write out the temperature of the thermal electron distribution if chatter is set to 15. Andrzej notes that this provides an important self-consistency check.

Also at Andrzej's suggestion the new version will include zashift and zmshift convolution models to redshift additive and multiplicative components, respectively.

patch update

A couple of minor patches can be found at the usual place.

12.6.0y Both the writefits tcl script and the tclout error command fail when dealing with a scale or switch parameter. Our thanks to Juan Luna for pointing this out. Report added on Jan 31, 2011.

12.6.0z If a spectral data file has both quality and grouping columns, and all of the channel qualities are marked as bad, it will crash upon loading on Linux platforms. Our thanks to Fabio Pintore for pointing this out. Report added on Feb 09, 2011.

Thursday, January 13, 2011

Minor enhancement of fakeit and fix to model weighting

New patches for xspec which can be found in the usual place.

12.6.0w This adds a new option for the fakeit command. When prompted for the exposure time and correction norm, you may now enter a 3rd argument to change the fake background exposure time. Previously this parameter was fixed by the exposure time in the original background file upon which the fake background was based. For backwards compatibility, fakeit will produce the same behavior as before if this argument is not entered. Our thanks to Francois Dufor for making this suggestion. Report added on Jan 11, 2011.

12.6.0x When the model weighting option of the weight command is selected and applied to a spectrum with a background file, the variance ought to include the background in addition to the model. Our thanks to Giacomo Vianello for bringing this to our attention. Report added on Jan 11, 2011.