About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/get_source_components.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 get_source_components Context: sherpa

Synopsis

Return, as an array, the names of the model components in the source expression of a dataset.

Syntax

cpts = get_source_components();
cpts = get_source_components( dnum );

Description

The routine is loaded into Sherpa with the call

  require ("sherpa_utils");

The functions returns a String_Type array which contains the names of the components used to define the source expression. If no argument is given then dataset number 1 is assumed, otherwise it uses the argument (dnum) as the dataset number to use. for dataset number 1. This routine complements get_source_expr() which returns the full source expression.

Example 1

sherpa> paramprompt off
sherpa> source = xsphabs[gal] * ( xsmekal[clus] + xspowerlaw[pl] )
sherpa> print( get_source_expr )
(gal * (clus + pl))
sherpa> cpts = get_source_components
sherpa> cpts
String_Type[3]
sherpa> print( cpts )
gal
clus
pl

Here we set up a source expression consisting of a plasma model plus a powerlaw, both absorbed by the "xsphabs" model. The get_source_expr() routine returns a string listing the full source expression, so we use the get_source_components() routine from sherpa_utils.sl to break it down into its compnenets (here "gal", "clus", and "pl").

Since we are using dataset number 1 then we do not need to provide arguments to either the get_source_expr() or get_source_components() routines. This means that we can call these routines without the trailing "()".

Example 2

sherpa> paramprompt off
sherpa> source 3 = xsphabs * ( xsmekal + xspowerlaw )
sherpa> print( get_source_expr(3) )
(xsphabs * (xsmekal + xspowerlaw))
sherpa> cpts = get_source_components(3)
sherpa> print( cpts )
xsphabs
xsmekal
xspowerlaw

This is very similar to the previous example except that we are using dataset 3 - and so have to include it when calling both get_source_expr() and get_source_components() - and we do not provide our own names for the source components - and so they default to the model names.

NOTES

Please see "ahelp sherpa_utils" for information on how to load these routines into Sherpa.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.