def calc_pk_integrated_intensities(p, x, pktype, num_pks): """ Calculate the area under the curve (integrated intensities) for fit peaks. Parameters ---------- p : array_like (m x u + v) peak parameters for u peaks, m is the number of parameters per peak: "gaussian" and "lorentzian" = 3; "pvoigt" = 4; "split_pvoigt" = 5. v is the number of parameters for chosen bgtype x : array_like (n, ) ndarray of abcissa coordinates. pktype : str type of analytic function that will be used to fit the data; current options are "gaussian", "gaussian_rot" (gaussian with arbitrary axes) and "split_pvoigt_rot" (split psuedo voigt with arbitrary axes). num_pks : int the number of peaks in the specified interval. Returns ------- ints : array_like (m, ) array of integrated intensity values. """ ints = np.zeros(num_pks) if pktype == 'gaussian' or pktype == 'lorentzian': p_fit = np.reshape(p[:3*num_pks], [num_pks, 3]) elif pktype == 'pvoigt': p_fit = np.reshape(p[:4*num_pks], [num_pks, 4]) elif pktype == 'split_pvoigt': p_fit = np.reshape(p[:6*num_pks], [num_pks, 6]) for ii in np.arange(num_pks): if pktype == 'gaussian': ints[ii] = integrate.simps( pkfuncs._gaussian1d_no_bg(p_fit[ii], x), x ) elif pktype == 'lorentzian': ints[ii] = integrate.simps( pkfuncs._lorentzian1d_no_bg(p_fit[ii], x), x ) elif pktype == 'pvoigt': ints[ii] = integrate.simps( pkfuncs._pvoigt1d_no_bg(p_fit[ii], x), x ) elif pktype == 'split_pvoigt': ints[ii] = integrate.simps( pkfuncs._split_pvoigt1d_no_bg(p_fit[ii], x), x ) return ints
def fit_pk_obj_1d_mpeak(p, x, f0, pktype, num_pks): f = np.zeros(len(x)) p = np.reshape(p, [num_pks, p.shape[0]/num_pks]) for ii in np.arange(num_pks): if pktype == 'gaussian': f += pkfuncs._gaussian1d_no_bg(p[ii], x) elif pktype == 'lorentzian': f += pkfuncs._lorentzian1d_no_bg(p[ii], x) elif pktype == 'pvoigt': f += pkfuncs._pvoigt1d_no_bg(p[ii], x) elif pktype == 'split_pvoigt': f += pkfuncs._split_pvoigt1d_no_bg(p[ii], x) return f - f0
def fit_pk_obj_1d_mpeak(p,x,f0,pktype,num_pks): f=np.zeros(len(x)) p=np.reshape(p,[num_pks,p.shape[0]/num_pks]) for ii in np.arange(num_pks): if pktype == 'gaussian': f=f+pkfuncs._gaussian1d_no_bg(p[ii],x) elif pktype == 'lorentzian': f=f+pkfuncs._lorentzian1d_no_bg(p[ii],x) elif pktype == 'pvoigt': f=f+pkfuncs._pvoigt1d_no_bg(p[ii],x) elif pktype == 'split_pvoigt': f=f+pkfuncs._split_pvoigt1d_no_bg(p[ii],x) resd = f-f0 return resd
def calc_pk_integrated_intensities(p, x, pktype, num_pks): """ Calculates the area under the curve (integrated intensities) for fit peaks Required Arguments: p -- (m x u + v) peak parameters for number of peaks, m is the number of parameters per peak ("gaussian" and "lorentzian" - 3, "pvoigt" - 4, "split_pvoigt" - 5), v is the number of parameters for chosen bgtype x -- (n) ndarray of coordinate positions f -- (n) ndarray of intensity measurements at coordinate positions x pktype -- string, type of analytic function that will be used to fit the data, 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 Outputs: ints -- (m) integrated intensities for m fit peaks """ ints = np.zeros(num_pks) if pktype == 'gaussian' or pktype == 'lorentzian': p_fit = np.reshape(p[:3 * num_pks], [num_pks, 3]) elif pktype == 'pvoigt': p_fit = np.reshape(p[:4 * num_pks], [num_pks, 4]) elif pktype == 'split_pvoigt': p_fit = np.reshape(p[:6 * num_pks], [num_pks, 6]) for ii in np.arange(num_pks): if pktype == 'gaussian': ints[ii] = integrate.simps(pkfuncs._gaussian1d_no_bg(p_fit[ii], x), x) elif pktype == 'lorentzian': ints[ii] = integrate.simps( pkfuncs._lorentzian1d_no_bg(p_fit[ii], x), x) elif pktype == 'pvoigt': ints[ii] = integrate.simps(pkfuncs._pvoigt1d_no_bg(p_fit[ii], x), x) elif pktype == 'split_pvoigt': ints[ii] = integrate.simps( pkfuncs._split_pvoigt1d_no_bg(p_fit[ii], x), x) return ints
def calc_pk_integrated_intensities(p,x,pktype,num_pks): """ Calculates the area under the curve (integrated intensities) for fit peaks Required Arguments: p -- (m x u + v) peak parameters for number of peaks, m is the number of parameters per peak ("gaussian" and "lorentzian" - 3, "pvoigt" - 4, "split_pvoigt" - 5), v is the number of parameters for chosen bgtype x -- (n) ndarray of coordinate positions f -- (n) ndarray of intensity measurements at coordinate positions x pktype -- string, type of analytic function that will be used to fit the data, 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 Outputs: ints -- (m) integrated intensities for m fit peaks """ ints=np.zeros(num_pks) if pktype == 'gaussian' or pktype == 'lorentzian': p_fit=np.reshape(p[:3*num_pks],[num_pks,3]) elif pktype == 'pvoigt': p_fit=np.reshape(p[:4*num_pks],[num_pks,4]) elif pktype == 'split_pvoigt': p_fit=np.reshape(p[:6*num_pks],[num_pks,6]) for ii in np.arange(num_pks): if pktype == 'gaussian': ints[ii]=integrate.simps(pkfuncs._gaussian1d_no_bg(p_fit[ii],x),x) elif pktype == 'lorentzian': ints[ii]=integrate.simps(pkfuncs._lorentzian1d_no_bg(p_fit[ii],x),x) elif pktype == 'pvoigt': ints[ii]=integrate.simps(pkfuncs._pvoigt1d_no_bg(p_fit[ii],x),x) elif pktype == 'split_pvoigt': ints[ii]=integrate.simps(pkfuncs._split_pvoigt1d_no_bg(p_fit[ii],x),x) return ints