Change the value of multiple parameters from multiple
model objects with a single function call.
This is a quick way to change multiple parameter values at a time since only a SINGLE 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. (If all the parameters belong to a single model object, you can also use the Model.setPars() function.)
args: An arbitrary number model objects and parameter values.
The first argument must be model object, followed by one or more of its new parameter values. Additional groups of model objects and parameter values may follow.
The parameter values follow the same syntax rules as with the single Model.setPars() function. They can be listed singly (as floats or strings), or collected into tuple, list, or dictionary containers. Dictionaries must be used when parameters are not in consecutive order, in which case the parameter index number is the dictionary key.
Parameter indices are local to each model object. That is, they are always numbered from 1 to N where N is the number of parameters in the model object.
Examples:
# Assume we've already assigned a 3 parameter model to 2 data groups:m1 = AllModels(1)m2 = AllModels(2)# Various ways of changing parameters in consecutive order.# This changes pars 1-2 in m1 and 1-3 in m2:AllModels.setPars(m1, .4, "1.3 -.01", m2, "5.3 ,,3.0e-4", 2.2, 1.9)# ...and these 2 examples do the exact same thing as above:valList = [.4, "1.3 -.01"]valTuple = ("5.3 ,,3.0e-4", 2.2, 1.9)AllModels.setPars(m1, valList, m2, valTuple)AllModels.setPars(m1, valList, m2,"5.3 ,,3.0e-4", [2.2, 1.9])# Parameters in non-consecutive order, must use Python# dictionaries:# Change parameter 2 in m1, parameter 1 and 3 in m2:AllModels.setPars(m1, {2:8.3}, m2, {1:0.99, 3:"7.15 -.01"})# ...same thing as above:AllModels.setPars(m1, {2:8.3}, m2, 0.99, {3:"7.15 -.01"})# Note that identical syntax is used for model objects belonging# to different sources. All of the above examples are still valid# had we obtained m1 and m2 like this:m1 = Model("phabs﹡pow", "firstMod", 1)m2 = Model("gauss", "secondMod", 2)