Module functions for assigning source and background statistical weights.
Integer_Type set_weights([Integer_Type,]Array_Type)
Integer_Type set_bweights([Integer_Type,]Array_Type)
Success/Error Return Values: 1/0
Arguments:
(1) Dataset number (default 1)
(2) An array of source/background statistical weight settings
Note that if only one argument is provided, it is assumed to be an
array, and the dataset is assumed to be dataset 1.
The set_weights
and set_bweights functions allow the user
to assign new source and background statistical weight values
to Sherpa datasets. The default value of a
statistical weight is 1, meaning the all data bins have equal influence
in the calculation of a statistic. A weight less than 1 decreases
a bin's contribution to the total statistic value; a weight greater
than 1 increases the contribution.
Note that:
-
the input array length must match the number of bins in the
filtered dataset;
consequently, if one's goal is to use these functions in data manipulation,
it is important not to change the
filter in Sherpa between any call to, e.g.,
get_weight and set_weight!
-
the input array is typecast to match the type of its associated
dataspace (see, e.g., set_axes for a
definition of dataspaces).
For instance, if dataset 3 is of Double_Type, then when
set_weight(3,<array>) is run, the array is typecast to
Double_Type if necessary.
See the related Sherpa command
READ WEIGHTS for more information.
Change the statistical weights of the lowest-value bins in a
dataset to reduce the influence of these bins in a statistic
calculation:
sherpa> DATA spec.dat
sherpa> SOURCE = CONST[cs]
sherpa> FIT
LVMQT: V2.0
LVMQT: initial statistic value = 82.2297
LVMQT: final statistic value = 63.9111 at iteration 3
cs.c0 57.7977
sherpa> d = get_data(1)
sherpa> d[*] = 1
sherpa> d[[0:5]] = 0.5
sherpa> printarr(d,10)
0.5
0.5
0.5
0.5
0.5
0.5
1
1
...
sherpa> set_weights(1,d)
1
sherpa> FIT
LVMQT: V2.0
LVMQT: initial statistic value = 61.7966
LVMQT: final statistic value = 61.7912 at iteration 2
cs.c0 57.8627
In this example, data are read into Sherpa and the
counts amplitude array is retrived using get_data.
Every element of this array is reset to 1, then the first six elements
are reset to 0.5. The array is then
sent to Sherpa, where it overwrites
the old weight array; the subsequent fit shows a slight change.
- chandra
-
guide
- sherpa
-
autoest,
back,
berrors,
bsyserrors,
coord,
data,
dataspace,
fakeit,
feffile,
group,
guess,
is_subtracted,
load,
load_arf,
load_ascii,
load_back_from,
load_backset,
load_dataset,
load_fitsbin,
load_image,
load_inst,
load_inst_from,
load_pha,
load_pha2,
load_rmf,
read,
set_analysis,
set_axes,
set_backscale,
set_coord,
set_data,
set_exptime,
set_subtract,
setback,
setdata,
subtract,
ungroup,
unsubtract,
use
|