Examples of using Sherpa.
Jupyter Notebook
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
data/pha
images
.gitignore
Fitting a PHA dataset using the object API.ipynb
README.md
an integrated user model.ipynb
an introduction to the Session object.ipynb
environment.yml
extending existing models (and XSPEC).ipynb
plotting using the lower-level routines.ipynb
really simple fit.ipynb
simple sherpa fit.ipynb
simulating a 2D image and a bit of error analysis.ipynb
simulating and fitting a 2D image (this time with a Bayesian approach).ipynb
user model.ipynb

README.md

IPython notebooks showing off how to use the standalone version of Sherpa to fit data.

The mybinder version appears to be broken, and I haven't looked into what is going on, so there's a distinct possibility that the 'launch binder' button isn't going to work.

You can now try them out directly in your browser via the magic of the MyBinder project (unfortunately the offer does not extend to the XSPEC example as there's no easy build of the XSPEC user models that the binder project can use, I appear to have forgotten to set up the SciPy requirement so this will cause some problems in some notebooks, and it is not likely to be as fast as when run on your own machine): Binder

  • A really simple "fit", which also doubles as my go-to-guide when cooking my kids porridge for breakfast.

    Last updated: September 26 2016 to use the Sherpa 4.8.2 release

  • A simple fit which is based on the NumPy/SciPy fitting example from the Practical Python for Astronomers course.

    Last updated: September 26 2016 to use the Sherpa 4.8.2 release

  • Writing your own user model, which fits the cumulative distribution function of a data set with the Gamma CDF. The same code can be run from the CIAO version of Sherpa (I added this as we are currently lacking in documentation for how to use the add_user_model routine).

    Last updated: September 26 2016 to use the Sherpa 4.8.2 release

  • An integrated user model, which fits the Gamma probability distribution function to the data set used in the 'Writing your own user model' example. This is an example of handling "integrated" data sets, and also shows off how to write a guess routine for your model, and some plot manipulations (in particular, re-creating a region-projection plot and adding extra annotations to it).

    Last updated: September 26 2016 to use the Sherpa 4.8.2 release

  • How can I plot data and models when using the lower-level routines, which came up (in my mind) in the "Writing your own user model" example, where I started off using the lower-level API, but quickly switched to the higher-level (data management) API in part because I did not know how to create the plots. Well, I do know, and so can you.

    Last updated: September 27 2016 to use the Sherpa 4.8.2 release

  • Extending existing models (and an example of using XSPEC models), which shows how to write a user model that extends the behavior of an existing model (in this case, subtracting a model from itself with different parameter values). It also shows how to build the XSPEC module, and so use the XSPEC models from standalone Sherpa.

    June 16 2015.

  • Simulating 2D data with a dash of error analysis, which uses the object API to simulate a 2D model (i.e. an image), fit it, and calculate errors on the parameters. This can be thought of as an extension of the previous notebooks that show how to replicate the functionality of the high-level UI layer using the object API (it also marks the start of me using the term "object API" for what I previously referred to as the "low-level API").

    Last updated: September 27 2016 to use the Sherpa 4.8.2 release

  • Simulating and fitting a 2D image (this time with a Bayesian approach), which is based on the previous notebook, this time showing how you can use the Monte Carlo Markov Chain (MCMC) analysis module in Sherpa (that is, the Bayesian Low-Count X-ray Spectral (pyBLoCXS) module). This notebook is mainly intended to show how to do this, rather than explain why (or the differences between the various frequentist and Bayesian methods for coming up with an error estimate).

    Last updated: September 28 2016 to use the Sherpa 4.8.2 release

  • An introduction to the Session object, which is a very brief example of how to use the Session object to access the UI API (e.g. that from sherpa.astro.ui or sherpa.ui) but with a more-Pythonic approach.

    Last updated: January 31 2017 to use the Sherpa 4.9.0 release (which should be available within a few days of this notebook being published).

  • Fitting a PHA dataset using the object API, which provides a quick runthrough showing how to use the object API to fit a PHA data set (that is, how in include the instrument response in a fit).

    Last updated: August 8 2017 using the recently-released Sherpa 4.9.1 release (and it is also the first Python 3.6 notebook).

The information in these notebooks is placed in the Public Domain and is not an official product of the Chandra X-ray Center.