# Voigt1D

class sherpa.astro.models.Voigt1D(name='voigt1d')[source] [edit on github]

One dimensional Voigt profile.

The Voigt profile is a convolution between a Gaussian distribution a Cauchy-Lorentz distribution , . It is often used in analyzing spectroscopy data.

New in version 4.12.2.

fwhm_g

The full-width half-maximum (FWHM) of the Gaussian distribution.

fwhm_l

The full-width half-maximum of the Lorentzian distribution.

pos

The center of the profile.

ampl

The amplitude of the profile.

`NormGauss1D`, `Lorentz1D`, `PseudoVoigt1D`

Notes

Following , the Voigt profile can be written as:

```f(x) = ampl * Re[w(z)] / (sqrt(2 * PI) * sigma)
```

where Re[w(z)] is the real part of the Faddeeva function  and sigma and gamma are parameters of the Gaussian and Lorentzian model respectively:

```z = (x - pos + i * gamma) / (sqrt(2) * sigma)
sigma = fhwm_g / sqrt(8 * log(2))
gamma = fwhm_l / 2
```

One common simplification is to tie the sigma and gamma parameters together, which can be achieved by linking the fwhm_l parameter to fwhm_g with the following equation:

```fwhm_l = fwhm_g / sqrt(2 * log(2))
```

An approximation for the FWHM of the profile, taken from , is

0.5346 fwhm_l + sqrt(0.2166 fwhm_l^2 + fwhm_g^2)

References

Examples

Force the widths of the Gaussian and Lorentzian components to be the same:

```>>> mdl = Voigt1D()
>>> mdl.fwhm_l = mdl.fwhm_g / np.sqrt(2 * np.log(2))
```

Attributes Summary

 `cache` The maximum size of the cache. `ndim` A one-dimensional model. `thawedparhardmaxes` The hard maximum values for the thawed parameters. `thawedparhardmins` The hard minimum values for the thawed parameters. `thawedparmaxes` The maximum limits of the thawed parameters. `thawedparmins` The minimum limits of the thawed parameters. `thawedpars` The thawed parameters of the model.

Methods Summary

 `apply`(outer, *otherargs, **otherkwargs) Clear the cache. Display the cache status. `calc`(*args, **kwargs) Evaluate the model on a grid. Freeze any thawed parameters of the model. `guess`(dep, *args, **kwargs) Guess the parameter values. `regrid`(*args, **kwargs) The class RegriddableModel1D allows the user to evaluate in the requested space then interpolate onto the data space. Reset the parameter values. `set_center`(pos, *args, **kwargs) `startup`([cache]) Called before a model may be evaluated multiple times. Called after a model may be evaluated multiple times. Thaw any frozen parameters of the model.

Attributes Documentation

cache = 5

The maximum size of the cache.

ndim = 1

A one-dimensional model.

thawedparhardmaxes

The hard maximum values for the thawed parameters.

The minimum and maximum range of the parameters can be changed with thawedparmins and thawedparmaxes but only within the range given by thawedparhardmins to thawparhardmaxes.

thawedparhardmins

The hard minimum values for the thawed parameters.

The minimum and maximum range of the parameters can be changed with thawedparmins and thawedparmaxes but only within the range given by thawedparhardmins to thawparhardmaxes.

thawedparmaxes

The maximum limits of the thawed parameters.

Get or set the maximum limits of the thawed parameters of the model as a list of numbers. If there are no thawed parameters then [] is used. The ordering matches that of the pars attribute.

`thawedpars`, `thawedarhardmaxes`, `thawedparmins`

thawedparmins

The minimum limits of the thawed parameters.

Get or set the minimum limits of the thawed parameters of the model as a list of numbers. If there are no thawed parameters then [] is used. The ordering matches that of the pars attribute.

`thawedpars`, `thawedarhardmins`, `thawedparmaxes`

thawedpars

The thawed parameters of the model.

Get or set the thawed parameters of the model as a list of numbers. If there are no thawed parameters then [] is used. The ordering matches that of the pars attribute.

Methods Documentation

apply(outer, *otherargs, **otherkwargs) [edit on github]
cache_clear() [edit on github]

Clear the cache.

cache_status() [edit on github]

Display the cache status.

Information on the cache - the number of “hits”, “misses”, and “requests” - is displayed at the INFO logging level.

Example

```>>> pl.cache_status()
powlaw1d.pl                size:    5  hits:   633  misses:   240  check=  873
```
calc(*args, **kwargs)[source] [edit on github]

Evaluate the model on a grid.

Parameters:
• p (sequence of numbers) – The parameter values to use. The order matches the `pars` field.

• *args – The model grid. The values can be scalar or arrays, and the number depends on the dimensionality of the model and whether it is being evaluated over an integrated grid or at a point (or points).

freeze() [edit on github]

Freeze any thawed parameters of the model.

get_center()[source] [edit on github]
guess(dep, *args, **kwargs)[source] [edit on github]

Guess the parameter values.

The fwhm_g and fwhm_l parameters are set to the same value.

regrid(*args, **kwargs) [edit on github]

The class RegriddableModel1D allows the user to evaluate in the requested space then interpolate onto the data space. An optional argument ‘interp’ enables the user to change the interpolation method.

Examples

```>>> import numpy as np
>>> from sherpa.models.basic import Box1D
>>> mybox = Box1D()
>>> request_space = np.arange(1, 10, 0.1)
>>> regrid_model = mybox.regrid(request_space, interp=linear_interp)
```
reset() [edit on github]

Reset the parameter values.

Restores each parameter to the last value it was set to. This allows the parameters to be easily reset after a fit.

set_center(pos, *args, **kwargs)[source] [edit on github]
startup(cache=False) [edit on github]

Called before a model may be evaluated multiple times.

Parameters:

cache (bool, optional) – Should a cache be used when evaluating the models.

teardown() [edit on github]

Called after a model may be evaluated multiple times.

thaw() [edit on github]

Thaw any frozen parameters of the model.

Those parameters that are marked as “always frozen” are skipped.