source: sasview/sansmodels/src/sans/models/CSParallelepipedModel.py @ 02879ea

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 02879ea was 4628e31, checked in by Jae Cho <jhjcho@…>, 14 years ago

changed the unit of angles into degrees

  • Property mode set to 100644
File size: 6.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\csparallelepiped.h
23         AND RE-RUN THE GENERATOR SCRIPT
24
25"""
26
27from sans.models.BaseComponent import BaseComponent
28from sans_extension.c_models import CCSParallelepipedModel
29import copy   
30   
31class CSParallelepipedModel(CCSParallelepipedModel, BaseComponent):
32    """
33    Class that evaluates a CSParallelepipedModel model.
34    This file was auto-generated from ..\c_extensions\csparallelepiped.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         shortA          = 35.0 [A]
40         midB            = 75.0 [A]
41         longC           = 400.0 [A]
42         rimA            = 10.0 [A]
43         rimB            = 10.0 [A]
44         rimC            = 10.0 [A]
45         sld_rimA        = 2e-006 [1/A^(2)]
46         sld_rimB        = 4e-006 [1/A^(2)]
47         sld_rimC        = 2e-006 [1/A^(2)]
48         sld_pcore       = 1e-006 [1/A^(2)]
49         sld_solv        = 6e-006 [1/A^(2)]
50         background      = 0.06 [1/cm]
51         parallel_theta  = 0.0 [deg]
52         parallel_phi    = 0.0 [deg]
53         parallel_psi    = 0.0 [deg]
54
55    """
56       
57    def __init__(self):
58        """ Initialization """
59       
60        # Initialize BaseComponent first, then sphere
61        BaseComponent.__init__(self)
62        CCSParallelepipedModel.__init__(self)
63       
64        ## Name of the model
65        self.name = "CSParallelepipedModel"
66        ## Model description
67        self.description =""" Form factor for a rectangular Shell. Below are the Parameters.
68                scale: scale factor
69                shortA: length of short edge  [A]
70                midB: length of another short edge [A]
71                longC: length of long edge  of the parallelepiped [A]
72                rimA: length of short edge  [A]
73                rimB: length of another short edge [A]
74                rimC: length of long edge  of the parallelepiped [A]
75                sld_rimA: sld of rimA [1/A^(2)]
76                sld_rimB: sld of rimB [1/A^(2)]
77                sld_rimC: sld of rimC [1/A^(2)]
78                sld_core: Pipe_sld [1/A^(2)]
79                sld_solv: solvent_sld [1/A^(2)]
80                background: incoherent Background [1/cm]"""
81       
82        ## Parameter details [units, min, max]
83        self.details = {}
84        self.details['scale'] = ['', None, None]
85        self.details['shortA'] = ['[A]', None, None]
86        self.details['midB'] = ['[A]', None, None]
87        self.details['longC'] = ['[A]', None, None]
88        self.details['rimA'] = ['[A]', None, None]
89        self.details['rimB'] = ['[A]', None, None]
90        self.details['rimC'] = ['[A]', None, None]
91        self.details['sld_rimA'] = ['[1/A^(2)]', None, None]
92        self.details['sld_rimB'] = ['[1/A^(2)]', None, None]
93        self.details['sld_rimC'] = ['[1/A^(2)]', None, None]
94        self.details['sld_pcore'] = ['[1/A^(2)]', None, None]
95        self.details['sld_solv'] = ['[1/A^(2)]', None, None]
96        self.details['background'] = ['[1/cm]', None, None]
97        self.details['parallel_theta'] = ['[deg]', None, None]
98        self.details['parallel_phi'] = ['[deg]', None, None]
99        self.details['parallel_psi'] = ['[deg]', None, None]
100
101        ## fittable parameters
102        self.fixed=['shortA.width', 'midB.width', 'longC.width', 'parallel_phi.width', 'parallel_psi.width', 'parallel_theta.width']
103       
104        ## non-fittable parameters
105        self.non_fittable=[]
106       
107        ## parameters with orientation
108        self.orientation_params =['parallel_phi', 'parallel_psi', 'parallel_theta', 'parallel_phi.width', 'parallel_psi.width', 'parallel_theta.width']
109   
110    def clone(self):
111        """ Return a identical copy of self """
112        return self._clone(CSParallelepipedModel())   
113       
114    def __getstate__(self):
115        """
116        return object state for pickling and copying
117        """
118        model_state = {'params': self.params, 'dispersion': self.dispersion, 'log': self.log}
119       
120        return self.__dict__, model_state
121       
122    def __setstate__(self, state):
123        """
124        create object from pickled state
125       
126        :param state: the state of the current model
127       
128        """
129       
130        self.__dict__, model_state = state
131        self.params = model_state['params']
132        self.dispersion = model_state['dispersion']
133        self.log = model_state['log']
134       
135   
136    def run(self, x=0.0):
137        """
138        Evaluate the model
139       
140        :param x: input q, or [q,phi]
141       
142        :return: scattering function P(q)
143       
144        """
145       
146        return CCSParallelepipedModel.run(self, x)
147   
148    def runXY(self, x=0.0):
149        """
150        Evaluate the model in cartesian coordinates
151       
152        :param x: input q, or [qx, qy]
153       
154        :return: scattering function P(q)
155       
156        """
157       
158        return CCSParallelepipedModel.runXY(self, x)
159       
160    def evalDistribution(self, x=[]):
161        """
162        Evaluate the model in cartesian coordinates
163       
164        :param x: input q[], or [qx[], qy[]]
165       
166        :return: scattering function P(q[])
167       
168        """
169        return CCSParallelepipedModel.evalDistribution(self, x)
170       
171    def calculate_ER(self):
172        """
173        Calculate the effective radius for P(q)*S(q)
174       
175        :return: the value of the effective radius
176       
177        """       
178        return CCSParallelepipedModel.calculate_ER(self)
179       
180    def set_dispersion(self, parameter, dispersion):
181        """
182        Set the dispersion object for a model parameter
183       
184        :param parameter: name of the parameter [string]
185        :param dispersion: dispersion object of type DispersionModel
186       
187        """
188        return CCSParallelepipedModel.set_dispersion(self, parameter, dispersion.cdisp)
189       
190   
191# End of file
Note: See TracBrowser for help on using the repository browser.