source: sasview/src/sans/models/LamellarPSModel.py @ d09f0ae1

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 d09f0ae1 was 400155b, checked in by gonzalezm, 10 years ago

Implementing request from ticket 261 - default number of bins in Annulus [Phi View] is now 36 and the first bin is now centered at 0 degrees

  • Property mode set to 100644
File size: 6.1 KB
RevLine 
[400155b]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::
19
20   THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
21   DO NOT MODIFY THIS FILE, MODIFY
22   src\sans\models\include\lamellarPS.h
23   AND RE-RUN THE GENERATOR SCRIPT
24"""
25
26from sans.models.BaseComponent import BaseComponent
27from sans.models.sans_extension.c_models import CLamellarPSModel
28
29def create_LamellarPSModel():
30    """
31       Create a model instance
32    """
33    obj = LamellarPSModel()
34    # CLamellarPSModel.__init__(obj) is called by
35    # the LamellarPSModel constructor
36    return obj
37
38class LamellarPSModel(CLamellarPSModel, BaseComponent):
39    """
40    Class that evaluates a LamellarPSModel model.
41    This file was auto-generated from src\sans\models\include\lamellarPS.h.
42    Refer to that file and the structure it contains
43    for details of the model.
44   
45    List of default parameters:
46
47    * scale           = 1.0
48    * spacing         = 400.0 [A]
49    * delta           = 30.0 [A]
50    * sld_bi          = 6.3e-06 [1/A^(2)]
51    * sld_sol         = 1e-06 [1/A^(2)]
52    * n_plates        = 20.0
53    * caille          = 0.1
54    * background      = 0.0 [1/cm]
55
56    """
57       
58    def __init__(self, multfactor=1):
59        """ Initialization """
60        self.__dict__ = {}
61       
62        # Initialize BaseComponent first, then sphere
63        BaseComponent.__init__(self)
64        #apply(CLamellarPSModel.__init__, (self,))
65
66        CLamellarPSModel.__init__(self)
67        self.is_multifunc = False
68                       
69        ## Name of the model
70        self.name = "LamellarPSModel"
71        ## Model description
72        self.description = """
73        [Concentrated Lamellar Form Factor] Calculates the scattered
74                intensity from a lyotropic lamellar phase.
75                The intensity (form factor and structure
76                factor)calculated is for lamellae of
77                uniform scattering length density that
78                are randomly distributed in solution
79                (a powder average). The lamellae thickness
80                is polydisperse. The model can also
81                be applied to large, multi-lamellar vesicles.
82                No resolution smeared version is included
83                in the structure factor of this model.
84                *Parameters: spacing = repeat spacing,
85                delta = bilayer thickness,
86                sld_bi = SLD_bilayer
87                sld_sol = SLD_solvent
88                n_plate = # of Lamellar plates
89                caille = Caille parameter (<0.8 or <1)
90                background = incoherent bgd
91                scale = scale factor
92        """
93       
94        ## Parameter details [units, min, max]
95        self.details = {}
96        self.details['scale'] = ['', None, None]
97        self.details['spacing'] = ['[A]', None, None]
98        self.details['delta'] = ['[A]', None, None]
99        self.details['sld_bi'] = ['[1/A^(2)]', None, None]
100        self.details['sld_sol'] = ['[1/A^(2)]', None, None]
101        self.details['n_plates'] = ['', None, None]
102        self.details['caille'] = ['', None, None]
103        self.details['background'] = ['[1/cm]', None, None]
104
105        ## fittable parameters
106        self.fixed = ['delta.width',
107                      'spacing.width']
108       
109        ## non-fittable parameters
110        self.non_fittable = []
111       
112        ## parameters with orientation
113        self.orientation_params = []
114
115        ## parameters with magnetism
116        self.magnetic_params = []
117
118        self.category = None
119        self.multiplicity_info = None
120       
121    def __setstate__(self, state):
122        """
123        restore the state of a model from pickle
124        """
125        self.__dict__, self.params, self.dispersion = state
126       
127    def __reduce_ex__(self, proto):
128        """
129        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
130        c model.
131        """
132        state = (self.__dict__, self.params, self.dispersion)
133        return (create_LamellarPSModel, tuple(), state, None, None)
134       
135    def clone(self):
136        """ Return a identical copy of self """
137        return self._clone(LamellarPSModel())   
138       
139    def run(self, x=0.0):
140        """
141        Evaluate the model
142       
143        :param x: input q, or [q,phi]
144       
145        :return: scattering function P(q)
146       
147        """
148        return CLamellarPSModel.run(self, x)
149   
150    def runXY(self, x=0.0):
151        """
152        Evaluate the model in cartesian coordinates
153       
154        :param x: input q, or [qx, qy]
155       
156        :return: scattering function P(q)
157       
158        """
159        return CLamellarPSModel.runXY(self, x)
160       
161    def evalDistribution(self, x):
162        """
163        Evaluate the model in cartesian coordinates
164       
165        :param x: input q[], or [qx[], qy[]]
166       
167        :return: scattering function P(q[])
168       
169        """
170        return CLamellarPSModel.evalDistribution(self, x)
171       
172    def calculate_ER(self):
173        """
174        Calculate the effective radius for P(q)*S(q)
175       
176        :return: the value of the effective radius
177       
178        """       
179        return CLamellarPSModel.calculate_ER(self)
180       
181    def calculate_VR(self):
182        """
183        Calculate the volf ratio for P(q)*S(q)
184       
185        :return: the value of the volf ratio
186       
187        """       
188        return CLamellarPSModel.calculate_VR(self)
189             
190    def set_dispersion(self, parameter, dispersion):
191        """
192        Set the dispersion object for a model parameter
193       
194        :param parameter: name of the parameter [string]
195        :param dispersion: dispersion object of type DispersionModel
196       
197        """
198        return CLamellarPSModel.set_dispersion(self,
199               parameter, dispersion.cdisp)
200       
201   
202# End of file
203
Note: See TracBrowser for help on using the repository browser.