Available models¶

These are the model classes available. Using Function user-written Python functions can be used as models too.

Generic¶

class ufit.models.Function(fcn, name=None, **init)

Model using a function provided by the user.

Parameters are extracted from the function’s arguments and passed positionally.

Peaks¶

class ufit.models.Gauss(name='', pos=None, ampl=None, fwhm=None)

Gaussian peak

Parameters:

• pos - Peak center position
• ampl - Amplitude at center
• fwhm - Full width at half maximum
class ufit.models.GaussInt(name='', pos=None, int=None, fwhm=None)

Gaussian peak with integrated intensity parameter

Parameters:

• pos - Peak center position
• int - Integrated intensity
• fwhm - Full width at half maximum
class ufit.models.Lorentz(name='', pos=None, ampl=None, fwhm=None)

Lorentzian peak

Parameters:

• pos - Peak center position
• ampl - Amplitude at center
• fwhm - Full width at half maximum
class ufit.models.LorentzInt(name='', pos=None, int=None, fwhm=None)

Lorentzian peak with integrated intensity parameter

Parameters:

• pos - Peak center position
• int - Integrated intensity
• fwhm - Full width at half maximum
class ufit.models.Voigt(name='', pos=None, ampl=None, fwhm=None, shape=None)

Voigt peak

A convolution of a Gaussian and a Lorentzian.

Parameters:

• pos - Peak center position
• ampl - Amplitude at center
• fwhm - Full width at half maximum of the Gauss part
• shape - Lorentz contribution
class ufit.models.PseudoVoigt(name='', pos=None, ampl=None, fwhm=None, eta=0.5)

Pseudo-Voigt peak

A pseudo-convolution of a Gaussian and a Lorentzian.

Parameters:

• pos - Peak center position
• ampl - Amplitude at center
• fwhm - Full width at half maximum
• eta - Lorentzicity
class ufit.models.DHO(name='', center=0, pos=None, ampl=None, gamma=None, tt=None)

Damped Harmonic Oscillator

Two Lorentzians centered around zero with a common width and amplitude, respecting the Bose factor.

Parameters:

• center - Energy zero
• pos - omega_0
• ampl - Amplitude
• gamma - Damping
• tt - Temperature in K

Corrections¶

class ufit.models.Background(name='', bkgd=0)

Constant background

Parameters:

• bkgd - the background (forced to be nonnegative)
class ufit.models.SlopingBackground(name='', bkgd=0, slope=0)

Linearly sloping background

Parameters:

• bkgd - constant factor
• slope - slope coefficient
class ufit.models.CKI_Corr(name='', ki=None, dval='3.355')

Correction for constant-k_i energy scans

Parameters:

• ki - the ki value in Ang-1
• dval - the monochromator d-value in Ang
class ufit.models.Bose(name='', tt=None)

Bose factor

Parameters:

• tt - the temperature in K

Others¶

class ufit.models.Const(name='', c=None)

A constant, to be used for modifying other models (e.g. exponentiation)

For example: Sinc() ** Const('eta')

Parameters:

• the constant (named after the model’s name)
class ufit.models.StraightLine(name='', slope=1, y0=0)

Straight line

y = slope * x + y0

Parameters:

• slope
• y0 - intercept
class ufit.models.Parabola(name='', x0=0, y0=0, stretch=1)

Parabola

y = stretch * (x - x0)^2 + y0

Parameters:

• x0 - x coordinate of vertex
• y0 - y coordinate of vertex
• stretch - stretch factor
class ufit.models.Cosine(name='', ampl=None, freq=None, phase=0)

Cosine

y = ampl * cos(freq * x + phase)

Parameters:

• ampl - amplitude
• freq - frequency (omega or k)
• phase - phase in radians
class ufit.models.Sinc(name='', ampl=None, freq=None, center=0)

Sinc function

y = ampl * sin(freq*(x - center)) / (freq*(x - center))

Parameters:

• ampl - amplitude at x = center
• freq - frequency of the sine
• center - point of maximum amplitude
class ufit.models.ExpDecay(name='', y0=1, tau=None, y1=0)

Exponential decay

y = y1 + (y0 - y1) * exp(-x/tau)

Parameters:

• y0 - value at x = 0
• tau - decay constant: exp(-x/tau)
• y1 - value at x -> infinity
class ufit.models.PowerLaw(name='', scale=1, start=0, ampl=None, beta=None)

Power law

Parameters:

• start - starting point
• scale - x value scaling (positive => right side of starting point)
• beta - exponent
class ufit.models.GaussianConvolution(model, width=1, name=None)

Models a 1-D convolution with a Gaussian kernel.

Parameters:

• width - FWHM of Gaussian kernel