🔵 🔵 🔵


Primary

၊၊||၊|။

Model.setPars() ⚬|docu|1st|20251021191801-00-⌔

Model — PyXspec 2.1.5 documentation#xspec.Model.setPars

setPars(﹡parVals)

Change the value of multiple parameters in a single function call.

This is a quick way to change multiple parameter values at a time since only a SINGLE model recalculation will be performed at the end. In contrast, when parameter values are changed through the individual parameter objects, the model is recalculated after EACH parameter change. (See also AllModels.setPars(), for changing multiple parameters belonging to multiple model objects.)

Args:

parVals: An arbitrary number of parameter values.

These may be listed singly (as floats or strings), or collected into tuple, list or dictionary containers. Dictionaries must be used if parameters are not in consecutive order, in which case the parameter index number is the dictionary key.

Examples: Assume we have a model object m1 with 5 parameters.

Simplest case: change only the parameter values (and not the auxiliary values, ‘sigma’, ‘min’, ‘bot’, etc.), and change them in consecutive order: # Pass in 1 or more floats m1. setPars (5.5, 7.83, 4.1e2) # changes pars 1-3 m1. setPars (2.0, 1.3e-5, -.05, 6.34, 9.2) # changes all 5 pars

Still changing only the parameter values, but skipping over some: m1. setPars (.02, 4.4, { 5: 3.2e5 }) # changes pars 1-2, 5 m1. setPars ({ 2: 3.0, 4: - 1.2 }) # changes pars 2, 4 m1. setPars ({ 2: 1.8 }, 9.3, 5.32) # changes pars 2, 3, 4

Now also change the auxiliary values for some of the parameters. Pass in a STRING containing ”,,,,, ” This uses the same syntax as Standard XSPEC’s “newpar” command. Aux values can be skipped by using multiple commas: # This sets a new , , and for parameter 1, and # a new of 5.3 for parameter 2. m1. setPars (“.3,.01,,,,100”, 5.3) # This sets all new auxiliary values for parameter 3. m1. setPars ({ 3: “.8 -.01 1e-4 1e-3 1e5 1e6” })

Printed 2026-06-28.

(echo:: @ )

Link to original

Secondary

• • •