forked from AmbaPant/mantid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
FickDiffusion.py
36 lines (27 loc) · 1009 Bytes
/
FickDiffusion.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
33
34
35
36
# Mantid Repository : https://github.com/mantidproject/mantid
#
# Copyright © 2007 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=no-init,invalid-name
'''
@author Spencer Howells, ISIS
@date December 05, 2013
'''
from mantid.api import IFunction1D, FunctionFactory
class FickDiffusion(IFunction1D):
def category(self):
return "QuasiElastic"
def init(self):
# Active fitting parameters
self.declareParameter("D", 1.0, 'Diffusion constant')
def function1D(self, xvals):
return self.getParameterValue("D")*xvals*xvals
def functionDeriv1D(self, xvals, jacobian):
i = 0
for x in xvals:
jacobian.set(i, 0, 2.0*x)
i += 1
# Required to have Mantid recognise the new function
FunctionFactory.subscribe(FickDiffusion)