lineshapes Module

skbeam.core.fitting.lineshapes.compton(x, compton_amplitude, coherent_sct_energy, fwhm_offset, fwhm_fanoprime, e_offset, e_linear, e_quadratic, compton_angle, compton_fwhm_corr, compton_f_step, compton_f_tail, compton_gamma, compton_hi_f_tail, compton_hi_gamma, epsilon=2.96)

Model compton peak, which is generated as an inelastic peak and always stays to the left of elastic peak on the spectrum.

Parameters
xarray

energy value

compton_amplitudefloat

area for gaussian peak, gaussian step and gaussian tail functions

coherent_sct_energyfloat

incident energy

fwhm_offsetfloat

global fitting parameter for peak width

fwhm_fanoprimefloat

global fitting parameter for peak width

e_offsetfloat

offset of energy calibration

e_linearfloat

linear coefficient in energy calibration

e_quadraticfloat

quadratic coefficient in energy calibration

compton_anglefloat

compton angle in degree

compton_fwhm_corrfloat

correction factor on peak width

compton_f_stepfloat

weight factor of the gaussian step function

compton_f_tailfloat

weight factor of gaussian tail on lower side

compton_gammafloat

normalization factor of gaussian tail on lower side

compton_hi_f_tailfloat

weight factor of gaussian tail on higher side

compton_hi_gammafloat

normalization factor of gaussian tail on higher side

epsilonfloat

energy to create a hole-electron pair for Ge 2.96, for Si 3.61 at 300K needs to double check this value

Returns
countsarray

compton peak

References

1

M. Van Gysel etc, “Description of Compton peaks in energy-dispersive x-ray fluorescence spectra”, X-Ray Spectrometry, vol. 32, pp. 139-147, 2003.

skbeam.core.fitting.lineshapes.elastic(x, coherent_sct_amplitude, coherent_sct_energy, fwhm_offset, fwhm_fanoprime, e_offset, e_linear, e_quadratic, epsilon=2.96)

Model of elastic peak in X-Ray fluorescence

Parameters
xarray

energy value

coherent_sct_amplitudefloat

area of elastic peak

coherent_sct_energyfloat

incident energy

fwhm_offsetfloat

global fitting parameter for peak width

fwhm_fanoprimefloat

global fitting parameter for peak width

e_offsetfloat

offset of energy calibration

e_linearfloat

linear coefficient in energy calibration

e_quadraticfloat

quadratic coefficient in energy calibration

epsilonfloat

energy to create a hole-electron pair for Ge 2.96, for Si 3.61 at 300K needs to double check this value

Returns
valuearray

elastic peak

skbeam.core.fitting.lineshapes.gamma_dist(bin_values, K, M)

Gamma distribution function

Parameters
bin_valuesarray

bin values for detecting photons eg : max photon counts is 8 bin_values = np.arange(8+2)

Kint

mean count of photons

Mint

number of coherent modes

Returns
gamma_distarray

Gamma distribution

Notes

These implementations are based on the references under the Notes section of the nbinom_dist() docstring

\[P(K) = \frac{\Gamma(K + M)} {\Gamma(K + 1)\Gamma(M)} (\frac {M} {M + <K>})^M (\frac {<K>}{M + <K>})^K\]
skbeam.core.fitting.lineshapes.gaussian(x, area, center, sigma)

1 dimensional gaussian

Parameters
xarray

independent variable

areafloat

Area of the normally distributed peak

centerfloat

center position

sigmafloat

standard deviation

skbeam.core.fitting.lineshapes.gaussian_tail(x, area, center, sigma, gamma)

Use a gaussian tail function to simulate compton peak

Parameters
xarray

data in x coordinate

areafloat

area of gauss tail function If area is set as 1, the integral is unity.

centerfloat

center position

sigmafloat

control peak width

gammafloat

normalization factor

Returns
countsarray

gaussian tail peak

References

1

Rene Van Grieken, “Handbook of X-Ray Spectrometry, Second Edition, (Practical Spectroscopy)”, CRC Press, 2 edition, pp. 182, 2007.

skbeam.core.fitting.lineshapes.gausssian_step(x, area, center, sigma, peak_e)

Gauss step function is an important component in modeling compton peak. Use scipy erfc function. Please note erfc = 1-erf.

Parameters
xarray

data in x coordinate

areafloat

area of gauss step function

centerfloat

center position

sigmafloat

standard deviation

peak_efloat

emission energy

Returns
countsarray

gaussian step peak

References

1

Rene Van Grieken, “Handbook of X-Ray Spectrometry, Second Edition, (Practical Spectroscopy)”, CRC Press, 2 edition, pp. 182, 2007.

skbeam.core.fitting.lineshapes.lorentzian(x, area, center, sigma)

1 dimensional lorentzian

Parameters
xarray

independent variable

areafloat

area of lorentzian peak, If area is set as 1, the integral is unity.

centerfloat

center position

sigmafloat

standard deviation

skbeam.core.fitting.lineshapes.lorentzian2(x, area, center, sigma)

1-d lorentzian squared profile

Parameters
xarray

independent variable

areafloat

area of lorentzian squared peak, If area is set as 1, the integral is unity.

centerfloat

center position

sigmafloat

standard deviation

skbeam.core.fitting.lineshapes.nbinom_dist(bin_values, K, M)

Negative Binomial (Poisson-Gamma) distribution function

Parameters
bin_valuesarray

bin values for detecting photons eg : max photon counts is 8 bin_values = np.arange(8+2)

Kint

mean count of photons

Mint

number of coherent modes

Returns
nbinomarray

Negative Binomial (Poisson-Gamma) distribution function

Notes

The negative-binomial distribution function

\[P(K) =(\frac{M}{<K>})^M \frac{K^{M-1}} {\Gamma(M)}\exp(-M\frac{K}{<K>})\]

Implementation reference [1]

References

1

L. Li, P. Kwasniewski, D. Oris, L Wiegart, L. Cristofolini, C. Carona and A. Fluerasu , “Photon statistics and speckle visibility spectroscopy with partially coherent x-rays” J. Synchrotron Rad., vol 21, p 1288-1295, 2014.

skbeam.core.fitting.lineshapes.poisson_dist(bin_values, K)

Poisson Distribution

Parameters
Kint

mean count of photons

bin_valuesarray

bin values for detecting photons eg : max photon counts is 8 bin_values = np.arange(8+2)

Returns
poisson_distarray

Poisson Distribution

Notes

These implementations are based on the references under the Notes section of the nbinom_dist() docstring

\[P(K) = \frac{<K>^K}{K!}\exp(-<K>)\]
skbeam.core.fitting.lineshapes.pvoigt(x, area, center, sigma, fraction)

Linear combination of gaussian and lorentzian

Parameters
xarray

independent variable

areafloat

area of pvoigt peak

centerfloat

center position

sigmafloat

standard deviation

fractionfloat

weight for lorentzian peak in the linear combination, and (1-fraction) is the weight for gaussian peak.

skbeam.core.fitting.lineshapes.voigt(x, area, center, sigma, gamma=None)

Convolution of gaussian and lorentzian curve.

see http://en.wikipedia.org/wiki/Voigt_profile

Parameters
xarray

independent variable

areafloat

area of voigt peak

centerfloat

center position

sigmafloat

standard deviation

gammafloat, optional

half width at half maximum of lorentzian. If optional, gamma gets set to sigma