Last modified: December 2021

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/renorm.html
AHELP for CIAO 4.17 Sherpa

renorm

Context: contrib

Synopsis

Change the normalization of a model to match the data.

Syntax

renorm(id=None, cpt=None, bkg_id=None, names=None, limscale=10000)

Description

The renorm() function adjusts the normalization parameter of components in the source model so that the sum of the predicted data matches the sum of the observed data. It is similar to the guess() function but works only on the normalization parameters. It should only be used to set the parameter values before a fit, and not as a replacement for fitting a model to a dataset.

Loading the routine

The routine can be loaded into Sherpa by saying:

from sherpa_contrib.utils import *

Arguments

Name Default value Description
id None Which dataset to use. If None then the default dataset, as given by get_default_id(), is used.
cpt None If `None` then the full source expression for the dataset is used, otherwise it should contain the model component to change.
bkg_id None If not None, then the normalization of the model being fit to the given background component is changed.
names None The parameter names to change (a case-insensitive comparison is made, and only the parameter name itself, not the component name, is used). The default, used when names=None, is ['ampl', 'norm'].
limscale 10000.0 The minimum and maximum limits of the normalization parameter are set to newval / limscale and newval * limscale respectively (or set to the hard limits of the paramter, whichever is more restrictive).

Examples

Example 1

sherpa> load_pha('src.pi')
sherpa> subtract()
sherpa> notice(0.5, 7)
sherpa> set_source(xsphabs.gal * xsapec.gal)
sherpa> renorm()

Adjust the normalization of the gal component before fitting.

Example 2

sherpa> load_image('src', 'img.fits')
sherpa> set_source('src', gauss2d.src + const2d.bgnd)
sherpa> renorm('src')

Change the normalization of the src component used to fit dataset 'src'. The background component (bgnd) is not changed since const2d has no parameter called 'ampl' or 'norm'.

Example 3

sherpa> set_source(12, gauss2d.src12 + const2d.bgnd12)
sherpa> renorm(12, names=['ampl', 'c0'])

The normalizations of both components are changed, with each component contributing half of the signal.

Example 4

sherpa> renorm(limscale=1e3)

Change the minimum and maximum limits of the normalization parameter tp be equal to the new parameter value divided and multiplied by 1e3, respectively, rather than the default of 1e4.


Changes in the scripts 4.14.0 (December 2021) release

There have been minor changes: the limscale parameter now defaults to 1e4 and the routine now does nothing if the data sum in the noticed region is zero or less.

Changes in the scripts 4.8.2 (January 2016) release

This routine is new in this release.


Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

modeling
freeze, guess, link, paramprompt, set_par, thaw, unlink