Module function for setting model parameter values, etc.
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
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
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.
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
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
- sherpa
-
autoest,
background,
create,
create_model,
createparamset,
fit,
freeze,
get_defined_models,
get_model_params,
get_models,
get_num_par,
get_par,
get_stackexpr,
getx,
gety,
guess,
instrument,
integrate,
is_paramset,
jointmode,
kernel,
lineid,
linkparam,
mdl,
modelexpr,
modelstack,
nestedmodel,
noise,
paramprompt,
paramset,
pileup,
rename,
run_fit,
set_paramset,
set_stackexpr,
source,
thaw,
truncate,
unlink
|