MapLines.tools.models¶
Spectral line models used by MapLines.
MapLines.tools.models¶
Spectral line models used by MapLines.
This module defines the spectral models used to fit emission lines in astronomical spectra. The models are used by the MCMC sampler to evaluate the likelihood of the observed data given a set of model parameters.
Two main levels of modeling are implemented:
emission_line_model Computes individual emission-line profiles (Gaussian, Lorentzian, Voigt, or skewed Gaussian).
line_model Builds the full spectral model combining multiple emission lines, optional outflow components, continuum power-law emission, and FeII templates.
These models are used in combination with the fitting routines in
MapLines.tools.line_fit and the likelihood functions defined in
MapLines.tools.priors.
- MapLines.tools.models.emission_line_model(x, xo=[5100], A=[1.0], dv=[0.0], fwhm=[200.0], alph=[0.0], gam=[0.0], skew=False, lorentz=False, voigt=False)[source]¶
Compute emission-line profiles.
This function generates emission-line profiles for a set of spectral lines using different profile shapes (Gaussian, skewed Gaussian, Lorentzian, or Voigt).
- Parameters:
x (array-like) – Wavelength grid where the model is evaluated.
xo (list of float) – Rest-frame wavelengths of the emission lines.
A (list of float) – Amplitudes of each emission-line component.
dv (list of float) – Velocity shifts relative to the rest-frame wavelength (km/s).
fwhm (list of float) – Full width at half maximum (km/s) of each line.
alph (list of float) – Skewness parameter (used when
skew=True).gam (list of float) – Lorentzian width parameter for Voigt profiles.
skew (bool) – Use skewed Gaussian profiles.
lorentz (bool) – Use Lorentzian profiles.
voigt (bool) – Use Voigt profiles.
- Returns:
List containing the model profile of each emission line.
- Return type:
list of ndarray
Notes
The line width is converted from velocity space (km/s) to wavelength dispersion using:
sigma = FWHM / c * lambda / (2 * sqrt(2 ln 2))
where
cis the speed of light.
- MapLines.tools.models.line_model(theta, waves0, fac0, facN0, velfac0, velfacN0, fwhfac0, fwhfacN0, names0, n_lines, vals, x=0, powlaw=False, feii=False, data=None, ret_com=False, skew=False, lorentz=False, outflow=False, voigt=False)[source]¶
Construct the full spectral model for an emission-line complex.
This function combines multiple emission-line components into a single spectral model. The parameters are provided as a vector (
theta) sampled by the MCMC fitting procedure.The model may include:
Narrow emission lines
Optional outflow components
Power-law continuum
FeII emission templates
- Parameters:
theta (array-like) – Parameter vector defining amplitudes, velocities, widths, and additional model parameters.
waves0 (list) – Rest-frame wavelengths of emission lines.
fac0 (list) – Scaling relations between line amplitudes.
facN0 (list) – Scaling relations between line amplitudes.
velfac0 (list) – Relations between velocity parameters.
velfacN0 (list) – Relations between velocity parameters.
fwhfac0 (list) – Relations between line widths.
fwhfacN0 (list) – Relations between line widths.
names0 (list) – Names of emission lines.
n_lines (int) – Number of emission lines in the model.
vals (list) – Names of free parameters.
x (ndarray) – Wavelength grid where the model is evaluated.
Components (Optional)
-------------------
powlaw (bool) – Include a power-law continuum component.
feii (bool) – Include FeII emission templates.
outflow (bool) – Include outflow components for emission lines.
skew (bool) – Use skewed Gaussian profiles.
lorentz (bool) – Use Lorentzian profiles.
voigt (bool) – Use Voigt profiles.
- Returns:
If
ret_com=False, returns the full model spectrum.If
ret_com=True, returns a list containing: - total model spectrum - individual emission-line components - optional continuum and FeII components- Return type:
ndarray or list
Notes
This function is the core spectral model evaluated during the MCMC sampling performed in
MapLines.tools.mcmc.