dfisher_2022a.models

class dfisher_2022a.models.GaussianConstModelH(independent_vars=['x'], prefix='', nan_policy='raise', **kwargs)[source]

Bases: lmfit.model.Model

Constant model, with a single Parameter: c. Note that this is ‘constant’ in the sense of having no dependence on the independent variable x, not in the sense of being non-varying. To be clear, c will be a Parameter that will be varied in the fit (by default, of course).

flux_factor = 2.5066282746310002

Factor used to create flux_expr().

Type

float

fwhm_factor = 2.3548200450309493

Factor used to create lmfit.models.fwhm_expr().

Type

float

guess(data, x, **kwargs)

Guess starting values for the parameters of a model.

Parameters
  • data (array_like) – Array of data (i.e., y-values) to use to guess parameter values.

  • x (array_like) – Array of values for the independent variable (i.e., x-values).

  • **kws (optional) – Additional keyword arguments, passed to model function.

Returns

  • params (Parameters) – Initial, guessed values for the parameters of a Model.

  • .. versionchanged:: 1.0.3 – Argument x is now explicitly required to estimate starting values.

dfisher_2022a.models.Lm_Const_1GaussModel

alias of dfisher_2022a.models.lmfit.composite.Const_1GaussModel

Subpackages

Submodules

Generic functions used for model construction. Some of the functions are provided by the science team of DFisher_2022A project. The original code can be found at https://github.com/astrodee/threadcount/blob/master/src/threadcount/models.py

dfisher_2022a.models.base.constantH(x, c=0.0)[source]
dfisher_2022a.models.base.gaussianCH(x, height=1.0, center=0.0, sigma=1.0, c=0.0)[source]
dfisher_2022a.models.base.gaussianH(x, height=1.0, center=0.0, sigma=1.0)[source]

Return a 1-dimensional Gaussian function.

gaussian(x, height, center, sigma) =

height * exp(-(1.0*x-center)**2 / (2*sigma**2))

dfisher_2022a.models.base.guess_1gauss(y, x)[source]
dfisher_2022a.models.base.guess_from_peak(y, x, negative=False)[source]

Estimate starting values from 1D peak data and return (height,center,sigma).

Parameters
  • y (array-like) – y data

  • x (array-like) – x data

  • negative (bool, optional) – determines if peak height is positive or negative, by default False

Returns

(height, center, sigma) – Estimates of 1 gaussian line parameters.

Return type

(float, float, float)

dfisher_2022a.models.base.mean_edges(y, x=None, edge_fraction=0.1)[source]

Compute the mean of the outer points of y.

Mean the first and last n points in y, where n is given by len(y)*edge_fraction

An edge_fraction = 0 will return the mean of the first and last points. An edge_fraction = 0.5 will return the mean of all y.