source: sasview/src/sans/models/LamellarModel.py @ 81b524f

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 81b524f was 81b524f, checked in by Jeff Krzywon <jeffery.krzywon@…>, 11 years ago

This branch is now merged with the latest trunk release. I will merge them next.

  • Property mode set to 100644
File size: 5.5 KB
Line 
1##############################################################################
2# This software was developed by the University of Tennessee as part of the
3# Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
4# project funded by the US National Science Foundation.
5#
6# If you use DANSE applications to do scientific research that leads to
7# publication, we ask that you acknowledge the use of the software with the
8# following sentence:
9#
10# This work benefited from DANSE software developed under NSF award DMR-0520547
11#
12# Copyright 2008-2011, University of Tennessee
13##############################################################################
14
15"""
16Provide functionality for a C extension model
17
18:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
19         DO NOT MODIFY THIS FILE, MODIFY
20            src\sans\models\include\lamellar.h
21         AND RE-RUN THE GENERATOR SCRIPT
22"""
23
24from sans.models.BaseComponent import BaseComponent
25from sans.models.sans_extension.c_models import CLamellarModel
26
27def create_LamellarModel():
28    """
29       Create a model instance
30    """
31    obj = LamellarModel()
32    # CLamellarModel.__init__(obj) is called by
33    # the LamellarModel constructor
34    return obj
35
36class LamellarModel(CLamellarModel, BaseComponent):
37    """
38    Class that evaluates a LamellarModel model.
39    This file was auto-generated from src\sans\models\include\lamellar.h.
40    Refer to that file and the structure it contains
41    for details of the model.
42    List of default parameters:
43         scale           = 1.0
44         bi_thick        = 50.0 [A]
45         sld_bi          = 1e-06 [1/A^(2)]
46         sld_sol         = 6.3e-06 [1/A^(2)]
47         background      = 0.0 [1/cm]
48
49    """
50       
51    def __init__(self, multfactor=1):
52        """ Initialization """
53        self.__dict__ = {}
54       
55        # Initialize BaseComponent first, then sphere
56        BaseComponent.__init__(self)
57        #apply(CLamellarModel.__init__, (self,))
58
59        CLamellarModel.__init__(self)
60        self.is_multifunc = False
61                       
62        ## Name of the model
63        self.name = "LamellarModel"
64        ## Model description
65        self.description = """
66        [Dilute Lamellar Form Factor](from a lyotropic lamellar phase)
67                I(q)= 2*pi*P(q)/(delta *q^(2)), where
68                P(q)=2*(contrast/q)^(2)*(1-cos(q*delta))^(2))
69                bi_thick = bilayer thickness
70                sld_bi = SLD of bilayer
71                sld_sol = SLD of solvent
72                background = Incoherent background
73                scale = scale factor
74               
75        """
76       
77        ## Parameter details [units, min, max]
78        self.details = {}
79        self.details['scale'] = ['', None, None]
80        self.details['bi_thick'] = ['[A]', None, None]
81        self.details['sld_bi'] = ['[1/A^(2)]', None, None]
82        self.details['sld_sol'] = ['[1/A^(2)]', None, None]
83        self.details['background'] = ['[1/cm]', None, None]
84
85        ## fittable parameters
86        self.fixed = []
87       
88        ## non-fittable parameters
89        self.non_fittable = []
90       
91        ## parameters with orientation
92        self.orientation_params = []
93
94        ## parameters with magnetism
95        self.magnetic_params = []
96
97        self.category = None
98        self.multiplicity_info = None
99       
100    def __setstate__(self, state):
101        """
102        restore the state of a model from pickle
103        """
104        self.__dict__, self.params, self.dispersion = state
105       
106    def __reduce_ex__(self, proto):
107        """
108        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
109        c model.
110        """
111        state = (self.__dict__, self.params, self.dispersion)
112        return (create_LamellarModel, tuple(), state, None, None)
113       
114    def clone(self):
115        """ Return a identical copy of self """
116        return self._clone(LamellarModel())   
117       
118    def run(self, x=0.0):
119        """
120        Evaluate the model
121       
122        :param x: input q, or [q,phi]
123       
124        :return: scattering function P(q)
125       
126        """
127        return CLamellarModel.run(self, x)
128   
129    def runXY(self, x=0.0):
130        """
131        Evaluate the model in cartesian coordinates
132       
133        :param x: input q, or [qx, qy]
134       
135        :return: scattering function P(q)
136       
137        """
138        return CLamellarModel.runXY(self, x)
139       
140    def evalDistribution(self, x):
141        """
142        Evaluate the model in cartesian coordinates
143       
144        :param x: input q[], or [qx[], qy[]]
145       
146        :return: scattering function P(q[])
147       
148        """
149        return CLamellarModel.evalDistribution(self, x)
150       
151    def calculate_ER(self):
152        """
153        Calculate the effective radius for P(q)*S(q)
154       
155        :return: the value of the effective radius
156       
157        """       
158        return CLamellarModel.calculate_ER(self)
159       
160    def calculate_VR(self):
161        """
162        Calculate the volf ratio for P(q)*S(q)
163       
164        :return: the value of the volf ratio
165       
166        """       
167        return CLamellarModel.calculate_VR(self)
168             
169    def set_dispersion(self, parameter, dispersion):
170        """
171        Set the dispersion object for a model parameter
172       
173        :param parameter: name of the parameter [string]
174        :param dispersion: dispersion object of type DispersionModel
175       
176        """
177        return CLamellarModel.set_dispersion(self,
178               parameter, dispersion.cdisp)
179       
180   
181# End of file
182
Note: See TracBrowser for help on using the repository browser.