Implements a set of line profile parameterizations.

## Revision history¶

25 May 2017: Original implementation by K. Westfall (KBW)

class mangadap.util.lineprofiles.FFTGaussianLSF(p=None, dx=None, pixel=True)[source]

Define a Gaussian line profile by first constructing the analytic FFT of the profile and then returning the inverse real FFT. See ppxf_util.emline by M. Cappellari. The sampling must be uniform in $$x$$.

Parameters: p (array-like) – (Optional) Input parameters ordered as the total integral of the profile, the profile center, and the profile standard deviation. Assumed to be (1.0, 0.0, 1.0) by default. dx (float) – (Optional) Sampling width. Default is 1. pixel (bool) – (Optional) Flag to produce profile integrated over the sampling width.
p

Most recently used parameters

Type: numpy.ndarray
dx

Assumed sampling.

Type: float
pixel

Flag to produce profile integrated over the sampling width.

Type: bool
Raises: ValueError – Raised if the provided parameter vector is not 3 elements long.
sample(x)[source]

Sample the profile.

Warning

Does not check if the provided $$x$$ values are sampled at dx.

Parameters: x (array-like) – Independent variable.
class mangadap.util.lineprofiles.GaussianLSF(p=None)[source]

Bases: object

Define a Gaussian line profile, sampled over the width of the sampling step, parameterized by its integral ($$F$$), center ($$\mu$$), and standard deviation ($$\sigma$$). I.e:

$\mathcal{N}(x|f,\mu,\sigma) = \frac{f}{\sqrt{2\pi}\sigma} \exp\left(\frac{-\Delta^2}{2\sigma^2}\right)$

where $$\Delta = x-\mu$$. The coordinate vector $$x$$ does not need to be uniformly sampled.

Parameters: p (array-like) – (Optional) Input parameters ordered as the total integral of the profile, the profile center, and the profile standard deviation. Assumed to be (1.0, 0.0, 1.0) by default.
p

Most recently used parameters

Type: numpy.ndarray
Raises: ValueError – Raised if the provided parameter vector is not 3 elements long.
static npar()[source]
parameters_from_moments(mom0, mom1, mom2)[source]

Provided the 0th, 1st, and 2nd moments, produce a set of parameters for the profile.

sample(x)[source]

Sample the profile.

Parameters: x (array-like) – Independent variable.
set_par(p)[source]

Set the internal parameters to the provided set.

Parameters: p (array-like) – LSF parameters. ValueError – Raised if the provided parameter vector is not 3 elements long.
class mangadap.util.lineprofiles.GaussianLineProfile(zmom=1.0, mean=0.0, sigma=1.0, **kwargs)[source]

Bases: astropy.modeling.core.FittableModel

Define a Gaussian line profile as parameterized by its zeroth moment, mean, and standard deviation:

$\mathcal{N}(x|f,\mu,\sigma) = \frac{f}{\sqrt{2\pi}\sigma} \exp\left(\frac{-(x-\mu)^2}{2\sigma^2}\right)$

The base class is astropy.modeling.FittableModel, which facilitates its use in combining multiple components and other models in the astropy.modeling suite.

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 54
_abc_registry = <_weakrefset.WeakSet object>
_fix_inputs(right)
_is_dynamic = False
_parameters_ = {'mean': Parameter('mean', value=0.0), 'sigma': Parameter('sigma', value=1.0), 'zmom': Parameter('zmom', value=1.0)}
static evaluate(x, zmom, mean, sigma)[source]

Evaluate the model on some input variables.

static fit_deriv(x, zmom, mean, sigma)[source]
static fix_flux()[source]
static fix_mean()[source]
static fix_stddev()[source]
static flux(zmom, mean, sigma)[source]
static flux_err(zmom, mean, sigma, zmome, meane, sigmae)[source]
inputs = ('x',)
static integral(zmom, mean, sigma)[source]
mean = Parameter('mean', value=0.0)
static mean_indx()[source]
static moment(order, zmom, mean, sigma)[source]
static moment_err(order, zmom, mean, sigma, zmome, meane, sigmae)[source]
outputs = ('y',)
param_names = ('zmom', 'mean', 'sigma')
static scale_flux(zmom, mean, sigma, fac)[source]
static scale_stddev(zmom, mean, sigma, fac)[source]
static shift_mean(zmom, mean, sigma, shift)[source]
sigma = Parameter('sigma', value=1.0)
zmom = Parameter('zmom', value=1.0)
class mangadap.util.lineprofiles.IntegratedGaussianLSF(p=None, dx=None)[source]

Define a Gaussian line profile, integrated over the width of the sampling step, parameterized by its integral ($$F$$), center ($$\mu$$), and standard deviation ($$\sigma$$). I.e:

$\mathcal{N}(x|F,\mu,\sigma) = \frac{F}{2} \left[ {\rm erf}\left(\frac{\Delta+\delta_x/2}{\sqrt{2}\sigma}\right) - {\rm erf}\left(\frac{\Delta-\delta_x/2}{\sqrt{2}\sigma}\right)\right]$

where $${\rm erf}(x)$$ is the error function, $$\Delta = x-\mu$$, and $$\delta_x$$ is the sampling step. The sampling must be uniform in $$x$$.

Parameters: p (array-like) – (Optional) Input parameters ordered as the total integral of the profile, the profile center, and the profile standard deviation. Assumed to be (1.0, 0.0, 1.0) by default. dx (float) – (Optional) Sampling width. Default is 1.
p

Most recently used parameters

Type: numpy.ndarray
dx

Assumed sampling.

Type: float
Raises: ValueError – Raised if the provided parameter vector is not 3 elements long.
sample(x)[source]

Sample the profile.

Warning

Does not check if the provided $$x$$ values are sampled at dx.

Parameters: x (array-like) – Independent variable.
class mangadap.util.lineprofiles.NCompLineProfile(ncomp, par=None, err=None, profile=<class 'mangadap.util.lineprofiles.GaussianLineProfile'> Name: GaussianLineProfile N_inputs: <property object> N_outputs: <property object> Fittable parameters: ('zmom', 'mean', 'sigma'))[source]

Bases: object

Construct a single line profile from many components with the same profile parameterization.

_mom1_integrand(x)[source]
_mom2_integrand(x)[source]
_quick_sample(x)[source]

Sample without providing/checking new input parameters.

assign_err(err)[source]
assign_par(par)[source]
fix_flux()[source]
fix_mean()[source]
fix_stddev()[source]
flux(par=None)[source]
flux_err(par=None, err=None)[source]
mean_indx()[source]
moment(order=0, par=None)[source]

Todo

impose some reasonable limits for the integrals

moment_err(order=0, par=None, err=None)[source]

Todo

impose some reasonable limits for the integrals

sample(x, par=None)[source]
scale_flux(fac)[source]
scale_stddev(fac)[source]
set_flux(flx)[source]
set_mean(mean)[source]
set_stddev(stddev)[source]
shift_mean(shift)[source]