[ae3ce4e] | 1 | #!/usr/bin/env python |
---|
| 2 | """ Provide functionality for a C extension model |
---|
| 3 | |
---|
| 4 | WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY |
---|
| 5 | DO NOT MODIFY THIS FILE, MODIFY lorentzian.h |
---|
| 6 | AND RE-RUN THE GENERATOR SCRIPT |
---|
| 7 | |
---|
| 8 | @author: Mathieu Doucet / UTK |
---|
| 9 | @contact: mathieu.doucet@nist.gov |
---|
| 10 | """ |
---|
| 11 | |
---|
| 12 | from sans.models.BaseComponent import BaseComponent |
---|
| 13 | from sans_extension.c_models import CLorentzian |
---|
| 14 | import copy |
---|
| 15 | |
---|
| 16 | class Lorentzian(CLorentzian, BaseComponent): |
---|
| 17 | """ Class that evaluates a Lorentzian model. |
---|
| 18 | This file was auto-generated from lorentzian.h. |
---|
| 19 | Refer to that file and the structure it contains |
---|
| 20 | for details of the model. |
---|
| 21 | List of default parameters: |
---|
| 22 | scale = 1.0 |
---|
| 23 | gamma = 1.0 |
---|
| 24 | center = 0.0 |
---|
| 25 | |
---|
| 26 | """ |
---|
| 27 | |
---|
| 28 | def __init__(self): |
---|
| 29 | """ Initialization """ |
---|
| 30 | |
---|
| 31 | # Initialize BaseComponent first, then sphere |
---|
| 32 | BaseComponent.__init__(self) |
---|
| 33 | CLorentzian.__init__(self) |
---|
| 34 | |
---|
| 35 | ## Name of the model |
---|
| 36 | self.name = "Lorentzian" |
---|
[9316609] | 37 | self.description= """f(x)=scale * 1/pi 0.5gamma / [ (x-x_0)^2 + (0.5gamma)^2 ]""" |
---|
[ae3ce4e] | 38 | ## Parameter details [units, min, max] |
---|
| 39 | self.details = {} |
---|
| 40 | self.details['scale'] = ['', None, None] |
---|
| 41 | self.details['gamma'] = ['', None, None] |
---|
| 42 | self.details['center'] = ['', None, None] |
---|
| 43 | |
---|
| 44 | |
---|
| 45 | def clone(self): |
---|
| 46 | """ Return a identical copy of self """ |
---|
| 47 | obj = Lorentzian() |
---|
| 48 | obj.params = copy.deepcopy(self.params) |
---|
| 49 | return obj |
---|
| 50 | |
---|
| 51 | def run(self, x = 0.0): |
---|
| 52 | """ Evaluate the model |
---|
| 53 | @param x: input q, or [q,phi] |
---|
| 54 | @return: scattering function P(q) |
---|
| 55 | """ |
---|
| 56 | |
---|
| 57 | return CLorentzian.run(self, x) |
---|
| 58 | |
---|
| 59 | def runXY(self, x = 0.0): |
---|
| 60 | """ Evaluate the model in cartesian coordinates |
---|
| 61 | @param x: input q, or [qx, qy] |
---|
| 62 | @return: scattering function P(q) |
---|
| 63 | """ |
---|
| 64 | |
---|
| 65 | return CLorentzian.runXY(self, x) |
---|
| 66 | |
---|
| 67 | # End of file |
---|