source: sasview/sansmodels/src/sans/models/CoreShellCylinderModel.py @ 213892bc

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 213892bc 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.1 KB
RevLine 
[ae3ce4e]1#!/usr/bin/env python
[95986b5]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##############################################################################
[95986b5]16
17
[79ac6f8]18"""
19Provide functionality for a C extension model
[ae3ce4e]20
[79ac6f8]21:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
22         DO NOT MODIFY THIS FILE, MODIFY ..\c_extensions\core_shell_cylinder.h
23         AND RE-RUN THE GENERATOR SCRIPT
[ae3ce4e]24
25"""
26
27from sans.models.BaseComponent import BaseComponent
28from sans_extension.c_models import CCoreShellCylinderModel
29import copy   
[96656e3]30
31def create_CoreShellCylinderModel():
32    obj = CoreShellCylinderModel()
33    #CCoreShellCylinderModel.__init__(obj) is called by CoreShellCylinderModel constructor
34    return obj
35
[ae3ce4e]36class CoreShellCylinderModel(CCoreShellCylinderModel, BaseComponent):
[79ac6f8]37    """
38    Class that evaluates a CoreShellCylinderModel model.
39    This file was auto-generated from ..\c_extensions\core_shell_cylinder.h.
40    Refer to that file and the structure it contains
41    for details of the model.
42    List of default parameters:
[ae3ce4e]43         scale           = 1.0
[1ed3834]44         radius          = 20.0 [A]
45         thickness       = 10.0 [A]
46         length          = 400.0 [A]
[27972c1d]47         core_sld        = 1e-006 [1/A^(2)]
48         shell_sld       = 4e-006 [1/A^(2)]
49         solvent_sld     = 1e-006 [1/A^(2)]
[0824909]50         background      = 0.0 [1/cm]
[4628e31]51         axis_theta      = 90.0 [deg]
52         axis_phi        = 0.0 [deg]
[ae3ce4e]53
54    """
55       
56    def __init__(self):
57        """ Initialization """
58       
59        # Initialize BaseComponent first, then sphere
60        BaseComponent.__init__(self)
[96656e3]61        #apply(CCoreShellCylinderModel.__init__, (self,))
[ae3ce4e]62        CCoreShellCylinderModel.__init__(self)
63       
64        ## Name of the model
65        self.name = "CoreShellCylinderModel"
[836fe6e]66        ## Model description
[1ed3834]67        self.description ="""P(q,alpha)= scale/Vs*f(q)^(2) + bkg,  where: f(q)= 2(core_sld
68                - solvant_sld)* Vc*sin[qLcos(alpha/2)]
69                /[qLcos(alpha/2)]*J1(qRsin(alpha))
70                /[qRsin(alpha)]+2(shell_sld-solvent_sld)
71                *Vs*sin[q(L+T)cos(alpha/2)][[q(L+T)
72                *cos(alpha/2)]*J1(q(R+T)sin(alpha))
73                /q(R+T)sin(alpha)]
74               
75                alpha:is the angle between the axis of
76                the cylinder and the q-vector
[9316609]77                Vs: the volume of the outer shell
78                Vc: the volume of the core
79                L: the length of the core
[1ed3834]80                shell_sld: the scattering length density
81                of the shell
82                solvent_sld: the scattering length density
83                of the solvent
[9316609]84                bkg: the background
85                T: the thickness
86                R+T: is the outer radius
87                L+2T: The total length of the outershell
88                J1: the first order Bessel function
89                theta: axis_theta of the cylinder
[9bd69098]90                phi: the axis_phi of the cylinder..."""
[836fe6e]91       
[fe9c19b4]92        ## Parameter details [units, min, max]
[ae3ce4e]93        self.details = {}
94        self.details['scale'] = ['', None, None]
[1ed3834]95        self.details['radius'] = ['[A]', None, None]
96        self.details['thickness'] = ['[A]', None, None]
97        self.details['length'] = ['[A]', None, None]
[27972c1d]98        self.details['core_sld'] = ['[1/A^(2)]', None, None]
99        self.details['shell_sld'] = ['[1/A^(2)]', None, None]
100        self.details['solvent_sld'] = ['[1/A^(2)]', None, None]
[0824909]101        self.details['background'] = ['[1/cm]', None, None]
[4628e31]102        self.details['axis_theta'] = ['[deg]', None, None]
103        self.details['axis_phi'] = ['[deg]', None, None]
[836fe6e]104
[fe9c19b4]105        ## fittable parameters
[9bd69098]106        self.fixed=['axis_phi.width', 'axis_theta.width', 'length.width', 'radius.width', 'thickness.width']
[25a608f5]107       
[35aface]108        ## non-fittable parameters
[96656e3]109        self.non_fittable = []
[35aface]110       
[25a608f5]111        ## parameters with orientation
[96656e3]112        self.orientation_params = ['axis_phi', 'axis_theta', 'axis_phi.width', 'axis_theta.width']
[ae3ce4e]113   
[96656e3]114    def __reduce_ex__(self, proto):
[79ac6f8]115        """
[96656e3]116        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
117        c model.
[79ac6f8]118        """
[96656e3]119        return (create_CoreShellCylinderModel,tuple())
[fe9c19b4]120       
[96656e3]121    def clone(self):
122        """ Return a identical copy of self """
123        return self._clone(CoreShellCylinderModel())   
[fe9c19b4]124       
[ae3ce4e]125   
[79ac6f8]126    def run(self, x=0.0):
127        """
128        Evaluate the model
129       
130        :param x: input q, or [q,phi]
131       
132        :return: scattering function P(q)
133       
[ae3ce4e]134        """
135       
136        return CCoreShellCylinderModel.run(self, x)
137   
[79ac6f8]138    def runXY(self, x=0.0):
139        """
140        Evaluate the model in cartesian coordinates
141       
142        :param x: input q, or [qx, qy]
143       
144        :return: scattering function P(q)
145       
[ae3ce4e]146        """
147       
148        return CCoreShellCylinderModel.runXY(self, x)
[95986b5]149       
[79ac6f8]150    def evalDistribution(self, x=[]):
151        """
152        Evaluate the model in cartesian coordinates
153       
154        :param x: input q[], or [qx[], qy[]]
155       
156        :return: scattering function P(q[])
157       
[9bd69098]158        """
[f9a1279]159        return CCoreShellCylinderModel.evalDistribution(self, x)
[9bd69098]160       
[5eb9154]161    def calculate_ER(self):
[79ac6f8]162        """
163        Calculate the effective radius for P(q)*S(q)
164       
165        :return: the value of the effective radius
166       
[5eb9154]167        """       
168        return CCoreShellCylinderModel.calculate_ER(self)
169       
[95986b5]170    def set_dispersion(self, parameter, dispersion):
171        """
[79ac6f8]172        Set the dispersion object for a model parameter
173       
174        :param parameter: name of the parameter [string]
175        :param dispersion: dispersion object of type DispersionModel
176       
[95986b5]177        """
178        return CCoreShellCylinderModel.set_dispersion(self, parameter, dispersion.cdisp)
179       
[ae3ce4e]180   
181# End of file
Note: See TracBrowser for help on using the repository browser.