[ae3ce4e] | 1 | #!/usr/bin/env python |
---|
| 2 | """ Provide functionality for a C extension model |
---|
| 3 | |
---|
| 4 | WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY |
---|
[9316609] | 5 | DO NOT MODIFY THIS FILE, MODIFY ellipsoid.h |
---|
[ae3ce4e] | 6 | AND RE-RUN THE GENERATOR SCRIPT |
---|
| 7 | |
---|
[9316609] | 8 | @author: Mathieu Doucet / UTK |
---|
| 9 | @contact: mathieu.doucet@nist.gov |
---|
[ae3ce4e] | 10 | """ |
---|
| 11 | |
---|
| 12 | from sans.models.BaseComponent import BaseComponent |
---|
| 13 | from sans_extension.c_models import CEllipsoidModel |
---|
| 14 | import copy |
---|
| 15 | |
---|
| 16 | class EllipsoidModel(CEllipsoidModel, BaseComponent): |
---|
| 17 | """ Class that evaluates a EllipsoidModel model. |
---|
[9316609] | 18 | This file was auto-generated from ellipsoid.h. |
---|
[ae3ce4e] | 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 | radius_a = 20.0 A |
---|
| 24 | radius_b = 400.0 A |
---|
| 25 | contrast = 3e-006 A-2 |
---|
| 26 | background = 0.0 cm-1 |
---|
| 27 | axis_theta = 1.57 rad |
---|
| 28 | axis_phi = 0.0 rad |
---|
| 29 | |
---|
| 30 | """ |
---|
| 31 | |
---|
| 32 | def __init__(self): |
---|
| 33 | """ Initialization """ |
---|
| 34 | |
---|
| 35 | # Initialize BaseComponent first, then sphere |
---|
| 36 | BaseComponent.__init__(self) |
---|
| 37 | CEllipsoidModel.__init__(self) |
---|
| 38 | |
---|
| 39 | ## Name of the model |
---|
| 40 | self.name = "EllipsoidModel" |
---|
[9316609] | 41 | self.description= """"P(q.alpha)= scale*f(q)^(2)+ bkg\n\ |
---|
| 42 | f(q)= 3*(scatter_sld- scatter_solvent)*V*[sin(q*r(Ra,Rb,alpha)) - q*r*cos(qr(Ra,Rb,alpha))] |
---|
| 43 | /[qr(Ra,Rb,alpha)]^(3)" |
---|
| 44 | r(Ra,Rb,alpha)= [Rb^(2)*(sin(alpha))^(2) + Ra^(2)*(cos(alpha))^(2)]^(1/2) |
---|
| 45 | scatter_sld: scattering length density of the scatter |
---|
| 46 | solvent_sld: scattering length density of the solvent |
---|
| 47 | V: volune of the Eliipsoid |
---|
| 48 | Ra: radius along the rotation axis of the Ellipsoid |
---|
| 49 | Rb: radius perpendicular to the rotation axis of the ellipsoid""" |
---|
[ae3ce4e] | 50 | ## Parameter details [units, min, max] |
---|
| 51 | self.details = {} |
---|
| 52 | self.details['scale'] = ['', None, None] |
---|
| 53 | self.details['radius_a'] = ['A', None, None] |
---|
| 54 | self.details['radius_b'] = ['A', None, None] |
---|
| 55 | self.details['contrast'] = ['A-2', None, None] |
---|
| 56 | self.details['background'] = ['cm-1', None, None] |
---|
| 57 | self.details['axis_theta'] = ['rad', None, None] |
---|
| 58 | self.details['axis_phi'] = ['rad', None, None] |
---|
| 59 | |
---|
| 60 | |
---|
| 61 | def clone(self): |
---|
| 62 | """ Return a identical copy of self """ |
---|
[9316609] | 63 | obj = EllipsoidModel() |
---|
| 64 | obj.params = copy.deepcopy(self.params) |
---|
| 65 | return obj |
---|
[ae3ce4e] | 66 | |
---|
| 67 | def run(self, x = 0.0): |
---|
| 68 | """ Evaluate the model |
---|
| 69 | @param x: input q, or [q,phi] |
---|
| 70 | @return: scattering function P(q) |
---|
| 71 | """ |
---|
| 72 | |
---|
| 73 | return CEllipsoidModel.run(self, x) |
---|
| 74 | |
---|
| 75 | def runXY(self, x = 0.0): |
---|
| 76 | """ Evaluate the model in cartesian coordinates |
---|
| 77 | @param x: input q, or [qx, qy] |
---|
| 78 | @return: scattering function P(q) |
---|
| 79 | """ |
---|
| 80 | |
---|
| 81 | return CEllipsoidModel.runXY(self, x) |
---|
| 82 | |
---|
| 83 | # End of file |
---|