source: sasview/src/sans/models/FractalO_Z.py @ 81b524f

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 81b524f was 81b524f, checked in by Jeff Krzywon <jeffery.krzywon@…>, 11 years ago

This branch is now merged with the latest trunk release. I will merge them next.

  • Property mode set to 100644
File size: 5.4 KB
RevLine 
[81b524f]1##############################################################################
2# This software was developed by the University of Tennessee as part of the
3# Distributed Data Analysis of Neutron Scattering Experiments (DANSE)
4# project funded by the US National Science Foundation.
5#
6# If you use DANSE applications to do scientific research that leads to
7# publication, we ask that you acknowledge the use of the software with the
8# following sentence:
9#
10# This work benefited from DANSE software developed under NSF award DMR-0520547
11#
12# Copyright 2008-2011, University of Tennessee
13##############################################################################
14
15"""
16Provide functionality for a C extension model
17
18:WARNING: THIS FILE WAS GENERATED BY WRAPPERGENERATOR.PY
19         DO NOT MODIFY THIS FILE, MODIFY
20            src\sans\models\include\FractalQtoN.h
21         AND RE-RUN THE GENERATOR SCRIPT
22"""
23
24from sans.models.BaseComponent import BaseComponent
25from sans.models.sans_extension.c_models import CFractalO_Z
26
27def create_FractalO_Z():
28    """
29       Create a model instance
30    """
31    obj = FractalO_Z()
32    # CFractalO_Z.__init__(obj) is called by
33    # the FractalO_Z constructor
34    return obj
35
36class FractalO_Z(CFractalO_Z, BaseComponent):
37    """
38    Class that evaluates a FractalO_Z model.
39    This file was auto-generated from src\sans\models\include\FractalQtoN.h.
40    Refer to that file and the structure it contains
41    for details of the model.
42    List of default parameters:
43         scale           = 10000.0
44         m_fractal       = 1.8
45         cluster_rg      = 3520.0
46         s_fractal       = 2.5
47         primary_rg      = 82.0
48         background      = 0.01
49
50    """
51       
52    def __init__(self, multfactor=1):
53        """ Initialization """
54        self.__dict__ = {}
55       
56        # Initialize BaseComponent first, then sphere
57        BaseComponent.__init__(self)
58        #apply(CFractalO_Z.__init__, (self,))
59
60        CFractalO_Z.__init__(self)
61        self.is_multifunc = False
62                       
63        ## Name of the model
64        self.name = "FractalO_Z"
65        ## Model description
66        self.description = """
67        Structure factor for interacting particles:
68                Schmidt J Appl Cryst (1991), 24, 414-435 See equation (19)
69                Hurd; Schaefer; Martin, Phys Rev A (1987), 35, 2361-2364 See equation (2).
70        """
71       
72        ## Parameter details [units, min, max]
73        self.details = {}
74        self.details['scale'] = ['', None, None]
75        self.details['m_fractal'] = ['', None, None]
76        self.details['cluster_rg'] = ['', None, None]
77        self.details['s_fractal'] = ['', None, None]
78        self.details['primary_rg'] = ['', None, None]
79        self.details['background'] = ['', None, None]
80
81        ## fittable parameters
82        self.fixed = []
83       
84        ## non-fittable parameters
85        self.non_fittable = []
86       
87        ## parameters with orientation
88        self.orientation_params = []
89
90        ## parameters with magnetism
91        self.magnetic_params = []
92
93        self.category = None
94        self.multiplicity_info = None
95       
96    def __setstate__(self, state):
97        """
98        restore the state of a model from pickle
99        """
100        self.__dict__, self.params, self.dispersion = state
101       
102    def __reduce_ex__(self, proto):
103        """
104        Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of
105        c model.
106        """
107        state = (self.__dict__, self.params, self.dispersion)
108        return (create_FractalO_Z, tuple(), state, None, None)
109       
110    def clone(self):
111        """ Return a identical copy of self """
112        return self._clone(FractalO_Z())   
113       
114    def run(self, x=0.0):
115        """
116        Evaluate the model
117       
118        :param x: input q, or [q,phi]
119       
120        :return: scattering function P(q)
121       
122        """
123        return CFractalO_Z.run(self, x)
124   
125    def runXY(self, x=0.0):
126        """
127        Evaluate the model in cartesian coordinates
128       
129        :param x: input q, or [qx, qy]
130       
131        :return: scattering function P(q)
132       
133        """
134        return CFractalO_Z.runXY(self, x)
135       
136    def evalDistribution(self, x):
137        """
138        Evaluate the model in cartesian coordinates
139       
140        :param x: input q[], or [qx[], qy[]]
141       
142        :return: scattering function P(q[])
143       
144        """
145        return CFractalO_Z.evalDistribution(self, x)
146       
147    def calculate_ER(self):
148        """
149        Calculate the effective radius for P(q)*S(q)
150       
151        :return: the value of the effective radius
152       
153        """       
154        return CFractalO_Z.calculate_ER(self)
155       
156    def calculate_VR(self):
157        """
158        Calculate the volf ratio for P(q)*S(q)
159       
160        :return: the value of the volf ratio
161       
162        """       
163        return CFractalO_Z.calculate_VR(self)
164             
165    def set_dispersion(self, parameter, dispersion):
166        """
167        Set the dispersion object for a model parameter
168       
169        :param parameter: name of the parameter [string]
170        :param dispersion: dispersion object of type DispersionModel
171       
172        """
173        return CFractalO_Z.set_dispersion(self,
174               parameter, dispersion.cdisp)
175       
176   
177# End of file
178
Note: See TracBrowser for help on using the repository browser.