load_conv

sherpa.astro.ui.load_conv(modelname, filename_or_model, *args, **kwargs)

Load a 1D convolution model.

The convolution model can be defined either by a data set, read from a file, or an analytic model, using a Sherpa model instance. A source model can be convolved with this model by including modelname in the set_model call, using the form:

modelname(modelexpr)
Parameters:
  • modelname (str) – The identifier for this PSF model.
  • filename_or_model (str or model instance) – This can be the name of an ASCII file or a Sherpa model component.
  • args – Arguments for unpack_data if filename_or_model is a file.
  • kwargs – Keyword arguments for unpack_data if filename_or_model is a file.

See also

delete_psf()
Delete the PSF model for a data set.
load_psf()
Create a PSF model.
load_table_model()
Load tabular data and use it as a model component.
set_full_model()
Define the convolved model expression for a data set.
set_model()
Set the source model expression for a data set.
set_psf()
Add a PSF model to a data set.

Examples

Create a 1D data set, assign a box model - which is flat between the xlow and xhi values and zero elsewhere - and then display the model values. Then add in a convolution component by a gaussian and overplot the resulting source model with two different widths.

>>> dataspace1d(-10, 10, 0.5, id='tst', dstype=Data1D)
>>> set_source('tst', box1d.bmdl)
>>> bmdl.xlow = -2
>>> bmdl.xhi = 3
>>> plot_source('tst')
>>> load_conv('conv', normgauss1d.gconv)
>>> gconv.fwhm = 2
>>> set_source('tst', conv(bmdl))
>>> plot_source('tst', overplot=True)
>>> gconv.fwhm = 5
>>> plot_source('tst', overplot=True)

Create a convolution component called “cmodel” which uses the data in the file “conv.dat”, which should have two columns (the X and Y values).

>>> load_conv('cmodel', 'conv.dat')