[400155b] | 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 | """ |
---|
| 16 | Provide 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\spheroid.h |
---|
| 23 | AND RE-RUN THE GENERATOR SCRIPT |
---|
| 24 | """ |
---|
| 25 | |
---|
| 26 | from sans.models.BaseComponent import BaseComponent |
---|
| 27 | from sans.models.sans_extension.c_models import CCoreShellEllipsoidModel |
---|
| 28 | |
---|
| 29 | def create_CoreShellEllipsoidModel(): |
---|
| 30 | """ |
---|
| 31 | Create a model instance |
---|
| 32 | """ |
---|
| 33 | obj = CoreShellEllipsoidModel() |
---|
| 34 | # CCoreShellEllipsoidModel.__init__(obj) is called by |
---|
| 35 | # the CoreShellEllipsoidModel constructor |
---|
| 36 | return obj |
---|
| 37 | |
---|
| 38 | class CoreShellEllipsoidModel(CCoreShellEllipsoidModel, BaseComponent): |
---|
| 39 | """ |
---|
| 40 | Class that evaluates a CoreShellEllipsoidModel model. |
---|
| 41 | This file was auto-generated from src\sans\models\include\spheroid.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 = 1.0 |
---|
| 48 | * equat_core = 200.0 [A] |
---|
| 49 | * polar_core = 20.0 [A] |
---|
| 50 | * equat_shell = 250.0 [A] |
---|
| 51 | * polar_shell = 30.0 [A] |
---|
| 52 | * sld_core = 2e-06 [1/A^(2)] |
---|
| 53 | * sld_shell = 1e-06 [1/A^(2)] |
---|
| 54 | * sld_solvent = 6.3e-06 [1/A^(2)] |
---|
| 55 | * background = 0.001 [1/cm] |
---|
| 56 | * axis_theta = 0.0 [deg] |
---|
| 57 | * axis_phi = 0.0 [deg] |
---|
| 58 | |
---|
| 59 | """ |
---|
| 60 | |
---|
| 61 | def __init__(self, multfactor=1): |
---|
| 62 | """ Initialization """ |
---|
| 63 | self.__dict__ = {} |
---|
| 64 | |
---|
| 65 | # Initialize BaseComponent first, then sphere |
---|
| 66 | BaseComponent.__init__(self) |
---|
| 67 | #apply(CCoreShellEllipsoidModel.__init__, (self,)) |
---|
| 68 | |
---|
| 69 | CCoreShellEllipsoidModel.__init__(self) |
---|
| 70 | self.is_multifunc = False |
---|
| 71 | |
---|
| 72 | ## Name of the model |
---|
| 73 | self.name = "CoreShellEllipsoidModel" |
---|
| 74 | ## Model description |
---|
| 75 | self.description = """ |
---|
| 76 | [SpheroidCoreShellModel] Calculates the form factor for an spheroid |
---|
| 77 | ellipsoid particle with a core_shell structure. |
---|
| 78 | The form factor is averaged over all possible |
---|
| 79 | orientations of the ellipsoid such that P(q) |
---|
| 80 | = scale*<f^2>/Vol + bkg, where f is the |
---|
| 81 | single particle scattering amplitude. |
---|
| 82 | [Parameters]: |
---|
| 83 | equat_core = equatorial radius of core, |
---|
| 84 | polar_core = polar radius of core, |
---|
| 85 | equat_shell = equatorial radius of shell, |
---|
| 86 | polar_shell = polar radius (revolution axis) of shell, |
---|
| 87 | sld_core = SLD_core |
---|
| 88 | sld_shell = SLD_shell |
---|
| 89 | sld_solvent = SLD_solvent |
---|
| 90 | background = Incoherent bkg |
---|
| 91 | scale =scale |
---|
| 92 | Note:It is the users' responsibility to ensure |
---|
| 93 | that shell radii are larger than core radii. |
---|
| 94 | oblate: polar radius < equatorial radius |
---|
| 95 | prolate : polar radius > equatorial radius |
---|
| 96 | """ |
---|
| 97 | |
---|
| 98 | ## Parameter details [units, min, max] |
---|
| 99 | self.details = {} |
---|
| 100 | self.details['scale'] = ['', None, None] |
---|
| 101 | self.details['equat_core'] = ['[A]', None, None] |
---|
| 102 | self.details['polar_core'] = ['[A]', None, None] |
---|
| 103 | self.details['equat_shell'] = ['[A]', None, None] |
---|
| 104 | self.details['polar_shell'] = ['[A]', None, None] |
---|
| 105 | self.details['sld_core'] = ['[1/A^(2)]', None, None] |
---|
| 106 | self.details['sld_shell'] = ['[1/A^(2)]', None, None] |
---|
| 107 | self.details['sld_solvent'] = ['[1/A^(2)]', None, None] |
---|
| 108 | self.details['background'] = ['[1/cm]', None, None] |
---|
| 109 | self.details['axis_theta'] = ['[deg]', None, None] |
---|
| 110 | self.details['axis_phi'] = ['[deg]', None, None] |
---|
| 111 | |
---|
| 112 | ## fittable parameters |
---|
| 113 | self.fixed = ['equat_core.width', |
---|
| 114 | 'polar_core.width', |
---|
| 115 | 'equat_shell.width', |
---|
| 116 | 'polar_shell.width', |
---|
| 117 | 'axis_phi.width', |
---|
| 118 | 'axis_theta.width'] |
---|
| 119 | |
---|
| 120 | ## non-fittable parameters |
---|
| 121 | self.non_fittable = [] |
---|
| 122 | |
---|
| 123 | ## parameters with orientation |
---|
| 124 | self.orientation_params = ['axis_phi', |
---|
| 125 | 'axis_theta', |
---|
| 126 | 'axis_phi.width', |
---|
| 127 | 'axis_theta.width'] |
---|
| 128 | |
---|
| 129 | ## parameters with magnetism |
---|
| 130 | self.magnetic_params = [] |
---|
| 131 | |
---|
| 132 | self.category = None |
---|
| 133 | self.multiplicity_info = None |
---|
| 134 | |
---|
| 135 | def __setstate__(self, state): |
---|
| 136 | """ |
---|
| 137 | restore the state of a model from pickle |
---|
| 138 | """ |
---|
| 139 | self.__dict__, self.params, self.dispersion = state |
---|
| 140 | |
---|
| 141 | def __reduce_ex__(self, proto): |
---|
| 142 | """ |
---|
| 143 | Overwrite the __reduce_ex__ of PyTypeObject *type call in the init of |
---|
| 144 | c model. |
---|
| 145 | """ |
---|
| 146 | state = (self.__dict__, self.params, self.dispersion) |
---|
| 147 | return (create_CoreShellEllipsoidModel, tuple(), state, None, None) |
---|
| 148 | |
---|
| 149 | def clone(self): |
---|
| 150 | """ Return a identical copy of self """ |
---|
| 151 | return self._clone(CoreShellEllipsoidModel()) |
---|
| 152 | |
---|
| 153 | def run(self, x=0.0): |
---|
| 154 | """ |
---|
| 155 | Evaluate the model |
---|
| 156 | |
---|
| 157 | :param x: input q, or [q,phi] |
---|
| 158 | |
---|
| 159 | :return: scattering function P(q) |
---|
| 160 | |
---|
| 161 | """ |
---|
| 162 | return CCoreShellEllipsoidModel.run(self, x) |
---|
| 163 | |
---|
| 164 | def runXY(self, x=0.0): |
---|
| 165 | """ |
---|
| 166 | Evaluate the model in cartesian coordinates |
---|
| 167 | |
---|
| 168 | :param x: input q, or [qx, qy] |
---|
| 169 | |
---|
| 170 | :return: scattering function P(q) |
---|
| 171 | |
---|
| 172 | """ |
---|
| 173 | return CCoreShellEllipsoidModel.runXY(self, x) |
---|
| 174 | |
---|
| 175 | def evalDistribution(self, x): |
---|
| 176 | """ |
---|
| 177 | Evaluate the model in cartesian coordinates |
---|
| 178 | |
---|
| 179 | :param x: input q[], or [qx[], qy[]] |
---|
| 180 | |
---|
| 181 | :return: scattering function P(q[]) |
---|
| 182 | |
---|
| 183 | """ |
---|
| 184 | return CCoreShellEllipsoidModel.evalDistribution(self, x) |
---|
| 185 | |
---|
| 186 | def calculate_ER(self): |
---|
| 187 | """ |
---|
| 188 | Calculate the effective radius for P(q)*S(q) |
---|
| 189 | |
---|
| 190 | :return: the value of the effective radius |
---|
| 191 | |
---|
| 192 | """ |
---|
| 193 | return CCoreShellEllipsoidModel.calculate_ER(self) |
---|
| 194 | |
---|
| 195 | def calculate_VR(self): |
---|
| 196 | """ |
---|
| 197 | Calculate the volf ratio for P(q)*S(q) |
---|
| 198 | |
---|
| 199 | :return: the value of the volf ratio |
---|
| 200 | |
---|
| 201 | """ |
---|
| 202 | return CCoreShellEllipsoidModel.calculate_VR(self) |
---|
| 203 | |
---|
| 204 | def set_dispersion(self, parameter, dispersion): |
---|
| 205 | """ |
---|
| 206 | Set the dispersion object for a model parameter |
---|
| 207 | |
---|
| 208 | :param parameter: name of the parameter [string] |
---|
| 209 | :param dispersion: dispersion object of type DispersionModel |
---|
| 210 | |
---|
| 211 | """ |
---|
| 212 | return CCoreShellEllipsoidModel.set_dispersion(self, |
---|
| 213 | parameter, dispersion.cdisp) |
---|
| 214 | |
---|
| 215 | |
---|
| 216 | # End of file |
---|
| 217 | |
---|