source: sasview/src/sans/models/FractalO_Z.py @ 400155b

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 400155b was 400155b, checked in by gonzalezm, 9 years ago

Implementing request from ticket 261 - default number of bins in Annulus [Phi View] is now 36 and the first bin is now centered at 0 degrees

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