get_num_par

sherpa.astro.ui.get_num_par(id=None)

Return the number of parameters in a model expression.

The get_num_par function returns the number of parameters, both frozen and thawed, in the model assigned to a data set.

Parameters

id (int or str, optional) – The data set containing the model expression. If not given then the default identifier is used, as returned by get_default_id.

Returns

npar – The number of parameters in the model expression. This sums up all the parameters of the components in the expression, and includes both frozen and thawed components.

Return type

int

Raises

sherpa.utils.err.IdentifierErr – If no model expression has been set for the data set (with set_model or set_source).

See also

get_num_par_frozen

Return the number of frozen parameters.

get_num_par_thawed

Return the number of thawed parameters.

set_model

Set the source model expression for a data set.

Examples

Return the total number of parameters for the default data set:

>>> print(get_num_par())

Find the number of parameters for the model associated with the data set called “jet”:

>>> njet = get_num_par('jet')