source: sasview/sansmodels/src/sans/models/LamellarPCrystalModel.py @ 34c2649

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 34c2649 was 92df66f8, checked in by Gervaise Alina <gervyh@…>, 13 years ago

commit wrap model

  • Property mode set to 100644
File size: 5.6 KB
Line 
1#!/usr/bin/env python
2
3##############################################################################
4#       This software was developed by the University of Tennessee as part of the
5#       Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
6#       project funded by the US National Science Foundation.
7#
8#       If you use DANSE applications to do scientific research that leads to
9#       publication, we ask that you acknowledge the use of the software with the
10#       following sentence:
11#
12#       "This work benefited from DANSE software developed under NSF award DMR-0520547."
13#
14#       copyright 2008, University of Tennessee
15##############################################################################
16
17
18"""
19Provide functionality for a C extension model
20
21:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
22         DO NOT MODIFY THIS FILE, MODIFY ..\c_extensions\lamellarPC.h
23         AND RE-RUN THE GENERATOR SCRIPT
24
25"""
26
27from sans.models.BaseComponent import BaseComponent
28from sans.models.sans_extension.c_models import CLamellarPCrystalModel
29import copy   
30
31def create_LamellarPCrystalModel():
32    obj = LamellarPCrystalModel()
33    #CLamellarPCrystalModel.__init__(obj) is called by LamellarPCrystalModel constructor
34    return obj
35
36class LamellarPCrystalModel(CLamellarPCrystalModel, BaseComponent):
37    """
38    Class that evaluates a LamellarPCrystalModel model.
39    This file was auto-generated from ..\c_extensions\lamellarPC.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         thickness       = 33.0 [A]
45         Nlayers         = 20.0
46         spacing         = 250.0 [A]
47         pd_spacing      = 0.0
48         sld_layer       = 1e-06 [1/A^(2)]
49         sld_solvent     = 6.34e-06 [1/A^(2)]
50         background      = 0.0 [1/cm]
51
52    """
53       
54    def __init__(self):
55        """ Initialization """
56       
57        # Initialize BaseComponent first, then sphere
58        BaseComponent.__init__(self)
59        #apply(CLamellarPCrystalModel.__init__, (self,))
60        CLamellarPCrystalModel.__init__(self)
61       
62        ## Name of the model
63        self.name = "LamellarPCrystalModel"
64        ## Model description
65        self.description ="""[Lamellar ParaCrystal Model] Parameter Definitions: scale = scale factor,
66                background = incoherent background
67                thickness = lamellar thickness,
68                sld_layer = layer scattering length density ,
69                sld_solvent = solvent scattering length density.
70                Nlayers = no. of lamellar layers
71                spacing = spacing between layers
72                pd_spacing = polydispersity of spacing
73                Note: This model can be used for large
74                multilamellar vesicles.
75                """
76       
77        ## Parameter details [units, min, max]
78        self.details = {}
79        self.details['scale'] = ['', None, None]
80        self.details['thickness'] = ['[A]', None, None]
81        self.details['Nlayers'] = ['', None, None]
82        self.details['spacing'] = ['[A]', None, None]
83        self.details['pd_spacing'] = ['', None, None]
84        self.details['sld_layer'] = ['[1/A^(2)]', None, None]
85        self.details['sld_solvent'] = ['[1/A^(2)]', None, None]
86        self.details['background'] = ['[1/cm]', None, None]
87
88        ## fittable parameters
89        self.fixed=['thickness.width']
90       
91        ## non-fittable parameters
92        self.non_fittable = []
93       
94        ## parameters with orientation
95        self.orientation_params = []
96
97    def __setstate__(self, state):
98        """
99        restore the state of a model from pickle
100        """
101        self.__dict__, self.params, self.dispersion = state
102       
103    def __reduce_ex__(self, proto):
104        """
105        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
106        c model.
107        """
108        state = (self.__dict__, self.params, self.dispersion)
109        return (create_LamellarPCrystalModel,tuple(), state, None, None)
110       
111    def clone(self):
112        """ Return a identical copy of self """
113        return self._clone(LamellarPCrystalModel())   
114       
115   
116    def run(self, x=0.0):
117        """
118        Evaluate the model
119       
120        :param x: input q, or [q,phi]
121       
122        :return: scattering function P(q)
123       
124        """
125       
126        return CLamellarPCrystalModel.run(self, x)
127   
128    def runXY(self, x=0.0):
129        """
130        Evaluate the model in cartesian coordinates
131       
132        :param x: input q, or [qx, qy]
133       
134        :return: scattering function P(q)
135       
136        """
137       
138        return CLamellarPCrystalModel.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 CLamellarPCrystalModel.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 CLamellarPCrystalModel.calculate_ER(self)
159       
160    def set_dispersion(self, parameter, dispersion):
161        """
162        Set the dispersion object for a model parameter
163       
164        :param parameter: name of the parameter [string]
165        :param dispersion: dispersion object of type DispersionModel
166       
167        """
168        return CLamellarPCrystalModel.set_dispersion(self, parameter, dispersion.cdisp)
169       
170   
171# End of file
Note: See TracBrowser for help on using the repository browser.