-
Notifications
You must be signed in to change notification settings - Fork 122
/
CombGaussLorentzKT.py
30 lines (22 loc) · 1.11 KB
/
CombGaussLorentzKT.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
# NScD Oak Ridge National Laboratory, European Spallation Source,
# Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
# SPDX - License - Identifier: GPL - 3.0 +
# pylint: disable=invalid-name, anomalous-backslash-in-string, attribute-defined-outside-init
from mantid.api import IFunction1D, FunctionFactory
import numpy as np
class CombGaussLorentzKT(IFunction1D):
def category(self):
return "Muon\\MuonGeneric"
def init(self):
self.declareParameter("A0", 0.5, 'Amplitude')
self.declareParameter("Lambda", 0.1, 'Exponential decay rate')
self.declareParameter("Sigma", 0.2, 'KuboToyabe decay rate')
def function1D(self, x):
A0 = self.getParameterValue("A0")
Lambda = self.getParameterValue("Lambda")
Sigma = self.getParameterValue("Sigma")
return A0 * ((1./3.) + (2./3.) * (1.-(Sigma * x) ** 2 - Lambda * x) * np.exp(-0.5*(Sigma * x) ** 2-Lambda * x))
FunctionFactory.subscribe(CombGaussLorentzKT)