pypeit.core.fitting module

Module for fitting codes

class pypeit.core.fitting.PypeItFit(xval=None, yval=None, order=None, x2=None, weights=None, fitc=None, fitcov=None, func=None, minx=None, maxx=None, minx2=None, maxx2=None, gpm=None, success=None)[source]

Bases: DataContainer

General fitting class used by PypeIt.

The datamodel attributes are:

Version: 1.0.0

Attribute

Type

Array Type

Description

fitc

numpy.ndarray

numpy.floating

Fit coefficients

fitcov

numpy.ndarray

numpy.floating

Covariance of the coefficients

func

str

Fit function (polynomial, legendre, chebyshev, polynomial2d, legendre2d)

gpm

numpy.ndarray

numpy.integer

Mask (1=good)

maxx

float

maximum value in the array (or the right limit for a legendre / chebyshev polynomial)

maxx2

float

Same as maxx for the second independent variable x2

minx

float

minimum value in the array (or the left limit for a legendre / chebyshev polynomial)

minx2

float

Same as minx for the second independent variable x2

order

numpy.ndarray

numpy.integer

The order of the polynomial to be used in the fitting. This is a 2d array for 2d fits

success

int

Flag indicating whether fit was successful (success=1) or if it failed (success=0)

weights

numpy.ndarray

numpy.floating

Weights. Often the same as invvar

x2

numpy.ndarray

numpy.floating

x2 inputs, second independent variable

xval

numpy.ndarray

numpy.floating

x inputs

yval

numpy.ndarray

numpy.floating

y inputs

When written to an output-file HDU, all numpy.ndarray elements are bundled into an astropy.io.fits.BinTableHDU, and the other elements are written as header keywords. Any datamodel elements that are None are not included in the output.

_bundle(ext='PYPEITFIT')[source]

Bundle the data in preparation for writing to a fits file.

See pypeit.datamodel.DataContainer._bundle(). Data is always written to a ‘PYPEITFIT’ extension.

property bool_gpm

Generate a bool version of gpm which is int for I/O

Returns:

bool version of self.gpm or None

Return type:

numpy.ndarray or None

calc_fit_rms(apply_mask=True, x2=None)[source]

Simple RMS calculation for the fit on the data.

Parameters:
  • apply_mask (bool, optional) – If true, apply mask to data before calculating RMS.

  • x2 (numpy.ndarray, optional) – x locations for 2D fits

Returns:

Root mean square

Return type:

float

datamodel = {'fitc': {'atype': <class 'numpy.floating'>, 'descr': 'Fit coefficients', 'otype': <class 'numpy.ndarray'>}, 'fitcov': {'atype': <class 'numpy.floating'>, 'descr': 'Covariance of the coefficients', 'otype': <class 'numpy.ndarray'>}, 'func': {'descr': 'Fit function (polynomial, legendre, chebyshev, polynomial2d, legendre2d)', 'otype': <class 'str'>}, 'gpm': {'atype': <class 'numpy.integer'>, 'descr': 'Mask (1=good)', 'otype': <class 'numpy.ndarray'>}, 'maxx': {'descr': 'maximum value in the array (or the right limit for a legendre / chebyshev polynomial)', 'otype': <class 'float'>}, 'maxx2': {'descr': 'Same as maxx for the second independent variable x2', 'otype': <class 'float'>}, 'minx': {'descr': 'minimum value in the array (or the left limit for a legendre / chebyshev polynomial)', 'otype': <class 'float'>}, 'minx2': {'descr': 'Same as minx for the second independent variable x2', 'otype': <class 'float'>}, 'order': {'atype': <class 'numpy.integer'>, 'descr': 'The order of the polynomial to be used in the fitting. This is a 2d array for 2d fits', 'otype': <class 'numpy.ndarray'>}, 'success': {'descr': 'Flag indicating whether fit was successful (success=1) or if it failed (success=0)', 'otype': <class 'int'>}, 'weights': {'atype': <class 'numpy.floating'>, 'descr': 'Weights.  Often the same as invvar', 'otype': <class 'numpy.ndarray'>}, 'x2': {'atype': <class 'numpy.floating'>, 'descr': 'x2 inputs, second independent variable', 'otype': <class 'numpy.ndarray'>}, 'xval': {'atype': <class 'numpy.floating'>, 'descr': 'x inputs', 'otype': <class 'numpy.ndarray'>}, 'yval': {'atype': <class 'numpy.floating'>, 'descr': 'y inputs', 'otype': <class 'numpy.ndarray'>}}

Provides the class data model. This is undefined in the abstract class and should be overwritten in the derived classes.

The format of the datamodel needed for each implementation of a DataContainer derived class is as follows.

The datamodel itself is a class attribute (i.e., it is a member of the class, not just of an instance of the class). The datamodel is a dictionary of dictionaries: Each key of the datamodel dictionary provides the name of a given datamodel element, and the associated item (dictionary) for the datamodel element provides the type and description information for that datamodel element. For each datamodel element, the dictionary item must provide:

  • otype: This is the type of the object for this datamodel item. E.g., for a float or a numpy.ndarray, you would set otype=float and otype=np.ndarray, respectively.

  • descr: This provides a text description of the datamodel element. This is used to construct the datamodel tables in the pypeit documentation.

If the object type is a numpy.ndarray, you should also provide the atype keyword that sets the type of the data contained within the array. E.g., for a floating point array containing an image, your datamodel could be simply:

datamodel = {'image' : dict(otype=np.ndarray, atype=float, descr='My image')}

More advanced examples are given in the top-level module documentation.

Currently, datamodel components are restricted to have otype that are tuple, int, float, numpy.integer, numpy.floating, numpy.ndarray, or astropy.table.Table objects. E.g., datamodel values for otype cannot be dict.

eval(x, x2=None)[source]

Return the evaluated fit at locations x (and x2, if 2D)

Parameters:
Return type:

numpy.ndarray

fit()[source]

Perform the fit, either in 1D or 2D depending on the data and model.

Returns:

Flag indicating whether fit was successful (1) or if it failed (0)

Return type:

int

to_hdu(**kwargs)[source]

Over-ride pypeit.datamodel.DataContainer.to_hdu() to force to a BinTableHDU

See that func for Args and Returns

version = '1.0.0'

Provides the string representation of the class version.

This is currently put to minimal use so far, but will used for I/O verification in the future.

Each derived class should provide a version to guard against data model changes during development.

pypeit.core.fitting.bspline_profile(xdata, ydata, invvar, profile_basis, ingpm=None, upper=5, lower=5, maxiter=25, nord=4, bkpt=None, fullbkpt=None, relative=None, kwargs_bspline={}, kwargs_reject={}, quiet=False)[source]

Fit a B-spline in the least squares sense with rejection to the provided data and model profiles.

Todo

Fully describe procedure.

Parameters:
  • xdata (numpy.ndarray) – Independent variable.

  • ydata (numpy.ndarray) – Dependent variable.

  • invvar (numpy.ndarray) – Inverse variance of ydata.

  • profile_basis (numpy.ndarray) – Model profiles.

  • ingpm (numpy.ndarray, optional) – Input good-pixel mask. Values to fit in ydata should be True.

  • upper (int or float, optional) – Upper rejection threshold in units of sigma, defaults to 5 sigma.

  • lower (int or float, optional) – Lower rejection threshold in units of sigma, defaults to 5 sigma.

  • maxiter (int, optional) – Maximum number of rejection iterations, default 10. Set this to zero to disable rejection.

  • nord (int, optional) – Order of B-spline fit

  • bkpt (numpy.ndarray, optional) – Array of breakpoints to be used for the b-spline

  • fullbkpt (numpy.ndarray, optional) – Full array of breakpoints to be used for the b-spline, without letting the b-spline class append on any extra bkpts

  • relative (numpy.ndarray, optional) – Array of integer indices to be used for computing the reduced chi^2 of the fits, which then is used as a scale factor for the upper,lower rejection thresholds

  • kwargs_bspline (dict, optional) – Keyword arguments used to instantiate pypeit.bspline.bspline

  • kwargs_reject (dict, optional) – Keyword arguments passed to pypeit.core.pydl.djs_reject()

  • quiet (bool, optional) – Suppress output to the screen

Returns:

  • sset (pypeit.bspline.bspline) – Result of the fit.

  • gpm (numpy.ndarray) – Output good-pixel mask which the same size as xdata. The values in this array for the corresponding data are not used in the fit, either because the input data was masked or the data were rejected during the fit, if they are False. Data rejected during the fit (if rejection is performed) are:

    rejected = ingpm & np.logical_not(gpm)
    
  • yfit (numpy.ndarray) – The best-fitting model; shape is the same as xdata.

  • reduced_chi (float) – Reduced chi-square of the best-fitting model.

  • exit_status (int) –

    Indication of the success/failure of the fit. Values are:

    • 0 = fit exited cleanly

    • 1 = maximum iterations were reached

    • 2 = all points were masked

    • 3 = all break points were dropped

    • 4 = Number of good data points fewer than nord

pypeit.core.fitting.bspline_qa(xdata, ydata, sset, gpm, yfit, xlabel=None, ylabel=None, title=None, show=True)[source]

Construct a QA plot of the bspline fit.

Parameters:
  • xdata (numpy.ndarray) – Array with the independent variable. Regardless of shape, data is treated as one-dimensional.

  • ydata (numpy.ndarray) – Array with the dependent variable. Regardless of shape, data is treated as one-dimensional.

  • sset (pypeit.bspline.bspline) – Object with the results of the fit. (First object returned by bspline_profile()).

  • gpm (numpy.ndarray) – Boolean array with the same size as xdata. Measurements rejected during the fit have gpm=False. (Second object returned by bspline_profile()).

  • yfit (numpy.ndarray) – Best-fitting model sampled at xdata. (Third object returned by bspline_profile()).

  • xlabel (str, optional) – Label for the ordinate. If None, none given.

  • ylabel (str, optional) – Label for the abcissa. If None, none given.

  • title (str, optional) – Label for the plot. If None, none given.

  • show (bool, optional) – Plot the result. If False, the axis instance is returned. This is done before any labels or legends are added to the plot.

Returns:

Axes instance with the data, model, and breakpoints. Only returned if show is False.

Return type:

matplotlib.axes.Axes

pypeit.core.fitting.evaluate_fit(fitc, func, x, x2=None, minx=None, maxx=None, minx2=None, maxx2=None)[source]

Return the evaluated fit at the x locations

Parameters:
  • fitc (numpy.ndarray) – Fit coefficients

  • func (str) – Name of the functional form to fit

  • x (numpy.ndarray) – x locations for the evaluation

  • x2 (numpy.ndarray, optional) – x2 locations for 2D fits

  • minx (float, optional) – Minimum x value for the fit used to normalise the x values

  • maxx (float, optional) – Maximum x value for the fit used to normalise the x values

  • minx2 (float, optional) – Minimum x value for the fit used to normalise the x2 values

  • maxx2 (float, optional) – Maximum x value for the fit used to normalise the x2 values

Returns:

Evaluated fit at the x (and x2) locations

Return type:

numpy.ndarray

pypeit.core.fitting.fit_gauss(x_out, y_out, guesses=None, w_out=None, nparam=3, maxfev=0)[source]

Fit a 3 or 4 parameter gaussian

Parameters:
  • x_out (numpy.ndarray) – x values to be fit

  • y_out (numpy.ndarray) – y values to be fit

  • guesses (tuple, optional) – ampl, cent, sigma, [floor] guesses for the Gaussian; each as floats

  • w_out (numpy.ndarray_) – Weights. 1./sqrt(ivar) is expected

  • nparam (int, optional) – Number of parameters in the Gaussian Only options are 3 or 4 where the latter includes a floor in the fit.

  • maxfev (int, optional) – Maximum number of function evaluations. Passed directly to scipy.optimize.curve_fit. Note that setting maxfev to 0 uses the default value set by scipy.optimize.leastsq.

Returns:

Fit coefficients, fit covariance from numpy’s curve_fit

Return type:

tuple

pypeit.core.fitting.gauss_3deg(x, ampl, cent, sigm)[source]

Generate a simple 3-parameter Gaussian

Parameters:
Returns:

Evaluated Gausssian

Return type:

float or numpy.ndarray

pypeit.core.fitting.gauss_4deg(x, b, ampl, cent, sigm)[source]

Generate a simple 4-parameter Gaussian

Parameters:
Returns:

Evaluated Gausssian

Return type:

float or numpy.ndarray

pypeit.core.fitting.guess_gauss(x, y)[source]

Guesses Gaussian parameters with basic stats

Parameters:
Returns:

Amplitude, centroid, sigma, floor all as float

Return type:

tuple

pypeit.core.fitting.iterfit(xdata, ydata, invvar=None, inmask=None, upper=5, lower=5, x2=None, maxiter=10, nord=4, bkpt=None, fullbkpt=None, kwargs_bspline={}, kwargs_reject={})[source]

Iteratively fit a b-spline set to data, with rejection. This is a utility function that allows the bspline to be used via a direct function call.

Parameters:
  • xdata (numpy.ndarray) – Independent variable.

  • ydata (numpy.ndarray) – Dependent variable.

  • invvar (numpy.ndarray, optional) – Inverse variance of ydata. If not set, it will be calculated based on the standard deviation.

  • inmask (numpy.ndarray, optional) – Input Good Pixel Mask for performing the fit. If not set, it will be set to the locus of positive invvar points.

  • upper (int or float, optional) – Upper rejection threshold in units of sigma, defaults to 5 sigma.

  • lower (int or float, optional) – Lower rejection threshold in units of sigma, defaults to 5 sigma.

  • x2 (numpy.ndarray, optional) – Orthogonal dependent variable for 2d fits.

  • maxiter (int, optional) – Maximum number of rejection iterations, default 10. Set this to zero to disable rejection.

  • nord (int, optional) – Order of the b-spline, default 4.

  • bkpt (numpy.ndarray, optional) – Breakpoints for the b-spline, default None.

  • fullbkpt (numpy.ndarray, optional) – Full breakpoints for the b-spline, default None.

  • kwargs_bspline (dict, optional) – Keyword arguments for the b-spline, default {}.

  • kwargs_reject (dict, optional) – Keyword arguments passed to pypeit.core.pydl.djs_reject(), default {}.

Returns:

outputs – A tuple containing the fitted bspline object and an output mask.

Return type:

tuple

pypeit.core.fitting.moffat(x, p0, p1, p2)[source]

Moffat profile This 3 parameter formulation assumes the trace is known

Parameters:
Returns:

Evaluated Moffat

Return type:

float or numpy.ndarray

pypeit.core.fitting.polyfit2d_general(x, y, z, deg, w=None, function='polynomial', minx=None, maxx=None, miny=None, maxy=None)[source]

2D Polynomimal fit

Parameters:
  • x (numpy.ndarray) – x-values

  • y (numpy.ndarray) – y-values

  • z (numpy.ndarray) – value of data at each (x,y) coordinate

  • deg (tuple) – degree of polynomial fit in the form [nx,ny]

  • w (numpy.ndarray, optional) – weights. Often invvar

  • function (str, optional) – 2D function to fit. Options are ‘polynomial’, ‘chebyshev’ or ‘legendre’

  • minx (float, optional) – Minimum x value for the fit used to normalise the x values

  • maxx (float, optional) – Maximum x value for the fit used to normalise the x values

  • miny (float, optional) – Minimum value for the fit used to normalise the y values

  • maxy (float, optional) – Maximum value for the fit used to normalise the y values

Returns:

  • The coefficients of the polynomial fit as a numpy.ndarray

  • minx, maxx, miny, maxy: min and max values for the fit as float

Return type:

tuple

pypeit.core.fitting.robust_fit(xarray, yarray, order, x2=None, function='polynomial', minx=None, maxx=None, minx2=None, maxx2=None, maxiter=10, in_gpm=None, weights=None, invvar=None, lower=None, upper=None, maxdev=None, maxrej=None, groupdim=None, groupsize=None, groupbadpix=False, grow=0, sticky=True, use_mad=True, verbose=True)[source]

A robust fit is performed to the xarray, yarray pairs mask[i] = 1 are good values, if provided.

The underlying method(s) are the numpy fitting routines, e.g. polyfit, legfit.

Parameters:
  • xarray (numpy.ndarray) – independent variable values

  • yarray (numpy.ndarray) – dependent variable values

  • order (int or numpy.ndarray`_) – the order of the polynomial to be used in the fitting. This is an integer for 1d fits and must be a tuple or 2d array for 2d fits (i.e. using x2 as the second independent variable).

  • x2 (numpy.ndarray, optional) – Do a 2d fit? This is the second independent variable for 2d fits.

  • function (str) – which function should be used in the fitting. (valid inputs are: ‘polynomial’, ‘legendre’, ‘chebyshev’, ‘polynomial2d’, ‘legendre2d’)

  • minx (float, optional) – minimum value in the array (or the left limit for a legendre/chebyshev polynomial)

  • maxx (float, optional) – maximum value in the array (or the right limit for a legendre/chebyshev polynomial)

  • minx2 (float, optional) – Same as minx for second independent variable x2.

  • maxx2 (float, optional) – Same as maxx for second independent variable x2.

  • maxiter (int, optional) – Maximum number of rejection iterations, default 10. Set this to zero to disable rejection and simply do a fit.

  • in_gpm (numpy.ndarray, optional) – Input mask. Bad points are marked with a value that evaluates to False. Must have the same number of dimensions as data. Points masked as bad “False” in the inmask will also always evaluate to “False” in the outmask.

  • invvar (float, numpy.ndarray, optional) – Inverse variance of the data, used to reject points based on the values of upper and lower. This can either be a single float for the entire yarray or a ndarray with the same shape as the yarray.

  • weights (numpy.ndarray, optional) –

    shape same as xarray and yarray If input the code will do a weighted fit. If not input, the code will use invvar as the weights. If both invvar and weights are input. The fit will be done with weights, but the rejection will be based on:

    chi = (data-model) * np.sqrt(invvar)
    

  • lower (int or float, optional) – If set, reject points with data < model - lower * sigma, where sigma = 1.0/sqrt(invvar).

  • upper (int or float, optional) – If set, reject points with data > model + upper * sigma, where sigma = 1.0/sqrt(invvar).

  • maxdev (int or float, optional) – If set, reject points with abs(data-model) > maxdev. It is permitted to set all three of lower, upper and maxdev.

  • maxrej (int, numpy.ndarray, optional) – Maximum number of points to reject in this iteration. If groupsize or groupdim are set to arrays, this should be an array as well.

  • groupdim (int, optional) – Dimension along which to group the data; set to 1 to group along the 1st dimension, 2 for the 2nd dimension, etc. If data has shape [100,200], then setting GROUPDIM=2 is equivalent to grouping the data with groupsize=100. In either case, there are 200 groups, specified by [*,i]. NOT WELL TESTED IN PYTHON!

  • groupsize (int, optional) – If this and maxrej are set, then reject a maximum of maxrej points per group of groupsize points. If groupdim is also set, then this specifies sub-groups within that. NOT WELL TESTED IN PYTHON!!

  • groupbadpix (bool, optional) – If set to True, consecutive sets of bad pixels are considered groups, overriding the values of groupsize.

  • grow (int, optional, default = 0) – If set to a non-zero integer, N, the N nearest neighbors of rejected pixels will also be rejected.

  • sticky (bool, optional, default is True) – If set to True, pixels rejected in one iteration remain rejected in subsequent iterations, even if the model changes. If

  • use_mad (bool, optional, default = False) – It set to True, compute the median of the maximum absolute deviation between the data and use this for the rejection instead of the default which is to compute the standard deviation of the yarray - modelfit. Note that it is not possible to specify use_mad=True and also pass in values invvar, and the code will return an error if this is done.

Returns:

Object containing the inputs to the fit and the fit itself

Return type:

PypeItFit or None

pypeit.core.fitting.robust_optimize(ydata, fitfunc, arg_dict, maxiter=10, inmask=None, invvar=None, lower=None, upper=None, maxdev=None, maxrej=None, groupdim=None, groupsize=None, groupbadpix=False, grow=0, sticky=True, use_mad=False, verbose=False, **kwargs_optimizer)[source]

A routine to perform robust optimization. It is completely analogous to robust_fit(), but is more general in that it allows one to fit a more general model using the optimizer of the users choice. If you are fitting simple functions like Chebyshev or Legednre polynomials using a linear least-squares algorithm, you should use robust_fit() instead of this function.

Parameters:
  • ydata (numpy.ndarray) – Data to fit.

  • fitfunc (callable) –

    The callable object used to perform the fitting. The calling sequence must be:

    ret_tuple = fitfunc(ydata, inmask, arg_dict, **kwargs_optimizer)
    

    See the descriptions of ydata, inmask, arg_dict, and kwargs_optimizer. The returned object ret_tuple that can have two or three elements. If it has two elements (result, ymodel):

    • result: Object returned by the specific scipy.optimize method used to perform the fit.

    • ymodel: A numpy.ndarray with the model fit to ydata and with the same shape.

    If it has three elements (result, ymodel, newivar):

    • newivar: new inverse variance for the ydata ymodel comparison, in other words chi = (ydata - ymodel)*np.sqrt(newivar). This functionality allows one to deal with cases where the noise of the data-model comaprison is model dependent.

  • arg_dict (dict) – Dictionary containing the other variables needed to evaluate the model fit.

  • maxiter (int, optional) – Maximum number of rejection iterations. Set this to zero to disable rejection and simply do a fit.

  • inmask (numpy.ndarray, optional) – Input mask. Bad points are marked with a value that evaluates to False. Must have the same number of dimensions as ydata. Points masked as False in inmask will also always evaluate to False in the output mask.

  • invvar (float, numpy.ndarray, optional) – Inverse variance of the data, used to reject points based on the values of upper and lower. This can either be a single float for the entire yarray or a ndarray with the same shape as the yarray.

  • lower (int, float, optional) – If set, reject points with data < model - lower * sigma, where sigma = 1/sqrt(invvar)

  • upper (int, float, optional) – If set, reject points with data > model + upper * sigma, where sigma = 1/sqrt(invvar).

  • maxdev (int or float, optional) – If set, reject points with abs(data-model) > maxdev. It is permitted to set all three of lower, upper and maxdev.

  • maxrej (int, numpy.ndarray, optional) – Maximum number of points to reject in this iteration. If groupsize or groupdim are set to arrays, this should be an array, as well.

  • groupdim (int, optional) – Dimension along which to group the data. Set to 1 to group along the 1st dimension, 2 for the 2nd dimension, etc. For example, if data has shape [100,200], then setting groupdim=2 is equivalent to grouping the data with groupsize=100. In either case, there are 200 groups, specified by [*,i]. This functionality is not well tested in python!

  • groupsize (int, optional) – If this and maxrej are set, then reject a maximum of maxrej points per group of groupsize points. If groupdim is also set, then this specifies sub-groups within that. This functionality is not well tested in python!

  • groupbadpix (bool, optional) – If True, consecutive sets of bad pixels are considered groups, overriding the values of groupsize.

  • grow (int, optional) – If set to a non-zero integer, N, the N nearest neighbors of rejected pixels will also be rejected.

  • sticky (bool, optional) – If True, pixels rejected in one iteration remain rejected in subsequent iterations, even if the model changes.

  • use_mad (bool, optional) – It True, compute the median of the maximum absolute deviation between the data and use this for the rejection instead of the default, which is to compute the standard deviation of ydata - modelfit. Note that it is not possible to specify use_mad=True and also pass in a value for invvar, and the code will return an error if this is done.

  • **kwargs_optimizer – Optional parameters passed to the optimizer.

Returns:

  • The object returned by the scipy.optimize function used by the fitter. See fitfunc.

  • A numpy.ndarray with the model value fit to ydata and has its same shape.

  • Boolean numpy.ndarray with the same shape as data indicating which pixels were masked in the final fit. Convention is that True are good values where False indicates bad values.

Return type:

tuple

pypeit.core.fitting.scale_minmax(x, minx=None, maxx=None)[source]

Scale in the input array

Parameters:
  • x (numpy.ndarray) – x values to be scaled

  • minx (float, optional) – Minimum value for scaling

  • maxx (float, optional) – Maximum value for scaling

Returns:

  • the scaled x-values in a numpy.ndarray

  • xmin as a float

  • xmax as a float

Return type:

tuple

pypeit.core.fitting.twoD_Gaussian(tup, amplitude, xo, yo, sigma_x, sigma_y, theta, offset)[source]

A 2D Gaussian to be used to fit the cross-correlation

Parameters:
  • tup (tuple) – A two element tuple containing the (x,y) coordinates where the 2D Gaussian will be evaluated

  • amplitude (float) – The amplitude of the 2D Gaussian

  • xo (float) – The centre of the Gaussian in the x direction

  • yo (float) – The centre of the Gaussian in the y direction

  • sigma_x (float) – The dispersion of the Gaussian in the x direction

  • sigma_y (float) – The dispersion of the Gaussian in the y direction

  • theta (float) – The angle of the major axis relative to the horizontal

  • offset (float) – Constant additive term

Returns:

The value of the 2D Gaussian at the given coordinates

Return type:

numpy.ndarray