Voigt profile with astronomical parameterization

class PyAstronomy.modelSuite.VoigtAstroP

Astronomical parameterization of Voigt profile.

This class provides a convenient parameterization of the Voigt profile, frequently used in astronomy. In particular, the line is parameterized in terms of wavelength, Doppler parameter, damping width, and oscillator strength.

If the velocity components of the constituents follow independent Gaussian distributions with standard deviation \(\sigma\) in all three dimensions of space

\[v_{x,y,z} \sim N(0,\sigma^2) \; ,\]

the mode of the distribution of absolute velocity, \(v_a = \sqrt{v_x^2 + v_y^2 + v_z^2}\) is given by \(v_{mode} = \sqrt{2}\sigma\). This is the velocity referred to as the Doppler parameter, b. Consequently, the velocity dispersion in any individual dimension, i.e., the standard deviation of the Gaussian velocity distribution, is related to the Doppler parameter by \(\sigma = b/\sqrt{2}\). For zero damping width (gamma), the resulting model line is, therefore, a Gaussian with a standard deviation of \(\sigma = b/\sqrt{2}\) in velocity units.

Instrumental resolution can be applied via the parameter R. The instrumental profile is assumed to be a Gaussian with FWHM of w0/R. The additional broadening is implemented by using an internal, effective Doppler parameter. The case R=0 corresponds to infinite instrumental resolution (i.e., no additional broadening).

Fit parameters:

w0

Wavelength of the transition

A

b

Doppler parameter (corresponds to sqrt(2) times the velocity dispersion).

km/s

gamma

Damping width (full width at half maximum of the Lorentzian)

cm

f

Oscillator strength (unitless)

R

Instrumental resolution

Methods

FWHM()

Estimate FWHM

MCMCautoParameters(ranges[, picky, ...])

Convenience function to generate parameters for MCMC fit.

addConditionalRestriction(*args)

Define a conditional restriction.

assignValue(specval)

Assign new values to variables.

assignValues(specval)

Assign new values to variables.

autoFitMCMC(x, y, ranges[, picky, stepsize, ...])

Convenience function to using auto-generated sampling parameters in MCMC.

availableParameters()

Provides a list of existing parameters.

bl()

Doppler width in cm

delRestriction(parName)

Delete restriction

description([parenthesis])

Returns a description of the model based on the names of the individual components.

errorConfInterval(par[, dstat, statTol, ...])

Calculate confidence interval for a parameter.

evaluate(x)

Evaluate the absorption-line profile.

fit(x, y[, yerr, X0, minAlgo, mAA, ...])

Carries out a fit.

fitEMCEE([x, y, yerr, nwalker, priors, ...])

MCMC sampling using emcee package.

fitMCMC(x, y, X0, Lims, Steps[, yerr, ...])

Carry out MCMC fit/error estimation.

freeParamNames()

Get the names of the free parameters.

freeParameters()

Get names and values of free parameters.

freeze(specifiers)

Consider variables free to float.

frozenParameters()

Get names and values of frozen parameters.

getRelationsOf(specifier)

Return relations of a variable.

getRestrictions()

Get all restrictions.

hasVariable(specifier)

Determine whether the variable exists.

numberOfFreeParams()

Get number of free parameters.

parameterSummary([toScreen, prefix, sorting])

Writes a summary of the parameters in text form.

parameters()

Obtain parameter names and values.

relate(dependentVar, independentVars[, func])

Define a relation.

removeConditionalRestriction(*args)

Remove an existing conditional constraint.

renameVariable(oldName, newName)

Change name of variable.

restoreState(resource)

Restores parameter values from file or dictionary.

saveState(*args, **kwargs)

Save the state of the fitting object.

setObjectiveFunction([miniFunc])

Define the objective function.

setPenaltyFactor(penalFac)

Change the penalty factor.

setRestriction(restricts)

Define restrictions.

setRootName(root[, rename])

Define the root name of the model.

showConditionalRestrictions(**kwargs)

Show conditional restrictions.

steppar(pars, ranges[, extractFctVal, quiet])

Allows to step a parameter through a specified range.

thaw(specifiers)

Consider variables fixed.

untie(parName[, forceFree])

Remove all relations of parameter parName, i.e., the parameter is not dependend on other parameters.

updateModel()

Recalculate the model using current settings.

FWHM()

Estimate FWHM

Applies same approximation is Voigt1d

Returns
FWHMfloat

FWHM of line profile in wavelength units [A]

bl()

Doppler width in cm

evaluate(x)

Evaluate the absorption-line profile.

Parameters
xarray of floats

Contains the wavelength values in Angstrom.

Returns
Modelarray of floats

Return the cross-section in cm^2.

Example

from PyAstronomy import modelSuite as ms
import numpy as np
import matplotlib.pylab as plt

# Obtain an object of type VoigtAstroP ...
v = ms.VoigtAstroP()
# ... and set some parameters
v["b"] = 87.7
v["f"] = 0.5
v["w0"] = 1214.0
# Damping constant [cm]
v["gamma"] = 2e-9

# Generate wavelength axis ...
wvl = np.linspace(1212., 1216., 200)
# ... and evaluate model
m = v.evaluate(wvl)

# Plot result
plt.plot(wvl, m, 'b.-')
plt.show()

Example: Adding instrumental resolution

from PyAstronomy import modelSuite as ms
import numpy as np
import matplotlib.pylab as plt

# Obtain an object of type VoigtAstroP ...
v = ms.VoigtAstroP()
# ... and set some parameters
v["b"] = 40.7
v["f"] = 0.5
v["w0"] = 1214.0
# Damping constant [cm]
v["gamma"] = 2e-9

# Generate wavelength axis ...
wvl = np.linspace(1212., 1216., 200)
# ... and evaluate model
m = v.evaluate(wvl)

# Add (Gaussian) instrumental broadening with resolution 5000
v["R"] = 5000
mr = v.evaluate(wvl)

# Plot result
plt.plot(wvl, m, 'b.-', label="R = inf")
plt.plot(wvl, mr, 'r.-', label="R = 5000")
plt.legend()
plt.show()