source: sasview/src/sans/models/LamellarFFHGModel.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@…>, 10 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.9 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\lamellarFF_HG.h
21         AND RE-RUN THE GENERATOR SCRIPT
22"""
23
24from sans.models.BaseComponent import BaseComponent
25from sans.models.sans_extension.c_models import CLamellarFFHGModel
26
27def create_LamellarFFHGModel():
28    """
29       Create a model instance
30    """
31    obj = LamellarFFHGModel()
32    # CLamellarFFHGModel.__init__(obj) is called by
33    # the LamellarFFHGModel constructor
34    return obj
35
36class LamellarFFHGModel(CLamellarFFHGModel, BaseComponent):
37    """
38    Class that evaluates a LamellarFFHGModel model.
39    This file was auto-generated from src\sans\models\include\lamellarFF_HG.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         t_length        = 15.0 [A]
45         h_thickness     = 10.0 [A]
46         sld_tail        = 4e-07 [1/A^(2)]
47         sld_head        = 3e-06 [1/A^(2)]
48         sld_solvent     = 6e-06 [1/A^(2)]
49         background      = 0.0 [1/cm]
50
51    """
52       
53    def __init__(self, multfactor=1):
54        """ Initialization """
55        self.__dict__ = {}
56       
57        # Initialize BaseComponent first, then sphere
58        BaseComponent.__init__(self)
59        #apply(CLamellarFFHGModel.__init__, (self,))
60
61        CLamellarFFHGModel.__init__(self)
62        self.is_multifunc = False
63                       
64        ## Name of the model
65        self.name = "LamellarFFHGModel"
66        ## Model description
67        self.description = """
68         Parameters: t_length = tail length, h_thickness = head thickness,
69                scale = Scale factor,
70                background = incoherent Background
71                sld_tail = tail scattering length density ,
72                sld_solvent = solvent scattering length density.
73                NOTE: The total bilayer thickness
74                = 2(h_thickness+ t_length).
75               
76        """
77       
78        ## Parameter details [units, min, max]
79        self.details = {}
80        self.details['scale'] = ['', None, None]
81        self.details['t_length'] = ['[A]', None, None]
82        self.details['h_thickness'] = ['[A]', None, None]
83        self.details['sld_tail'] = ['[1/A^(2)]', None, None]
84        self.details['sld_head'] = ['[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 = ['t_length.width',
90                      'h_thickness.width']
91       
92        ## non-fittable parameters
93        self.non_fittable = []
94       
95        ## parameters with orientation
96        self.orientation_params = []
97
98        ## parameters with magnetism
99        self.magnetic_params = []
100
101        self.category = None
102        self.multiplicity_info = None
103       
104    def __setstate__(self, state):
105        """
106        restore the state of a model from pickle
107        """
108        self.__dict__, self.params, self.dispersion = state
109       
110    def __reduce_ex__(self, proto):
111        """
112        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
113        c model.
114        """
115        state = (self.__dict__, self.params, self.dispersion)
116        return (create_LamellarFFHGModel, tuple(), state, None, None)
117       
118    def clone(self):
119        """ Return a identical copy of self """
120        return self._clone(LamellarFFHGModel())   
121       
122    def run(self, x=0.0):
123        """
124        Evaluate the model
125       
126        :param x: input q, or [q,phi]
127       
128        :return: scattering function P(q)
129       
130        """
131        return CLamellarFFHGModel.run(self, x)
132   
133    def runXY(self, x=0.0):
134        """
135        Evaluate the model in cartesian coordinates
136       
137        :param x: input q, or [qx, qy]
138       
139        :return: scattering function P(q)
140       
141        """
142        return CLamellarFFHGModel.runXY(self, x)
143       
144    def evalDistribution(self, x):
145        """
146        Evaluate the model in cartesian coordinates
147       
148        :param x: input q[], or [qx[], qy[]]
149       
150        :return: scattering function P(q[])
151       
152        """
153        return CLamellarFFHGModel.evalDistribution(self, x)
154       
155    def calculate_ER(self):
156        """
157        Calculate the effective radius for P(q)*S(q)
158       
159        :return: the value of the effective radius
160       
161        """       
162        return CLamellarFFHGModel.calculate_ER(self)
163       
164    def calculate_VR(self):
165        """
166        Calculate the volf ratio for P(q)*S(q)
167       
168        :return: the value of the volf ratio
169       
170        """       
171        return CLamellarFFHGModel.calculate_VR(self)
172             
173    def set_dispersion(self, parameter, dispersion):
174        """
175        Set the dispersion object for a model parameter
176       
177        :param parameter: name of the parameter [string]
178        :param dispersion: dispersion object of type DispersionModel
179       
180        """
181        return CLamellarFFHGModel.set_dispersion(self,
182               parameter, dispersion.cdisp)
183       
184   
185# End of file
186
Note: See TracBrowser for help on using the repository browser.