Release Notes
Version 2.1.4 Aug 2024 [XSPEC 12.14.1]
Enhancement
Improved calculation efficiency when creating new models with non-default values for the parameters.
Version 2.1.3 Feb 2024 [XSPEC 12.14.0]
New Features
New methods AllModels.setActive() and AllModels.setInactive() to provide access to standard Xspec's "model active" and "model inactive" functionality.
Fixes
previously available as an XSPEC patch
In AllModels.addPyMod(), the use of deprecated Python function was preventing execution with Anaconda Python v3.11.
Version 2.1.2 Jul 2023 [XSPEC 12.13.1]
New Features
New method Plot.nAddComps() for returning the number of add component plots for a given plot group. This can be helpful for determining the valid range of the addCompNum input argument to Plot.addComps().
Two new methods to take advantage of standard Xspec's new ability to set systematic model errors for specific models: AllModels.systematicSingleModel and AllModels.setSystematicSingleModel.
Version 2.1.1 Nov 2022 [XSPEC 12.13.0]
New Features
The Fit.goodness() function takes new optional argument, [no]fit, to provide same functionality available in standard Xspec's goodness command.
New attributes for the Fit class: previousGoodness and previousGoodnessSims
New function AllModels.mdefine() to provide access to standard Xspec's mdefine capability.
The Xset.abund attribute can now take an input list of 30 values in addition to the already available selection of built-in tables.
Version 2.1.0 Feb 2022 [XSPEC 12.12.1]
New Features
Parameter links may now be assigned directly to other parameter objects rather just to a string listing index numbers. For example it is now possible to do something like m2.gaussian.LineE.link = m1.gaussian.LineE.
A new function xspec.callTableModel gives local models written in Python access to Xspec's table model functionality.
A single spectrum's contribution to the overall fit statistic can now be accessed through the Spectrum.statistic attribute.
PyXspec has been reorganized internally such that the portion that is compatible with the Xspec models-library-only distribution is now separated into it's own module, named mxspec. The original xspec module includes this, so the change should only be noticeable to those using a models-library-only distribution.
Version 2.0.5 Apr 2021 [XSPEC 12.12.0]
New Features
To help with passing information to a 3rd-party plotting package (such as matplotlib), several plot retrieval methods have been added. These are: Plot.labels(), Plot.contourLevels(), and Plot.z()
The Spectrum object constructor (__init__ function) now takes optional arguments for specifying background, response, and arf files. This is useful when you don't want to use the default file names (if any) that are stored in the Spectrum file.
Code added for /svg graphics to work when PyXspec is run in Jupyter notebooks.
Beginning with Xspec 12.12.0, spectrum and background value arrays are no longer divided by the area scale. In PyXspec, that carries over to the Background.values and Spectrum.values attributes.
Fixes
In certain cases where errors occur while the ctrl-c signal handler is active, the Python session will crash when the user attempts to exit, or a script finishes.
PyXspec terminates when AllData.fakeit() can't find a response file and allowPrompting is turned off.
Version 2.0.4 Aug 2020 [XSPEC 12.11.1]
Fixes
The Spectrum.dummyrsp() function had been mixing up the arguments for spectrum number and source number.
Version 2.0.3 Mar 2020 [XSPEC 12.11.0]
New Features
Plot values can now be retrieved from the individual additive components within a model, using the new Plot.addComp() method.
Added Fit.nVarPars attribute to perform the equivalent of standard Xspec's "tclout varpar".
Added access to standard Xspec's "rerror" command (for running the "error" command on response parameters. This is now available by passing a second (bool) argument to the Fit.error() method. (This has been previously released as an XSPEC patch.)
Version 2.0.2 Oct 2018 [XSPEC 12.10.1]
New Features
It is now possible to call XSPEC's model functions directly from PyXspec using the new function xspec.callModelFunction(). This utility is particularly useful for users who wish to access particular XSPEC model functions within their own local model Python code.
Fixes
Some XSPEC model parameter names contained parentheses, which were incompatible when used in PyXspec. These parentheses have been replaced with a single underscore.
Version 2.0.1 Mar 2018 [XSPEC 12.10.0]
(*) = previously available as XSPEC patches
New Features
New methods for AllChains: margin() and marginResults(), best() and dic(), providing access to equivalent MCMC functionality in standard XSPEC.
The Chain class attribute: rescale.
Additions to Spectrum class: xflt and responsesUsed attributes, fileinfo() method.
AllModels.identify() method, wrapping standard XSPEC's 'identify' and 'tclout idline' functionality.
Fit.nullhyp attribute now wraps 'tclout nullhyp'.*
The Xset.parallel object now has additional attributes: steppar, walkers, and goodness, and a new show() method.*
Fixes
The Model.energies() function had been returning values as a list of strings. This has been changed to a more convenient list of floats.
The Xset.restore() function was not properly handling 'cd' commands, nor gain fit parameters.*
Version 2.0.0 Nov 2016 [XSPEC 12.9.1]
New Features
Now compatible with Python 3.x. (No longer compatible with Python versions prior to 2.5.)
Added Xset.save() and restore() functions for saving and recovering the state of a PyXspec session.
New adjustable attributes for the Chain class: walkers and algorithm.*
AllModels.tclLoad() method added to provide a lower-level alternative to the lmod() local model loading scheme.*
Xset.allowPrompting attribute provides option for turning on/off XSPEC prompting. This can be useful in iPython environments where certain contexts can lead to infinite prompting loops.
PyXspec manuals have been converted from Doxygen-generated to Sphinx-generated HTML and PDF.
Fixes
Was previously unable to unlink a linked parameter in a Python-coded local model.*
Version 1.1.0 Jul 2015 [XSPEC 12.9.0]
New Features
Local models may now be written in Python and inserted into XSPEC's models library with new AllModels.addPyMod() function.
The plot array retrieval interface (ie. Plot.x(), Plot.y()) has been expanded to allow retrieval from secondary plot panels in a multi-panel plot.
New Parameter.index attribute.
New backscale attribute for Spectrum and Background classes.
Added new function Fit.stepparResults() for retrieving results of most recent steppar run. (Previously available as a patch)
New noWrite option added to AllData.fakeit (Previously available as patch)
Fixes
The Model.__call__ function now returns Parameter objects by reference rather than by value. This is to allow the returned object to retain any custom attributes the user may have added.
Improved handling of Ctrl-c breaking in several prompting contexts.
Version 1.0.4 Jul 2014 [XSPEC 12.8.2]
Added Fit.testStatistic attribute for retrieving the test statistic value from the most recent fit.
Added compiler macros for switching to <Python/Python.h> include paths when building on Mac platforms.
Bug fix for get/set Spectrum.correction files on OS X Mavericks.
Version 1.0.3 Aug 2013 [XSPEC 12.8.1]
The Fit.statMethod and statTest attributes can now be set for a range of individual spectra rather than only applying to all.
Bug fix to the RModel class (ie. the class of the Response.gain attribute). If the user assigned multiple RModel objects to point to the same underlying XSPEC response gain, changes made through one object weren't necessarily showing up in the other objects. This also fixes a related bug created in Xspec patch 12.8.0l that caused a list of error messages to appear (only) in Python versions 2.6.x.
Version 1.0.2 Jan 2013
Added Xset.parallel attribute, with options 'leven' and 'error' for setting parallel processes.
Added Fit.statTest attribute for getting/setting the XSPEC test statistic.
Version 1.0.1 Dec 2012 [XSPEC 12.8.0]
2 additions to the Spectrum class: an ignored attribute and an ignoredString() function. The former returns a Python list object containing every ignored channel number. The latter returns the same information in convenient string form, which can be reused as input to a future ignore or notice command.
Version 1.0 Feb 2012 [XSPEC 12.7.1]
Changes relative to the PyXspec Beta version:
Warning
Two Backwards-Incompatible Changes:
When using multiple data groups, the Model objects assigned to the higher-numbered groups now all have their parameters indexed from 1 to nPar. For example with a 3 parameter model applied to 2 data groups, you would now access the first parameter in the 2nd model object with mod2(1) rather than mod2(4).
The Model.setPars() function (introduced with patch 12.7.0f) used the p`n` keyword argument syntax to set non-consecutive parameters. This has been replaced. with the use of Python dictionaries. For example, m.setPars(p2=.3, p4=1.1) should now be m.setPars({2:.3, 4:1.1}).
New Features
Added Standard XSPEC's gain command functionality. This is implemented with the new gain attribute for Response classes. Response.gain is a class of type RModel, and has two Parameter objects: slope and intercept.
New AllModels.setPars() function for changing multiple parameters in multiple Model objects with a single call.
Now compatible with Cygwin.
Features Previously Added As Patches To XSPEC 12.7.0
AllModels.initpackage() for building local models inside the Python shell.
Bayesian inference provided through the Fit.bayes and Parameter.prior attributes.
Fit.goodness() and Fit.improve() functions.
Model.setPars() function for changing multiple parameters with a single call.
AllModels.simpars() function to do the equivalent of Standard XSPEC's tclout simpars.
Fit.covariance attribute for retrieving the covariance matrix from the most recent fit.
Model.expression attribute which stores the model expression string.
AllModels.sources attribute which stores a map of source number and model name assignments.
Fixes
All PyXspec bug fixes previously released as patches to XSPEC 12.7.0 are included.
Now handles model component-by-name access when the component is a table model whose name includes whitespace.