source: sasview/sansmodels/src/sans/models/LamellarPSModel.py @ 6d48919

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 6d48919 was 79ac6f8, checked in by Gervaise Alina <gervyh@…>, 14 years ago

working on documentation

  • 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\lamellarPS.h
23         AND RE-RUN THE GENERATOR SCRIPT
24
25"""
26
27from sans.models.BaseComponent import BaseComponent
28from sans_extension.c_models import CLamellarPSModel
29import copy   
30   
31class LamellarPSModel(CLamellarPSModel, BaseComponent):
32    """
33    Class that evaluates a LamellarPSModel model.
34    This file was auto-generated from ..\c_extensions\lamellarPS.h.
35    Refer to that file and the structure it contains
36    for details of the model.
37    List of default parameters:
38         scale           = 1.0
39         spacing         = 400.0 [A]
40         delta           = 30.0 [A]
41         sld_bi          = 6.3e-006 [1/A^(2)]
42         sld_sol         = 1e-006 [1/A^(2)]
43         n_plates        = 20.0
44         caille          = 0.1
45         background      = 0.0 [1/cm]
46
47    """
48       
49    def __init__(self):
50        """ Initialization """
51       
52        # Initialize BaseComponent first, then sphere
53        BaseComponent.__init__(self)
54        CLamellarPSModel.__init__(self)
55       
56        ## Name of the model
57        self.name = "LamellarPSModel"
58        ## Model description
59        self.description ="""[Concentrated Lamellar Form Factor] Calculates the scattered
60                intensity from a lyotropic lamellar phase.
61                The intensity (form factor and structure
62                factor)calculated is for lamellae of
63                uniform scattering length density that
64                are randomly distributed in solution
65                (a powder average). The lamellae thickness
66                is polydisperse. The model can also
67                be applied to large, multi-lamellar vesicles.
68                No resolution smeared version is included
69                in the structure factor of this model.
70                *Parameters: spacing = repeat spacing,
71                delta = bilayer thickness,
72                sld_bi = SLD_bilayer
73                sld_sol = SLD_solvent
74                n_plate = # of Lamellar plates
75                caille = Caille parameter (<0.8 or <1)
76                background = incoherent bgd
77                scale = scale factor"""
78       
79        ## Parameter details [units, min, max]
80        self.details = {}
81        self.details['scale'] = ['', None, None]
82        self.details['spacing'] = ['[A]', None, None]
83        self.details['delta'] = ['[A]', None, None]
84        self.details['sld_bi'] = ['[1/A^(2)]', None, None]
85        self.details['sld_sol'] = ['[1/A^(2)]', None, None]
86        self.details['n_plates'] = ['', None, None]
87        self.details['caille'] = ['', None, None]
88        self.details['background'] = ['[1/cm]', None, None]
89
90        ## fittable parameters
91        self.fixed=['delta.width', 'spacing.width']
92       
93        ## parameters with orientation
94        self.orientation_params =[]
95   
96    def clone(self):
97        """ Return a identical copy of self """
98        return self._clone(LamellarPSModel())   
99       
100    def __getstate__(self):
101        """
102        return object state for pickling and copying
103        """
104        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log}
105       
106        return self.__dict__, model_state
107       
108    def __setstate__(self, state):
109        """
110        create object from pickled state
111       
112        :param state: the state of the current model
113       
114        """
115       
116        self.__dict__, model_state = state
117        self.params = model_state['params']
118        self.dispersion = model_state['dispersion']
119        self.log = model_state['log']
120       
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       
132        return CLamellarPSModel.run(self, x)
133   
134    def runXY(self, x=0.0):
135        """
136        Evaluate the model in cartesian coordinates
137       
138        :param x: input q, or [qx, qy]
139       
140        :return: scattering function P(q)
141       
142        """
143       
144        return CLamellarPSModel.runXY(self, x)
145       
146    def evalDistribution(self, x=[]):
147        """
148        Evaluate the model in cartesian coordinates
149       
150        :param x: input q[], or [qx[], qy[]]
151       
152        :return: scattering function P(q[])
153       
154        """
155        return CLamellarPSModel.evalDistribution(self, x)
156       
157    def calculate_ER(self):
158        """
159        Calculate the effective radius for P(q)*S(q)
160       
161        :return: the value of the effective radius
162       
163        """       
164        return CLamellarPSModel.calculate_ER(self)
165       
166    def set_dispersion(self, parameter, dispersion):
167        """
168        Set the dispersion object for a model parameter
169       
170        :param parameter: name of the parameter [string]
171        :param dispersion: dispersion object of type DispersionModel
172       
173        """
174        return CLamellarPSModel.set_dispersion(self, parameter, dispersion.cdisp)
175       
176   
177# End of file
Note: See TracBrowser for help on using the repository browser.