VoigtFit Interface

class DataSet

class Component

class Line

class Region

module voigt

The module contains functions to evaluate the optical depth, to convert this to observed transmission and to convolve the observed spectrum with the instrumental profile.

voigt.H(a, x)[source]

Voigt Profile Approximation from T. Tepper-Garcia 2006, 2007.

voigt.Voigt(wl, l0, f, N, b, gam, z=0)[source]

Calculate the optical depth Voigt profile.

Parameters:
wl : array_like, shape (N)

Wavelength grid in Angstroms at which to evaluate the optical depth.

l0 : float

Rest frame transition wavelength in Angstroms.

f : float

Oscillator strength.

N : float

Column density in units of cm^-2.

b : float

Velocity width of the Voigt profile in cm/s.

gam : float

Radiation damping constant, or Einstein constant (A_ul)

z : float

The redshift of the observed wavelength grid l.

Returns:
tau : array_like, shape (N)

Optical depth array evaluated at the input grid wavelengths l.

voigt.convolve_numba[source]

Define convolution function for a wavelength dependent kernel.

Parameters:
P : array_like, shape (N)

Intrinsic line profile.

kernel : np.array, shape (N, M)

Each row of the kernel corresponds to the wavelength dependent line-spread function (LSF) evaluated at each pixel of the input profile P. Each LSF must be normalized!

Returns:
P_con : np.array, shape (N)

Resulting profile after performing convolution with kernel.

Notes

This function is decorated by the jit decorator from `numba`_ in order to speed up the calculation.

voigt.convolve_profile(profile, width)[source]

Convolve with constant kernel width in pixels!

voigt.evaluate_continuum(x, pars, reg_num)[source]

Evaluate the continuum model using Chebyshev polynomials. All regions are fitted with the same order of polynomials.

Parameters:
x : array_like, shape (N)

Input wavelength grid in Ångstrøm.

pars : dict(lmfit.Parameters_)

An instance of lmfit.Parameters_ containing the Chebyshev coefficients for each region.

reg_num : int

The region number, i.e., the index of the region in the list VoigtFit.DataSet.regions.

Returns:
cont_model : array_like, shape (N)

The continuum Chebyshev polynomial evaluated at the input wavelengths x.

voigt.evaluate_profile(x, pars, lines, kernel, z_sys=None, sampling=3, kernel_nsub=1)[source]

Evaluate the observed Voigt profile. The calculated optical depth, tau, is converted to observed transmission, f:

\[f = e^{-\tau}\]

The observed transmission is subsequently convolved with the instrumental broadening profile assumed to be Gaussian with a full-width at half maximum of res. The resolving power is assumed to be constant in velocity space.

Parameters:
x : array_like, shape (N)

Wavelength array in Ångstrøm on which to evaluate the profile.

pars : dict(lmfit.Parameters_)

An instance of lmfit.Parameters_ containing the line parameters.

lines : list(Line)

List of lines to evaluate. Should be a list of Line objects.

kernel : np.array, shape (N, M) or float

The convolution kernel for each wavelength pixel. If an array is given, each row of the array must specify the line-spread function (LSF) at the given wavelength pixel. The LSF must be normalized! If a float is given, the resolution FWHM is given in km/s (c/R). In this case the spectral resolution is assumed to be constant in velocity space.

z_sys : float or None

The systemic redshift, used to determine an effective wavelength range within which to evaluate the profile. This is handy when fitting very large regions, such as HI and metal lines together.

sampling : integer [default = 3]

The subsampling factor used for defining the input logarithmically space wavelength grid. The number of pixels in the evaluation will be sampling * N, where N is the number of input pixels. The final profile will be interpolated back onto the original wavelength grid defined by x.

kernel_nsub : integer

Kernel subsampling factor relative to the data. This is only used if the resolution is given as a LSF file.

Returns:
profile_obs : array_like, shape (N)

Observed line profile convolved with the instrument profile.

voigt.fwhm_to_pixels(wl, res_wl)[source]

Convert spectral resolution in wavelength to pixels R = lambda / dlambda, where dlambda is the FWHM

voigt.resvel_to_pixels(wl, res)[source]

Convert spectral resolution in km/s to pixels

module output