hexrd.fitting.peakfunctions module

hexrd.fitting.peakfunctions.erfc(x)[source]
hexrd.fitting.peakfunctions.exp1exp(x)[source]
hexrd.fitting.peakfunctions.exp1exp_over1(x)[source]
hexrd.fitting.peakfunctions.exp1exp_under1(x)[source]
hexrd.fitting.peakfunctions.gaussian1d(p, x)[source]

Required Arguments: p – (m) [A,x0,FWHM,c0,c1] x – (n) ndarray of coordinate positions

Outputs: f – (n) ndarray of function values at positions x

hexrd.fitting.peakfunctions.gaussian1d_deriv(p, x)[source]

Required Arguments: p – (m) [A,x0,FWHM,c0,c1] x – (n) ndarray of coordinate positions

Outputs: d_mat – (5 x n) ndarray of derivative values at positions x

hexrd.fitting.peakfunctions.gaussian2d(p, x, y)[source]

Required Arguments: p – (m) [A,x0,y0,FWHMx,FWHMy,c0,c1x,c1y] x – (n x o) ndarray of coordinate positions for dimension 1 y – (n x o) ndarray of coordinate positions for dimension 2

Outputs: f – (n x o) ndarray of function values at positions (x,y)

hexrd.fitting.peakfunctions.gaussian2d_rot(p, x, y)[source]

Required Arguments: p – (m) [A,x0,y0,FWHMx,FWHMy,theta,c0,c1x,c1y] x – (n x o) ndarray of coordinate positions for dimension 1 y – (n x o) ndarray of coordinate positions for dimension 2

Outputs: f – (n x o) ndarray of function values at positions (x,y)

hexrd.fitting.peakfunctions.gaussian3d(p, x, y, z)[source]

Required Arguments: p – (m) [A,x0,y0,z0,FWHMx,FWHMy,FWHMz,c0,c1x,c1y,c1z] x – (n x o x q) ndarray of coordinate positions for dimension 1 y – (n x o x q) ndarray of coordinate positions for dimension 2 y – (z x o x q) ndarray of coordinate positions for dimension 3

Outputs: f – (n x o x q) ndarray of function values at positions (x,y,z)

hexrd.fitting.peakfunctions.lorentzian1d(p, x)[source]

Required Arguments: p – (m) [x0,FWHM,c0,c1] x – (n) ndarray of coordinate positions

Outputs: f – (n) ndarray of function values at positions x

hexrd.fitting.peakfunctions.lorentzian1d_deriv(p, x)[source]

Required Arguments: p – (m) [A,x0,FWHM,c0,c1] x – (n) ndarray of coordinate positions

Outputs: d_mat – (5 x n) ndarray of derivative values at positions x

hexrd.fitting.peakfunctions.mpeak_1d(p, x, pktype, num_pks, bgtype=None)[source]

Required Arguments: p – (m x u) list of peak parameters for number of peaks where m is the

number of parameters per peak

“gaussian” and “lorentzian” - 3 “pvoigt” - 4 “split_pvoigt” - 6

x – (n) ndarray of coordinate positions for dimension 1 pktype – string, type of analytic function that will be used; current options are “gaussian”,”lorentzian”,”pvoigt” (psuedo voigt), and “split_pvoigt” (split psuedo voigt) num_pks – integer ‘u’ indicating the number of pks, must match length of p pktype – string, background functions, available options are “constant”, “linear”, and “quadratic”

Outputs: f – (n) ndarray of function values at positions (x)

hexrd.fitting.peakfunctions.mpeak_nparams_dict = {'gaussian': 3, 'lorentzian': 3, 'pink_beam_dcs': 8, 'pvoigt': 4, 'split_pvoigt': 6}

cutom function to compute the complementary error function based on rational approximation of the convergent Taylor series. coefficients found in Formula 7.1.26 Handbook of Mathematical Functions, Abramowitz and Stegun Error is < 1.5e-7 for all x

hexrd.fitting.peakfunctions.pink_beam_dcs(p, x)[source]

@author Saransh Singh, Lawrence Livermore National Lab @date 10/18/2021 SS 1.0 original @details pink beam profile for DCS data for calibration. more details can be found in Von Dreele et. al., J. Appl. Cryst. (2021). 54, 3–6

p has the following 10 parameters p = [A, x0, alpha0, alpha1, beta0, beta1, fwhm_g, fwhm_l, bkg_c0, bkg_c1]

hexrd.fitting.peakfunctions.pink_beam_dcs_lmfit(x, A, x0, alpha0, alpha1, beta0, beta1, fwhm_g, fwhm_l)[source]

@author Saransh Singh, Lawrence Livermore National Lab @date 10/18/2021 SS 1.0 original @details pink beam profile for DCS data for calibration. more details can be found in Von Dreele et. al., J. Appl. Cryst. (2021). 54, 3–6

hexrd.fitting.peakfunctions.pvoigt1d(p, x)[source]

Required Arguments: p – (m) [A,x0,FWHM,n,c0,c1] x – (n) ndarray of coordinate positions

Outputs: f – (n) ndarray of function values at positions x

hexrd.fitting.peakfunctions.split_pvoigt1d(p, x)[source]

Required Arguments: p – (m) [A,x0,FWHM-,FWHM+,n-,n+,c0,c1] x – (n) ndarray of coordinate positions

Outputs: f – (n) ndarray of function values at positions x

hexrd.fitting.peakfunctions.split_pvoigt2d_rot(p, x, y)[source]

Required Arguments: p – (m) [A,x0,y0,FWHMx-,FWHMx+,FWHMy-,FWHMy+,

nx-,nx+,ny-,ny+,theta,c0,c1x,c1y]

x – (n x o) ndarray of coordinate positions for dimension 1 y – (n x o) ndarray of coordinate positions for dimension 2

Outputs: f – (n x o) ndarray of function values at positions (x,y)

hexrd.fitting.peakfunctions.tanh_stepdown_nobg(p, x)[source]

Required Arguments: p – (m) [A,x0,w] x – (n) ndarray of coordinate positions

Outputs: f – (n) ndarray of function values at positions x