Skip to main content
`Ctrl`+`K`

# Lorentz2D

class astropy.modeling.functional_models.Lorentz2D(amplitude=1, x_0=0, y_0=0, fwhm=1, **kwargs)

  Bases: `Fittable2DModel`

  Two-dimensional Lorentzian model.

  Parameters:
    amplitude `python:float` or `Quantity`.

      Peak value.

    x_0 `python:float` or `Quantity`.

      Position of the peak in x.

    y_0 `python:float` or `Quantity`.

      Position of the peak in y.

    fwhm `python:float` or `Quantity`.

      Full width at half maximum (FWHM).

  See also

  `Lorentz1D`, `Gaussian2D`, `Moffat2D`

  Notes

  The `x`, `y`, `x_0`, `y_0`, and `fwhm` inputs must have compatible units or as unitless numbers.

  Model formula:

  \[f(x, y) = \frac{A \gamma^{2}}{\gamma^{2} + \left(x - x_{0}\right)^2 + \left(y - y_{0}\right)^{2}}\]

  where \(\gamma\) is the half width at half maximum (HWHM), which is half the FWHM.

  The area under the `Lorentz2D` profile is infinite, therefore this model profile cannot be normalized to sum to 1.

  Examples

      import numpy as np
      import matplotlib.pyplot as plt

      from astropy.modeling.models import Lorentz2D

      plt.figure()
      model = Lorentz2D(x_0=12, y_0=12, fwhm=3)
      yy, xx = np.mgrid[:25, :25]
      data = model(xx, yy)

      plt.imshow(data)
      plt.show()

  (`png`, `svg`, `pdf`)

  Attributes Summary

  `amplitude` |
  `fwhm` |
  `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` | Names of the parameters that describe models of this type.
  `x_0` |
  `y_0` |

  Methods Summary

  `evaluate`(x, y, amplitude, x_0, y_0, fwhm) | Two dimensional Lorentzian model function.
  `fit_deriv`(x, y, amplitude, x_0, y_0, fwhm) | Two dimensional Lorentzian model derivative with respect to parameters.

  Attributes Documentation

  amplitude = Parameter('amplitude', value=1.0)
  fwhm = Parameter('fwhm', value=1.0)
  input_units
  param_names = ('amplitude', 'x_0', 'y_0', 'fwhm')

    Names of the parameters that describe models of this type.

    The parameters in this tuple are in the same order they should be passed in when initializing a model of a specific type. Some types of models, such as polynomial models, have a different number of parameters depending on some other property of the model, such as the degree.

    When defining a custom model class the value of this attribute is automatically set by the `Parameter` attributes defined in the class body.

  x_0 = Parameter('x_0', value=0.0)
  y_0 = Parameter('y_0', value=0.0)

  Methods Documentation

  static evaluate(x, y, amplitude, x_0, y_0, fwhm)

    Two dimensional Lorentzian model function.

  static fit_deriv(x, y, amplitude, x_0, y_0, fwhm)

    Two dimensional Lorentzian model derivative with respect to parameters.