# Gaussian2D¶

class astropy.modeling.functional_models.Gaussian2D(amplitude=1, x_mean=0, y_mean=0, x_stddev=None, y_stddev=None, theta=None, cov_matrix=None, **kwargs)[source]

Two dimensional Gaussian model.

Parameters: Other Parameters: amplitude : float Amplitude of the Gaussian. x_mean : float Mean of the Gaussian in x. y_mean : float Mean of the Gaussian in y. x_stddev : float or None Standard deviation of the Gaussian in x before rotating by theta. Must be None if a covariance matrix (cov_matrix) is provided. If no cov_matrix is given, None means the default value (1). y_stddev : float or None Standard deviation of the Gaussian in y before rotating by theta. Must be None if a covariance matrix (cov_matrix) is provided. If no cov_matrix is given, None means the default value (1). theta : float, optional Rotation angle in radians. The rotation angle increases counterclockwise. Must be None if a covariance matrix (cov_matrix) is provided. If no cov_matrix is given, None means the default value (0). cov_matrix : ndarray, optional A 2x2 covariance matrix. If specified, overrides the x_stddev, y_stddev, and theta defaults. fixed : a dict, optional A dictionary {parameter_name: boolean} of parameters to not be varied during fitting. True means the parameter is held fixed. Alternatively the fixed property of a parameter may be used. tied : dict, optional A dictionary {parameter_name: callable} of parameters which are linked to some other parameter. The dictionary values are callables providing the linking relationship. Alternatively the tied property of a parameter may be used. bounds : dict, optional A dictionary {parameter_name: value} of lower and upper bounds of parameters. Keys are parameter names. Values are a list or a tuple of length 2 giving the desired range for the parameter. Alternatively, the min and max properties of a parameter may be used. eqcons : list, optional A list of functions of length n such that eqcons[j](x0,*args) == 0.0 in a successfully optimized problem. ineqcons : list, optional A list of functions of length n such that ieqcons[j](x0,*args) >= 0.0 is a successfully optimized problem.

Notes

Model formula:

$f(x, y) = A e^{-a\left(x - x_{0}\right)^{2} -b\left(x - x_{0}\right) \left(y - y_{0}\right) -c\left(y - y_{0}\right)^{2}}$

Using the following definitions:

\begin{align}\begin{aligned}a = \left(\frac{\cos^{2}{\left (\theta \right )}}{2 \sigma_{x}^{2}} + \frac{\sin^{2}{\left (\theta \right )}}{2 \sigma_{y}^{2}}\right)\\b = \left(\frac{\sin{\left (2 \theta \right )}}{2 \sigma_{x}^{2}} - \frac{\sin{\left (2 \theta \right )}}{2 \sigma_{y}^{2}}\right)\\c = \left(\frac{\sin^{2}{\left (\theta \right )}}{2 \sigma_{x}^{2}} + \frac{\cos^{2}{\left (\theta \right )}}{2 \sigma_{y}^{2}}\right)\end{aligned}\end{align}
If using a cov_matrix, the model is of the form:
$f(x, y) = A e^{-0.5 \left(\vec{x} - \vec{x}_{0}\right)^{T} \Sigma^{-1} \left(\vec{x} - \vec{x}_{0}\right)}$

where $$\vec{x} = [x, y]$$, $$\vec{x}_{0} = [x_{0}, y_{0}]$$, and $$\Sigma$$ is the covariance matrix:

$\begin{split}\Sigma = \left(\begin{array}{ccc} \sigma_x^2 & \rho \sigma_x \sigma_y \\ \rho \sigma_x \sigma_y & \sigma_y^2 \end{array}\right)\end{split}$

$$\rho$$ is the correlation between x and y, which should be between -1 and +1. Positive correlation corresponds to a theta in the range 0 to 90 degrees. Negative correlation corresponds to a theta in the range of 0 to -90 degrees.

See [1] for more details about the 2D Gaussian function.

References

Attributes Summary

 amplitude input_units This property is used to indicate what units or sets of units the evaluate method expects, and returns a dictionary mapping inputs to units (or None if any units are accepted). param_names theta x_fwhm Gaussian full width at half maximum in X. x_mean x_stddev y_fwhm Gaussian full width at half maximum in Y. y_mean y_stddev

Methods Summary

 evaluate(x, y, amplitude, x_mean, y_mean, …) Two dimensional Gaussian function fit_deriv(x, y, amplitude, x_mean, y_mean, …) Two dimensional Gaussian function derivative with respect to parameters

Attributes Documentation

amplitude
input_units

This property is used to indicate what units or sets of units the evaluate method expects, and returns a dictionary mapping inputs to units (or None if any units are accepted).

Model sub-classes can also use function annotations in evaluate to indicate valid input units, in which case this property should not be overridden since it will return the input units based on the annotations.

param_names = ('amplitude', 'x_mean', 'y_mean', 'x_stddev', 'y_stddev', 'theta')
theta
x_fwhm

Gaussian full width at half maximum in X.

x_mean
x_stddev
y_fwhm

Gaussian full width at half maximum in Y.

y_mean
y_stddev

Methods Documentation

static evaluate(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta)[source]

Two dimensional Gaussian function

static fit_deriv(x, y, amplitude, x_mean, y_mean, x_stddev, y_stddev, theta)[source]

Two dimensional Gaussian function derivative with respect to parameters
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 1, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5246886610984802, "perplexity": 3500.813272625576}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": false}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2019-09/segments/1550247496855.63/warc/CC-MAIN-20190220230820-20190221012820-00319.warc.gz"}