source: sasview/sansmodels/src/sans/models/CoreFourShellModel.py @ 36f482f3

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 36f482f3 was b1c3295, checked in by Mathieu Doucet <doucetm@…>, 13 years ago

Re #4 This should clean up a whole bunch of C++ warnings.

  • Property mode set to 100644
File size: 6.1 KB
RevLine 
[ec658c85]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##############################################################################
[ec658c85]16
17
[79ac6f8]18"""
19Provide functionality for a C extension model
[ec658c85]20
[79ac6f8]21:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
[b1c3295]22         DO NOT MODIFY THIS FILE, MODIFY ../c_extensions/corefourshell.h
[79ac6f8]23         AND RE-RUN THE GENERATOR SCRIPT
[ec658c85]24
25"""
26
27from sans.models.BaseComponent import BaseComponent
[92df66f8]28from sans.models.sans_extension.c_models import CCoreFourShellModel
[ec658c85]29import copy   
[96656e3]30
31def create_CoreFourShellModel():
32    obj = CoreFourShellModel()
33    #CCoreFourShellModel.__init__(obj) is called by CoreFourShellModel constructor
34    return obj
35
[ec658c85]36class CoreFourShellModel(CCoreFourShellModel, BaseComponent):
[79ac6f8]37    """
38    Class that evaluates a CoreFourShellModel model.
[b1c3295]39    This file was auto-generated from ../c_extensions/corefourshell.h.
[79ac6f8]40    Refer to that file and the structure it contains
41    for details of the model.
[b1c3295]42    List of default parameters:
43         scale           = 1.0
44         rad_core0       = 60.0 [A]
45         sld_core0       = 6.4e-06 [1/A^(2)]
46         thick_shell1    = 10.0 [A]
47         sld_shell1      = 1e-06 [1/A^(2)]
48         thick_shell2    = 10.0 [A]
49         sld_shell2      = 2e-06 [1/A^(2)]
50         thick_shell3    = 10.0 [A]
51         sld_shell3      = 3e-06 [1/A^(2)]
52         thick_shell4    = 10.0 [A]
53         sld_shell4      = 4e-06 [1/A^(2)]
54         sld_solv        = 6.4e-06 [1/A^(2)]
55         background      = 0.001 [1/cm]
[ec658c85]56
57    """
58       
59    def __init__(self):
60        """ Initialization """
61       
62        # Initialize BaseComponent first, then sphere
63        BaseComponent.__init__(self)
[96656e3]64        #apply(CCoreFourShellModel.__init__, (self,))
[ec658c85]65        CCoreFourShellModel.__init__(self)
66       
67        ## Name of the model
68        self.name = "CoreFourShellModel"
69        ## Model description
[b1c3295]70        self.description =""" Calculates the scattering intensity from a core-4 shell structure.
71                scale = scale factor * volume fraction
72                rad_core0: the radius of the core
73                sld_core0: the SLD of the core
74                thick_shelli: the thickness of the i'th shell from the core
75                sld_shelli: the SLD of the i'th shell from the core
76                sld_solv: the SLD of the solvent
[ec658c85]77                background: incoherent background"""
78       
[b1c3295]79        ## Parameter details [units, min, max]
80        self.details = {}
81        self.details['scale'] = ['', None, None]
82        self.details['rad_core0'] = ['[A]', None, None]
83        self.details['sld_core0'] = ['[1/A^(2)]', None, None]
84        self.details['thick_shell1'] = ['[A]', None, None]
85        self.details['sld_shell1'] = ['[1/A^(2)]', None, None]
86        self.details['thick_shell2'] = ['[A]', None, None]
87        self.details['sld_shell2'] = ['[1/A^(2)]', None, None]
88        self.details['thick_shell3'] = ['[A]', None, None]
89        self.details['sld_shell3'] = ['[1/A^(2)]', None, None]
90        self.details['thick_shell4'] = ['[A]', None, None]
91        self.details['sld_shell4'] = ['[1/A^(2)]', None, None]
92        self.details['sld_solv'] = ['[1/A^(2)]', None, None]
93        self.details['background'] = ['[1/cm]', None, None]
[ec658c85]94
95        ## fittable parameters
[339ce67]96        self.fixed=['thick_shell4.width', 'thick_shell1.width', 'thick_shell2.width', 'thick_shell3.width', 'rad_core0.width']
[ec658c85]97       
[35aface]98        ## non-fittable parameters
[96656e3]99        self.non_fittable = []
[35aface]100       
[ec658c85]101        ## parameters with orientation
[96656e3]102        self.orientation_params = []
[c7a7e1b]103
104    def __setstate__(self, state):
105        """
106        restore the state of a model from pickle
107        """
108        self.__dict__, self.params, self.dispersion = state
109       
[96656e3]110    def __reduce_ex__(self, proto):
[79ac6f8]111        """
[96656e3]112        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
113        c model.
[79ac6f8]114        """
[c7a7e1b]115        state = (self.__dict__, self.params, self.dispersion)
116        return (create_CoreFourShellModel,tuple(), state, None, None)
[ec658c85]117       
[96656e3]118    def clone(self):
119        """ Return a identical copy of self """
120        return self._clone(CoreFourShellModel())   
[ec658c85]121       
122   
[79ac6f8]123    def run(self, x=0.0):
124        """
125        Evaluate the model
126       
127        :param x: input q, or [q,phi]
128       
129        :return: scattering function P(q)
130       
[ec658c85]131        """
132       
133        return CCoreFourShellModel.run(self, x)
134   
[79ac6f8]135    def runXY(self, x=0.0):
136        """
137        Evaluate the model in cartesian coordinates
138       
139        :param x: input q, or [qx, qy]
140       
141        :return: scattering function P(q)
142       
[ec658c85]143        """
144       
145        return CCoreFourShellModel.runXY(self, x)
146       
[79ac6f8]147    def evalDistribution(self, x=[]):
148        """
149        Evaluate the model in cartesian coordinates
150       
151        :param x: input q[], or [qx[], qy[]]
152       
153        :return: scattering function P(q[])
154       
[ec658c85]155        """
156        return CCoreFourShellModel.evalDistribution(self, x)
157       
158    def calculate_ER(self):
[79ac6f8]159        """
160        Calculate the effective radius for P(q)*S(q)
161       
162        :return: the value of the effective radius
163       
[ec658c85]164        """       
165        return CCoreFourShellModel.calculate_ER(self)
166       
167    def set_dispersion(self, parameter, dispersion):
168        """
[79ac6f8]169        Set the dispersion object for a model parameter
170       
171        :param parameter: name of the parameter [string]
172        :param dispersion: dispersion object of type DispersionModel
173       
[ec658c85]174        """
175        return CCoreFourShellModel.set_dispersion(self, parameter, dispersion.cdisp)
176       
177   
[b1c3295]178# End of file
Note: See TracBrowser for help on using the repository browser.