peak_shapes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
peak_shapes [2022/04/27 08:07] – rowlesmr3 | peak_shapes [2022/11/03 15:08] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Peak shapes ====== | ||
+ | |||
+ | Some various peak shapes that I've found useful in doing things like crystallite size distributions, | ||
+ | |||
+ | Peak shape is defined by a FWHM, not a standard deviation. The lognormal peak is defined by a peak position (being the point of maximum intensity) and a FWHM, which is naturally asymmetric. All peak areas are normalised to 1 and allow for scaling. They will work with >=v5. | ||
+ | |||
+ | If you want to use fit_objs, then look at the end of this page. | ||
+ | |||
+ | |||
+ | Gaussian | ||
+ | <code topas> | ||
+ | A (2 Sqrt(Ln(2)/ | ||
+ | }</ | ||
+ | |||
+ | Lorenztian | ||
+ | <code topas> | ||
+ | 2 A w / (Pi (w^2 + 4 (x-p)^2)) | ||
+ | }</ | ||
+ | |||
+ | Pearson VII | ||
+ | <code topas> | ||
+ | A (2 Sqrt((2^(1/ | ||
+ | }</ | ||
+ | |||
+ | Lognormal | ||
+ | <code topas> | ||
+ | int/ | ||
+ | } | ||
+ | |||
+ | macro & LN_r(& p, & w) { | ||
+ | (w + Sqrt(4 p^2 + w^2)) / (2 p) | ||
+ | } | ||
+ | macro & LN_mu(& p, & w) { | ||
+ | LN_r(p, | ||
+ | } | ||
+ | macro & LN_sigma(& | ||
+ | LN_r(p, | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | pseudo-Voigt | ||
+ | <code topas> | ||
+ | n Lor(A, | ||
+ | }</ | ||
+ | |||
+ | |||
+ | Split functions | ||
+ | <code topas> | ||
+ | 'all are normalised to unit area' | ||
+ | macro & split_Gaussian(& | ||
+ | If(x < posn, (Gau(int, | ||
+ | | ||
+ | ) | ||
+ | } | ||
+ | |||
+ | macro & split_Lorentzian(& | ||
+ | If(x < posn, (Lor(int, | ||
+ | | ||
+ | ) | ||
+ | } | ||
+ | |||
+ | macro & split_PV(& | ||
+ | If(x < posn, (pV(int, | ||
+ | | ||
+ | ) | ||
+ | } | ||
+ | |||
+ | |||
+ | macro & split_PeaVII(& | ||
+ | If(x < posn, (PeaVII(int, | ||
+ | | ||
+ | ) | ||
+ | } | ||
+ | |||
+ | macro & split_Lognormal(& | ||
+ | If(x < posn, 2 lognormal(int, | ||
+ | 2 lognormal(int, | ||
+ | ) | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | Macros set up to insert fit objects: | ||
+ | <code topas> | ||
+ | macro Gau_fo(int, int_v, posn, posn_v, fwhm, fwhm_v) { | ||
+ | #m_argu int | ||
+ | #m_argu posn | ||
+ | #m_argu fwhm | ||
+ | If_Local_Eqn_Rpt(int, | ||
+ | If_Local_Eqn_Rpt(posn, | ||
+ | If_Local_Eqn_Rpt(fwhm, | ||
+ | |||
+ | fit_obj = Gau(CeV(int, | ||
+ | } | ||
+ | macro sGau_fo(int, | ||
+ | #m_argu int | ||
+ | #m_argu posn | ||
+ | #m_argu hwL | ||
+ | #m_argu hwR | ||
+ | If_Local_Eqn_Rpt(int, | ||
+ | If_Local_Eqn_Rpt(posn, | ||
+ | If_Local_Eqn_Rpt(hwL, | ||
+ | If_Local_Eqn_Rpt(hwR, | ||
+ | |||
+ | fit_obj = sGau(CeV(int, | ||
+ | } | ||
+ | |||
+ | macro Lor_fo(int, int_v, posn, posn_v, fwhm, fwhm_v) { | ||
+ | #m_argu int | ||
+ | #m_argu posn | ||
+ | #m_argu fwhm | ||
+ | If_Local_Eqn_Rpt(int, | ||
+ | If_Local_Eqn_Rpt(posn, | ||
+ | If_Local_Eqn_Rpt(fwhm, | ||
+ | |||
+ | fit_obj = Lor(CeV(int, | ||
+ | } | ||
+ | macro sLor_fo(int, | ||
+ | #m_argu int | ||
+ | #m_argu posn | ||
+ | #m_argu hwL | ||
+ | #m_argu hwR | ||
+ | If_Local_Eqn_Rpt(int, | ||
+ | If_Local_Eqn_Rpt(posn, | ||
+ | If_Local_Eqn_Rpt(hwL, | ||
+ | If_Local_Eqn_Rpt(hwR, | ||
+ | |||
+ | fit_obj = sLor(CeV(int, | ||
+ | } | ||
+ | |||
+ | macro pV_fo(int, int_v, posn, posn_v, fwhm, fwhm_v, mix, mix_v) { | ||
+ | #m_argu int | ||
+ | #m_argu posn | ||
+ | #m_argu fwhm | ||
+ | #m_argu mix | ||
+ | If_Local_Eqn_Rpt(int, | ||
+ | If_Local_Eqn_Rpt(posn, | ||
+ | If_Local_Eqn_Rpt(fwhm, | ||
+ | If_Local_Eqn_Rpt(mix, | ||
+ | |||
+ | fit_obj = pV(CeV(int, int_v), CeV(posn, posn_v), CeV(fwhm, fwhm_v), CeV(mix, mix_v), X); | ||
+ | } | ||
+ | macro spV_fo(int, int_v, posn, posn_v, hwL, hwL_v, hwR, hwR_v, nL, nL_v, nR, nR_v) { | ||
+ | #m_argu int | ||
+ | #m_argu posn | ||
+ | #m_argu hwL | ||
+ | #m_argu hwR | ||
+ | #m_argu nL | ||
+ | #m_argu nR | ||
+ | If_Local_Eqn_Rpt(int, | ||
+ | If_Local_Eqn_Rpt(posn, | ||
+ | If_Local_Eqn_Rpt(hwL, | ||
+ | If_Local_Eqn_Rpt(hwR, | ||
+ | If_Local_Eqn_Rpt(nL, | ||
+ | If_Local_Eqn_Rpt(nR, | ||
+ | |||
+ | fit_obj = spV(CeV(int, | ||
+ | } | ||
+ | |||
+ | macro Pea7_fo(int, | ||
+ | #m_argu int | ||
+ | #m_argu posn | ||
+ | #m_argu fwhm | ||
+ | #m_argu m | ||
+ | If_Local_Eqn_Rpt(int, | ||
+ | If_Local_Eqn_Rpt(posn, | ||
+ | If_Local_Eqn_Rpt(fwhm, | ||
+ | If_Local_Eqn_Rpt(m, | ||
+ | |||
+ | fit_obj = Pea7(CeV(int, | ||
+ | } | ||
+ | macro sPea7_fo(int, | ||
+ | #m_argu int | ||
+ | #m_argu posn | ||
+ | #m_argu hwL | ||
+ | #m_argu hwR | ||
+ | #m_argu mL | ||
+ | #m_argu mR | ||
+ | If_Local_Eqn_Rpt(int, | ||
+ | If_Local_Eqn_Rpt(posn, | ||
+ | If_Local_Eqn_Rpt(hwL, | ||
+ | If_Local_Eqn_Rpt(hwR, | ||
+ | If_Local_Eqn_Rpt(mL, | ||
+ | If_Local_Eqn_Rpt(mR, | ||
+ | |||
+ | fit_obj = sPea7(CeV(int, | ||
+ | } | ||
+ | </ | ||
+ | |||