Advanced Python Scripting Using Sherpa
Abstract
Sherpa is a general purpose modeling and fitting application written in Python. The dynamism of Python allows Sherpa to be a powerful and extensible software package ready for the modern challenges of data analysis. Primarily developed for the Chandra Interactive Analysis of Observations (CIAO) package, it provides a flexible environment for resolving spectral and image properties, analyzing time series, and modeling generic types of data. Complex model expressions are supported using Sherpa's general purpose definition syntax. Sherpa's parameterized data modeling is achieved using robust optimization methods implementing the forward fitting technique. Sherpa includes functions to calculate goodnessoffit and parameter confidence limits. CPU intensive routines are written in C++/FORTRAN. But since all other data structures are contained in Python modules, users can easily add their own data structures, models, statistics or optimization methods to Sherpa. We will introduce a scripted example that highlights Sherpa's ability to estimate energy and photon flux errors using simulations. The draws from these simulations, accessible as NumPy ndarrays, can be sampled from univariate and multivariate normal distributions and can be binned and visualized with simple high level functions. We will demonstrate how Sherpa can be extended with userdefined model and statistic classes written in Python. Sherpa's open design even allows users to incorporate prior statistics derived from the source model.
 Publication:

Astronomical Data Analysis Software and Systems XX
 Pub Date:
 July 2011
 Bibcode:
 2011ASPC..442..687R