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/set_par.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 set_par Context: sherpa

Synopsis

Module function for setting model parameter values, etc.

Syntax

Integer_Type set_par(Struct_Type)
Integer_Type set_par(String_Type,String_Type,{Float_Type | String_Type})

Success/Error Return Values: 1/0

Arguments:

(1) A parameter information structure

or

(1) The parameter name

(2) The field to set

(3) The new value for that field

Description

The first form of this function assumes as input the parameter information structure output by get_par, e.g.

sherpa> GAUSS[g]
sherpa> foo = get_par("g.pos")
sherpa> print(foo)
name             =  g.pos
model            =  gauss1d
type             =  src
value            =  0
min              =  -3.40282e+38
max              =  3.40282e+38
delta            =  -1
units            =  NULL
frozen           =  0
linked           =  0
linkexpr         =  NULL

The second form of this function takes the arguments listed above; fields to set include:

Allowed set_par Arguments

Argument Description
value the parameter value (either a number, or a string filename)
min the current (soft) lower bound on allowed parameter values
max the current (soft) upper bound on allowed parameter values
delta the initial step size for the parameter in fits (or -1 to use the default step size)
frozen if 1, freeze the parameter's value; if 0, thaw it
thawed if 1, thaw the parameter's value; if 0, freeze it

See the Sherpa command CREATE for more information.

Example 1

Get a parameter structure; change two fields; set back into Sherpa:

sherpa> GAUSS[g]
sherpa> foo = get_par("g.pos")
sherpa> print(foo)
name             =  g.pos
model            =  gauss1d
type             =  src
value            =  0
min              =  -3.40282e+38
max              =  3.40282e+38
delta            =  -1
units            =  NULL
frozen           =  0
linked           =  0
linkexpr         =  NULL
sherpa> foo.value = 15.5
sherpa> foo.min = 0.0
sherpa> () = set_par(foo)
sherpa> SHOW g
gauss1d[g]  (integrate: on)
    Param   Type      Value        Min        Max                 Units
    -----   ----      -----        ---        ---                 -----
 1   fwhm thawed         10 1.1755e-38 3.4028e+38                      
 2    pos thawed       15.5          0 3.4028e+38                      
 3   ampl thawed          1 -3.403e+38 3.4028e+38                      

Example 2

Change two parameter attributes directly:

sherpa> GAUSS[g]
sherpa> () = set_par("g.pos","value",15.5)
sherpa> () = set_par("g.pos","min",0.0)
sherpa> SHOW g
gauss1d[g]  (integrate: on)
    Param   Type      Value        Min        Max                 Units
    -----   ----      -----        ---        ---                 -----
 1   fwhm thawed         10 1.1755e-38 3.4028e+38                      
 2    pos thawed       15.5          0 3.4028e+38                      
 3   ampl thawed          1 -3.403e+38 3.4028e+38                      

Bugs

See the Sherpa bug pages online for an up-to-date listing of known bugs.

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.