Monday, May 10, 2010

Combine Sherpa Models with Deprojected Models in Sherpa

Yesterday, I used a nice trick in Sherpa to combine standard models and deprojected models. Using  Deproject Python package in Sherpa one can fit the emission models to X-ray clusters accounting for the 3D to 2D projection effects in the data (standard "onion-peeling" technique described by Fabian et al 1981, and Kriss et al 1983). This allows for obtaining deprojected temperature, density and entropy distributions in the cluster. Sometimes, a combination of deprojected and standard model components needs to be used and  I could use get_source() and set_source() to make such combinations. The trick was to setup the deprojected model components first and then use get_source() to parse the model expression into a new set_source() expression where I added an extra model component. 

          dep.set_source("xsmekal")
         set_source(0,get_source(0)+powlaw1d.p1)
         set_source(1,get_source(1)+powlaw1d.p1)     
         set_source(2,get_source(2)+powlaw1d.p2)
         set_source(3,get_source(3)+powlaw1d.p2)

This is a part of my script where I insert the expression for each data set by hand. Of course there must be a nicer way to do this with loops etc. 
The deprojected source expression is set by dep.set_source() for all data sets as explained in the Deproject documentation. Here I used just a standard XSPEC mekal model.  Note that there are 2 annuli and each of them has 2 data sets. I add the same power law model component (p1 and p2) to each annulus. 


get_model() allows you to inspect the full model expression.


 

No comments:

Post a Comment