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

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 d6da3b1 was 96656e3, checked in by Jae Cho <jhjcho@…>, 14 years ago

update models due to changes of template

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