code changes for release 2.2.0

This commit is contained in:
2021-09-09 12:45:39 +02:00
parent c50ca2e577
commit e3e80f5796
25 changed files with 3519 additions and 238 deletions

View File

@ -1,3 +1,4 @@
#pragma TextEncoding = "UTF-8"
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
#pragma IgorVersion = 6.2
#pragma ModuleName = PearlFitFuncs
@ -124,6 +125,51 @@ threadsafe function DoubletGaussLinBG_AO(pw, yw, xw) : FitFunc
yw += pw[2] * pw[3] * exp( -( (xw[p] - pw[4] + pw[5] /2) / pw[6] / pw[7] )^2 )
end
/// two doublet gaussian peaks on a linear background fit function (all at once).
///
/// this fits four gaussian peaks.
/// peak positions are specified by center, splitting and shift rather than individually.
/// amplitudes are specified as absolute values for peaks 1 and 3,
/// and relative values for peaks 2 and 4.
///
/// can be used if a spin-orbit doublet is split by a chemical shift
/// which affects both spin-orbit peaks equally.
///
/// @note FWHM = width * 2 * sqrt(ln(2)) = width * 1.665
///
/// @param pw shape parameters.
/// @arg pw[0] = constant coefficient of background
/// @arg pw[1] = linear coefficient of background
/// @arg pw[2] = amplitude of peak 1
/// @arg pw[3] = amplitude of peak 2
/// @arg pw[4] = amplitude of peak 3, relative to peak 1
/// @arg pw[5] = amplitude of peak 4, relative to peak 2
/// @arg pw[6] = position of peak 1
/// @arg pw[7] = splitting (distance between peaks 1 and 3)
/// @arg pw[8] = shift (distance between peaks 1 and 2)
/// @arg pw[9] = width of peaks 1 and 3
/// @arg pw[10] = width of peaks 2 and 4
///
/// @param yw y (dependent) values.
///
/// @param xw x (independent) independent values.
///
threadsafe function DblDoubletGaussLinBG_AO(pw, yw, xw) : FitFunc
wave pw
wave yw
wave xw
yw = pw[0] + xw[p] * pw[1]
// peak 1
yw += pw[2] * exp( -( (xw[p] - pw[6]) / pw[9] )^2 )
// peak 2
yw += pw[3] * exp( -( (xw[p] - pw[6] - pw[8]) / pw[10] )^2 )
// peak 3
yw += pw[2] * pw[4] * exp( -( (xw[p] - pw[6] - pw[7]) / pw[9] )^2 )
// peak 4
yw += pw[3] * pw[5] * exp( -( (xw[p] - pw[6] - pw[7] - pw[8]) / pw[10] )^2 )
end
//------------------------------------------------------------------------------
// Voigt shapes
//------------------------------------------------------------------------------
@ -141,7 +187,7 @@ end
/// @arg w[5 + (i-1) * 4] = shape of peak i
/// @param x independent variable
///
function MultiVoigtLinBG(w,x) : FitFunc
threadsafe function MultiVoigtLinBG(w,x) : FitFunc
wave w
variable x
@ -156,6 +202,39 @@ function MultiVoigtLinBG(w,x) : FitFunc
return v
end
/// multiple voigt peaks on a linear background fit function.
///
///
/// this is the all-at-once version of @ref MultiVoigtLinBG.
/// it runs slightly faster compared to the point-by-point function.
///
/// @param pw shape parameters.
/// the length of the wave defines the number of peaks.
/// @arg pw[0] = constant coefficient of background
/// @arg pw[1] = linear coefficient of background
/// @arg pw[2 + (i-1) * 4] = amplitude of peak i
/// @arg pw[3 + (i-1) * 4] = position of peak i
/// @arg pw[4 + (i-1) * 4] = width of peak i
/// @arg pw[5 + (i-1) * 4] = shape of peak i
///
/// @param yw y (dependent) values.
///
/// @param xw x (independent) independent values.
///
threadsafe function MultiVoigtLinBG_AO(pw, yw, xw) : FitFunc
wave pw
wave yw
wave xw
variable np = numpnts(pw)
variable ip
yw = pw[0] + xw[p] * pw[1]
for (ip = 2; ip < np; ip += 4)
yw += pw[ip] * VoigtFunc((xw[p] - pw[ip+1]) / pw[ip+2], pw[ip+3])
endfor
end
//------------------------------------------------------------------------------
// Doniach-Sunjic shapes
@ -198,7 +277,7 @@ end
/// @arg w[5 + (i-1) * 4] = singularity index (0...1) of peak i
/// @param x independent variable
///
function MultiDoniachSunjicLinBG(w,x) : FitFunc
threadsafe function MultiDoniachSunjicLinBG(w,x) : FitFunc
wave w
variable x