Thursday, January 30, 2014

Sherpa Fitting in ds9

You can now use Sherpa fitting directly from ds9. Several basic spectral and image models are loaded via CIAO analysis tools for a quick look at the model parameters. Here is the video from Kenny showing you how to do it: Fitting in ds9

Tuesday, July 9, 2013

Standalone Sherpa 4.5.1 Released as Source Code (Bug Fixes for GCC, clang, Macports)

I have released the standalone version of Sherpa 4.5.1 at the Sherpa website:

And on github at the Sherpa repository:

As in past releases, the purpose is to allow Python users to install Sherpa as a Python module, without reference to any other CIAO package or program.

No new features have been added since the release of Sherpa 4.5.0. However, I have added bug fixes to allow Sherpa to build with GCC 4.7 and 4.8; with clang on OS X; and to install in /opt/local/lib for Macports.

These fixes were contributed by Tim van Werkhoven of Leiden University.

I release the source code tarball, sherpa-4.5.1.tar.gz, that contains all the Sherpa source code we released with CIAO 4.5, plus these latest bug fixes.  Release notes for the patch can be found at NOTES-4.5.1.txt; release notes for the original Sherpa 4.5.0 release can still be found at NOTES-4.5.0.txt

This is a minor release, to allow Sherpa to build with newer compilers.

Wednesday, June 19, 2013

Use 'fake' function to generate image with Poisson noise

I often get a question whether it is possible to generate simulated image data in Sherpa. It is really easy to do it using fake() function. This function will use the specified model expression and add a Poisson noise to that model and generate an image.

Here are the simple steps in Sherpa interactive session:

dataspace2d( [256, 256 ])                   # set the size of the image data
set_model( )    # define model expression 
                                                         # in Sherpa - beta2d and constant 
set_par(bb.xpos, 128.)                        # x coordinate for  the beta2d model
set_par(bb.ypos, 128.)                        # y coordinates for the beta2d model
set_par(bb.ampl, 10.)                          # amplitude of the beta2d model
fake()                                                # generate the counts data from the model
                                                        #  with Poisson noise
image_fit()                                         # display simulated data, model and 
                                                        # residual images

ds9 image below shows the simulated data
on the left and model image on the right
the residual image on the bottom.

Wednesday, February 13, 2013

Running IPython Notebook in CIAO/Sherpa

I wanted to work with  IPython Notebook  in CIAO to create a nice record of analysis for my collaborators. Sherpa uses IPython 0.13, but CIAO does not come with 'pyzmq' and 'tornado'  required for running the Notebook. I also needed to install zmq library.  

Here are my installation steps after my downloading and installing CIAO 4.5 binaries on my iMAC OS 10.6.8:

1/ Start with "zmq" library. 

   Download  zeromq-3.2.2.tar.gz (version from23-Nov-2012 09:01) from:

tar xvf zeromq-3.2.2.tar.gz       
cd zeromq-3.2.2      
sudo make install

2/  Install pyzmq into CIAO area.

    Need to "source $ASCDS_INSTALL/bin/ciao.csh" to be in CIAO environment for installation in CIAO Python site-packages area. This can be done with "ciaorun" as I did below:
download the source file pyzmq-2.2.0.tar.gz from:

tar xvf pyzmq-2.2.0.tar.gz
cd pyzmq-2.2.0
ciaorun python install \

3/ Install tornado into CIAO area.

 Download the source file tornado-2.4.1.tar.gz from:

tar xvf tornado-2.4.1.tar.gz
cd tornado-2.4.1/
ciaorun python install \

4/ Run IPython Notebook

ipython notebook will start  a notebook session in your browser. Open the New Notebook to get to the interactive session. In the first cell type:

import numpy as np
from sherpa.astro.ui import *
from pychips import *

and then shift-return to run it. In the second cell:

x = np.arange(20)
y = np.sin(x)

shift-return to run it. You should see the CHIPS plot appearing outside the browser.

Monday, January 21, 2013

Standalone Sherpa Installation for X-ray Analysis

Tom just updated the instructions for building Standalone 4.5 Sherpa for X-ray Analysis. This build is good for all types of data modeling not only X-rays.  Check out the AstroPython web page:

Tuesday, January 15, 2013

Standalone Sherpa 4.5.0 Released as Source Code

I have released the standalone version of Sherpa 4.5.0 at the Sherpa website:

As in past releases, the purpose is to allow Python users to install Sherpa as a Python module, without reference to any other CIAO package or program.

I release the source code tarball, sherpa-4.5.0.tar.gz, that contains all the Sherpa source code we released with CIAO 4.5.  Release notes can be found at NOTES-4.5.0.txt.  The new version is also available at the cxcdev github repository for Sherpa.

This is a major release, to sync the standalone version with the recent CIAO 4.5 release.

Tuesday, January 8, 2013

Sherpa at the AAS 221st Meeting

Chandra booth at the AAS meeting shows demos of Sherpa in CIAO. You can stop by, meet people and ask questions.

VO booth, around the corner from Chandra one, shows IRIS package which uses Sherpa in SED fitting of the data.