Last modified: 12 December 2024

Accessing the per-bin model values [New]


The plot routines provide one way to access the "per-bin" model values. Direct access is also provided by the calc_model and calc_source routines ([New] in CIAO 4.17).

clean()
load_arrays(1, [10, 20, 40, 70], [29, 55, 100, 145])
set_source(polynom1d.mdl)
mdl.c1.thaw()
fit()
xvals, yvals = calc_model()

For this dataset (Data1D) then xvals is a single-element tuple returning the independent axis:

sherpa> print(xvals[0])
[10 20 40 70]
sherpa> print(yvals)
[ 31.88913646  51.8933563   91.90179597 151.91445547]
sherpa> print(mdl)
polynom1d.mdl
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   mdl.c0       thawed      11.8849 -3.40282e+38  3.40282e+38           
   mdl.c1       thawed      2.00042 -3.40282e+38  3.40282e+38           
   mdl.c2       frozen            0 -3.40282e+38  3.40282e+38           
   mdl.c3       frozen            0 -3.40282e+38  3.40282e+38           
   mdl.c4       frozen            0 -3.40282e+38  3.40282e+38           
   mdl.c5       frozen            0 -3.40282e+38  3.40282e+38           
   mdl.c6       frozen            0 -3.40282e+38  3.40282e+38           
   mdl.c7       frozen            0 -3.40282e+38  3.40282e+38           
   mdl.c8       frozen            0 -3.40282e+38  3.40282e+38           
   mdl.offset   frozen            0 -3.40282e+38  3.40282e+38           

For PHA data the xvals tuple will contain two elements, the low and high edges of each bin, and the units depends on the analysis setting.