/
StretchedKT.py
32 lines (25 loc) · 1.06 KB
/
StretchedKT.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
31
32
# 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 StretchedKT(IFunction1D):
def category(self):
return "Muon\\MuonGeneric"
def init(self):
self.declareParameter("A0", 1)
self.declareParameter("Beta", 1)
self.declareParameter("Sigma", 0.1)
def function1D(self, x):
A0 = self.getParameterValue("A0")
beta = self.getParameterValue("Beta")
Sigma = self.getParameterValue("Sigma")
product = Sigma * x
A = (2.0 / 3.0) * (1 - product**beta)
B = np.exp(-(product**beta) / beta)
return A0 * (1.0 / 3.0 + A * B)
FunctionFactory.subscribe(StretchedKT)