new features: data reduction, angle scan panel
- new data reduction interface for more efficient multi-peak fitting. the new interface breaks compatibility with pre-2.0 data reduction functions. user-defined functions must be adapted to the new interface. - new angle scan processing panel for interactive data analysis.
This commit is contained in:
@ -1,32 +1,148 @@
|
||||
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
|
||||
#pragma IgorVersion = 6.2
|
||||
#pragma ModuleName = PearlFitFuncs
|
||||
#pragma version = 1.01
|
||||
#include "mm-physconst", version >= 1.05
|
||||
#pragma version = 1.02
|
||||
#include "mm-physconst"
|
||||
|
||||
// various fit functions for photoelectron spectroscopy
|
||||
/// @file
|
||||
/// @brief various fit functions for photoelectron spectroscopy.
|
||||
/// @ingroup ArpesPackage
|
||||
///
|
||||
/// this procedure contains various functions for curve fitting.
|
||||
///
|
||||
/// @author matthias muntwiler, matthias.muntwiler@psi.ch
|
||||
///
|
||||
/// @copyright 2013-18 Paul Scherrer Institut @n
|
||||
/// Licensed under the Apache License, Version 2.0 (the "License"); @n
|
||||
/// you may not use this file except in compliance with the License. @n
|
||||
/// You may obtain a copy of the License at
|
||||
/// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
// $Id$
|
||||
// author: matthias.muntwiler@psi.ch
|
||||
// Copyright (c) 2013-14 Paul Scherrer Institut
|
||||
/// @namespace PearlFitFuncs
|
||||
/// @brief various fit functions for photoelectron spectroscopy.
|
||||
///
|
||||
/// PearlFitFuncs is declared in @ref pearl-fitfuncs.ipf.
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Doniach-Sunjic fit functions
|
||||
// Gaussian shapes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/// multiple gaussian peaks on a linear background fit function.
|
||||
///
|
||||
/// @note FWHM = width * 2 * sqrt(ln(2)) = width * 1.665
|
||||
///
|
||||
/// @param w shape parameters.
|
||||
/// the length of the wave defines the number of peaks.
|
||||
/// @arg w[0] = constant coefficient of background
|
||||
/// @arg w[1] = linear coefficient of background
|
||||
/// @arg w[2 + (i-1) * 3] = amplitude of peak i
|
||||
/// @arg w[3 + (i-1) * 3] = position of peak i
|
||||
/// @arg w[4 + (i-1) * 3] = width of peak i (see note)
|
||||
/// @param x independent variable
|
||||
///
|
||||
threadsafe function MultiGaussLinBG(w,x) : FitFunc
|
||||
wave w
|
||||
variable x
|
||||
|
||||
variable np = numpnts(w)
|
||||
variable ip
|
||||
|
||||
variable v = w[0] + x * w[1]
|
||||
for (ip = 2; ip < np; ip += 3)
|
||||
v += w[ip] * exp( -( (x - w[ip+1]) / w[ip+2] )^2 )
|
||||
endfor
|
||||
|
||||
return v
|
||||
end
|
||||
|
||||
/// multiple gaussian peaks on a linear background fit function (all at once).
|
||||
///
|
||||
/// this is the all-at-once version of @ref MultiGaussLinBG.
|
||||
/// it runs about 15% faster compared to the point-by-point function
|
||||
/// (measured on a 200 point spectrum with 3 peaks).
|
||||
///
|
||||
/// @note FWHM = width * 2 * sqrt(ln(2)) = width * 1.665
|
||||
///
|
||||
/// @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) * 3] = amplitude of peak i
|
||||
/// @arg pw[3 + (i-1) * 3] = position of peak i
|
||||
/// @arg pw[4 + (i-1) * 3] = width of peak i (see note)
|
||||
///
|
||||
/// @param yw y (dependent) values.
|
||||
///
|
||||
/// @param xw x (independent) independent values.
|
||||
///
|
||||
threadsafe function MultiGaussLinBG_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 += 3)
|
||||
yw += pw[ip] * exp( -( (xw[p] - pw[ip+1]) / pw[ip+2] )^2 )
|
||||
endfor
|
||||
end
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Voigt shapes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/// multiple voigt peaks on a linear background fit function.
|
||||
///
|
||||
///
|
||||
/// @param w shape parameters.
|
||||
/// the length of the wave defines the number of peaks.
|
||||
/// @arg w[0] = constant coefficient of background
|
||||
/// @arg w[1] = linear coefficient of background
|
||||
/// @arg w[2 + (i-1) * 4] = amplitude of peak i
|
||||
/// @arg w[3 + (i-1) * 4] = position of peak i
|
||||
/// @arg w[4 + (i-1) * 4] = width of peak i
|
||||
/// @arg w[5 + (i-1) * 4] = shape of peak i
|
||||
/// @param x independent variable
|
||||
///
|
||||
function MultiVoigtLinBG(w,x) : FitFunc
|
||||
wave w
|
||||
variable x
|
||||
|
||||
variable np = numpnts(w)
|
||||
variable ip
|
||||
|
||||
variable v = w[0] + x * w[1]
|
||||
for (ip = 2; ip < np; ip += 4)
|
||||
v += w[ip] * VoigtFunc((x - w[ip+1]) / w[ip+2], w[ip+3])
|
||||
endfor
|
||||
|
||||
return v
|
||||
end
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Doniach-Sunjic shapes
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/// Doniach-Sunjic line shape
|
||||
///
|
||||
/// [S. Doniach, M. Sunjic, J. Phys. C 3 (1970) 285]
|
||||
///
|
||||
/// @param x independent variable
|
||||
/// @param amp amplitude
|
||||
/// @param pos position
|
||||
/// @param sing singularity index (0 <= sing < 1)
|
||||
/// @param fwhm full width at half maximum
|
||||
///
|
||||
threadsafe function DoniachSunjic(x, amp, pos, sing, fwhm)
|
||||
// Doniach-Sunjic line shape
|
||||
// [S. Doniach, M. Sunjic, J. Phys. C 3 (1970) 285]
|
||||
variable x // independent variable
|
||||
variable amp // amplitude
|
||||
variable pos // position
|
||||
variable sing // singularity index (0 <= sing < 1)
|
||||
variable fwhm // width
|
||||
variable x
|
||||
variable amp
|
||||
variable pos
|
||||
variable sing
|
||||
variable fwhm
|
||||
|
||||
variable nom, denom
|
||||
nom = cos(pi * sing / 2 + (1 - sing) * atan((x - pos) / fwhm * 2))
|
||||
@ -35,6 +151,35 @@ threadsafe function DoniachSunjic(x, amp, pos, sing, fwhm)
|
||||
return amp * nom / denom * fwhm / 2
|
||||
end
|
||||
|
||||
/// multiple doniach-sunjic peaks on a linear background fit function.
|
||||
///
|
||||
///
|
||||
/// @param w shape parameters.
|
||||
/// the length of the wave defines the number of peaks.
|
||||
/// @arg w[0] = constant coefficient of background
|
||||
/// @arg w[1] = linear coefficient of background
|
||||
/// @arg w[2 + (i-1) * 4] = amplitude of peak i
|
||||
/// @arg w[3 + (i-1) * 4] = position of peak i
|
||||
/// @arg w[4 + (i-1) * 4] = width (fwhm) of peak i
|
||||
/// @arg w[5 + (i-1) * 4] = singularity index (0...1) of peak i
|
||||
/// @param x independent variable
|
||||
///
|
||||
function MultiDoniachSunjicLinBG(w,x) : FitFunc
|
||||
wave w
|
||||
variable x
|
||||
|
||||
variable np = numpnts(w)
|
||||
variable ip
|
||||
|
||||
variable v = w[0] + x * w[1]
|
||||
for (ip = 2; ip < np; ip += 4)
|
||||
v += DoniachSunjic(x, w[ip], w[ip+1], w[ip+3], w[ip+2])
|
||||
endfor
|
||||
|
||||
return v
|
||||
end
|
||||
|
||||
|
||||
threadsafe function ds1_bg(w, x): FitFunc
|
||||
// Doniach-Sunjic fit function
|
||||
// 0 <= sing < 1
|
||||
|
Reference in New Issue
Block a user