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

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 a1f2002 was 35aface, checked in by Jae Cho <jhjcho@…>, 14 years ago

addede new models and attr. non_fittable

  • Property mode set to 100644
File size: 5.7 KB
RevLine 
[27a0771]1#!/usr/bin/env python
2
[79ac6f8]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##############################################################################
[27a0771]16
17
[79ac6f8]18"""
19Provide functionality for a C extension model
[27a0771]20
[79ac6f8]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
[27a0771]24
25"""
26
27from sans.models.BaseComponent import BaseComponent
28from sans_extension.c_models import CLamellarPSModel
29import copy   
30   
31class LamellarPSModel(CLamellarPSModel, BaseComponent):
[79ac6f8]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:
[27a0771]38         scale           = 1.0
39         spacing         = 400.0 [A]
40         delta           = 30.0 [A]
[f10063e]41         sld_bi          = 6.3e-006 [1/A^(2)]
42         sld_sol         = 1e-006 [1/A^(2)]
[27a0771]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
[9188cc1]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
[fbe5d3e]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,
[f10063e]72                sld_bi = SLD_bilayer
73                sld_sol = SLD_solvent
[fbe5d3e]74                n_plate = # of Lamellar plates
75                caille = Caille parameter (<0.8 or <1)
76                background = incoherent bgd
77                scale = scale factor"""
[27a0771]78       
[fe9c19b4]79        ## Parameter details [units, min, max]
[27a0771]80        self.details = {}
81        self.details['scale'] = ['', None, None]
82        self.details['spacing'] = ['[A]', None, None]
83        self.details['delta'] = ['[A]', None, None]
[f10063e]84        self.details['sld_bi'] = ['[1/A^(2)]', None, None]
85        self.details['sld_sol'] = ['[1/A^(2)]', None, None]
[27a0771]86        self.details['n_plates'] = ['', None, None]
87        self.details['caille'] = ['', None, None]
88        self.details['background'] = ['[1/cm]', None, None]
89
[fe9c19b4]90        ## fittable parameters
[c1c29b6]91        self.fixed=['delta.width', 'spacing.width']
[27a0771]92       
[35aface]93        ## non-fittable parameters
94        self.non_fittable=[]
95       
[27a0771]96        ## parameters with orientation
97        self.orientation_params =[]
98   
99    def clone(self):
100        """ Return a identical copy of self """
101        return self._clone(LamellarPSModel())   
[fe9c19b4]102       
103    def __getstate__(self):
[79ac6f8]104        """
105        return object state for pickling and copying
106        """
[fe9c19b4]107        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log}
108       
109        return self.__dict__, model_state
110       
111    def __setstate__(self, state):
[79ac6f8]112        """
113        create object from pickled state
114       
115        :param state: the state of the current model
116       
117        """
[fe9c19b4]118       
119        self.__dict__, model_state = state
120        self.params = model_state['params']
121        self.dispersion = model_state['dispersion']
122        self.log = model_state['log']
123       
[27a0771]124   
[79ac6f8]125    def run(self, x=0.0):
126        """
127        Evaluate the model
128       
129        :param x: input q, or [q,phi]
130       
131        :return: scattering function P(q)
132       
[27a0771]133        """
134       
135        return CLamellarPSModel.run(self, x)
136   
[79ac6f8]137    def runXY(self, x=0.0):
138        """
139        Evaluate the model in cartesian coordinates
140       
141        :param x: input q, or [qx, qy]
142       
143        :return: scattering function P(q)
144       
[27a0771]145        """
146       
147        return CLamellarPSModel.runXY(self, x)
148       
[79ac6f8]149    def evalDistribution(self, x=[]):
150        """
151        Evaluate the model in cartesian coordinates
152       
153        :param x: input q[], or [qx[], qy[]]
154       
155        :return: scattering function P(q[])
156       
[9bd69098]157        """
[f9a1279]158        return CLamellarPSModel.evalDistribution(self, x)
[9bd69098]159       
[5eb9154]160    def calculate_ER(self):
[79ac6f8]161        """
162        Calculate the effective radius for P(q)*S(q)
163       
164        :return: the value of the effective radius
165       
[5eb9154]166        """       
167        return CLamellarPSModel.calculate_ER(self)
168       
[27a0771]169    def set_dispersion(self, parameter, dispersion):
170        """
[79ac6f8]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       
[27a0771]176        """
177        return CLamellarPSModel.set_dispersion(self, parameter, dispersion.cdisp)
178       
179   
180# End of file
Note: See TracBrowser for help on using the repository browser.