Changeset a34b811 in sasmodels
- Timestamp:
- Mar 28, 2019 5:02:53 PM (6 years ago)
- Branches:
- master, ticket-1257-vesicle-product, ticket_1156, ticket_822_more_unit_tests
- Children:
- db1d9d5
- Parents:
- e5cb3df
- Files:
-
- 73 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/beta/sasfit_compare.py
r119073a ra34b811 408 408 #radius_effective=12.59921049894873, 409 409 ) 410 target = sasmodels_theory(q, model, effective_radius_mode=0, structure_factor_mode=1, **pars)410 target = sasmodels_theory(q, model, radius_effective_mode=0, structure_factor_mode=1, **pars) 411 411 actual = ellipsoid_pe(q, norm='sasview', **pars) 412 412 title = " ".join(("sasmodels", model, pd_type)) -
explore/beta/sasfit_compare_new.py
r0b8a1fc ra34b811 360 360 #polydispersity for hollow_cylinder 361 361 def hollow_cylinder_pe(q,radius=20, thickness=10, length=80, sld=4, sld_solvent=1, volfraction=0.15, 362 radius_pd=0.1, thickness_pd=0.2, length_pd=0.05, radius_pd_type="gaussian", length_pd_type="gaussian", 362 radius_pd=0.1, thickness_pd=0.2, length_pd=0.05, radius_pd_type="gaussian", length_pd_type="gaussian", 363 363 thickness_pd_type="gaussian", radius_effective=None, background=0, scale=1, 364 364 norm='sasview'): … … 595 595 # this one is only used locally for "actual" 596 596 ) 597 target = sasmodels_theory(q, model, effective_radius_type=0, structure_factor_mode=1, **pars)597 target = sasmodels_theory(q, model, radius_effective_mode=0, structure_factor_mode=1, **pars) 598 598 actual = sphere_r(q, norm='sasview', **pars) 599 599 title = " ".join(("sasmodels", model, pd_type)) … … 612 612 background=0, 613 613 radius_pd=0.01, thickness_pd=0.01, radius_pd_type=pd_type, thickness_pd_type=pd_type, 614 radius_effective=30. ) 614 radius_effective=30. ) 615 615 # equivalent average sphere radius for local "actual" to match what sasview uses, use None to compute average outer radius here, 616 616 617 target = sasmodels_theory(q, model, effective_radius_type=0, structure_factor_mode=1, **pars)617 target = sasmodels_theory(q, model, radius_effective_mode=0, structure_factor_mode=1, **pars) 618 618 actual = vesicle_pe(q, norm='sasview', **pars) 619 619 title = " ".join(("sasmodels", model, pd_type)) … … 633 633 background=0, 634 634 radius_pd=0.1, thickness_pd=0.0, length_pd=0.0, radius_pd_type=pd_type, thickness_pd_type=pd_type, length_pd_type=pd_type, 635 radius_effective=40.687) 635 radius_effective=40.687) 636 636 # equivalent average sphere radius for local "actual" to match what sasview uses 637 target = sasmodels_theory(q, model, effective_radius_type=0, structure_factor_mode=1, **pars)637 target = sasmodels_theory(q, model, radius_effective_mode=0, structure_factor_mode=1, **pars) 638 638 actual = hollow_cylinder_pe(q, norm='sasview', **pars) 639 639 # RKH monodisp was OK, actual = hollow_cylinder_theta(q,radius=20, thickness=10, length=80, sld=4, sld_solvent=1 ) … … 656 656 # if change radius_effective to some other value, the S(Q) from sasview does not agree 657 657 ) 658 target = sasmodels_theory(q, model, effective_radius_type=0, structure_factor_mode=1, **pars)658 target = sasmodels_theory(q, model, radius_effective_mode=0, structure_factor_mode=1, **pars) 659 659 actual = ellipsoid_pe(q, norm='sasview', **pars) 660 660 # RKH test actual = ellipsoid_theta(q, radius_polar=20, radius_equatorial=400, sld=4, sld_solvent=1, volfraction=0.15, radius_effective=270.) -
sasmodels/direct_model.py
rd8e81f7 ra34b811 71 71 For solid objects V_shell is equal to V_form and the volume ratio is 1. 72 72 73 Use parameter *effective_radius_type* to select the effective radius THIS MIGHT NEED CHECKING radius_effective_mode or effecive_radius_type??? 74 calculation. 73 Use parameter *radius_effective_mode* to select the effective radius 74 calculation to use amongst the *radius_effective_modes* list given in the 75 model. 75 76 """ 76 77 R_eff_type = int(pars.pop(RADIUS_MODE_ID, 1.0)) -
sasmodels/generate.py
rb297ba9 ra34b811 27 27 which are hollow. 28 28 29 * effective_radius(mode, p1, p2, ...)* returns the effective radius of29 *radius_effective(mode, p1, p2, ...)* returns the effective radius of 30 30 the form with particular dimensions. Mode determines the type of 31 31 effective radius returned, with mode=1 for equivalent volume. … … 820 820 for p in partable.kernel_parameters)) 821 821 # Define the function calls 822 call_ effective_radius = "#define CALL_EFFECTIVE_RADIUS(_mode, _v) 0.0"822 call_radius_effective = "#define CALL_RADIUS_EFFECTIVE(_mode, _v) 0.0" 823 823 if partable.form_volume_parameters: 824 824 refs = _call_pars("_v.", partable.form_volume_parameters) … … 833 833 "do { _form = _shell = form_volume(%s); } " 834 834 "while (0)") % (",".join(refs)) 835 if model_info. effective_radius_type:836 call_ effective_radius= (837 "#define CALL_ EFFECTIVE_RADIUS(_mode, _v) "838 " effective_radius(_mode, %s)") % (",".join(refs))835 if model_info.radius_effective_modes: 836 call_radius_effective = ( 837 "#define CALL_RADIUS_EFFECTIVE(_mode, _v) " 838 "radius_effective(_mode, %s)") % (",".join(refs)) 839 839 else: 840 840 # Model doesn't have volume. We could make the kernel run a little … … 845 845 "do { _form = _shell = 1.0; } while (0)") 846 846 source.append(call_volume) 847 source.append(call_ effective_radius)847 source.append(call_radius_effective) 848 848 model_refs = _call_pars("_v.", partable.iq_parameters) 849 849 -
sasmodels/kernel.py
rb297ba9 ra34b811 78 78 """ 79 79 _, F2, _, shell_volume, _ = self.Fq(call_details, values, cutoff, 80 magnetic, effective_radius_type=0)80 magnetic, radius_effective_mode=0) 81 81 combined_scale = values[0]/shell_volume 82 82 background = values[1] … … 85 85 86 86 def Fq(self, call_details, values, cutoff, magnetic, 87 effective_radius_type=0):87 radius_effective_mode=0): 88 88 # type: (CallDetails, np.ndarray, np.ndarray, float, bool, int) -> np.ndarray 89 89 r""" … … 143 143 volume fraction of the particles. The model can have several 144 144 different ways to compute effective radius, with the 145 * effective_radius_type* parameter used to select amongst them. The145 *radius_effective_mode* parameter used to select amongst them. The 146 146 volume fraction of particles should be determined from the total 147 147 volume fraction of the form, not just the shell volume fraction. … … 153 153 """ 154 154 self._call_kernel(call_details, values, cutoff, magnetic, 155 effective_radius_type)155 radius_effective_mode) 156 156 #print("returned",self.q_input.q, self.result) 157 157 nout = 2 if self.info.have_Fq and self.dim == '1d' else 1 … … 165 165 form_volume = self.result[nout*self.q_input.nq + 1]/total_weight 166 166 shell_volume = self.result[nout*self.q_input.nq + 2]/total_weight 167 effective_radius= self.result[nout*self.q_input.nq + 3]/total_weight167 radius_effective = self.result[nout*self.q_input.nq + 3]/total_weight 168 168 if shell_volume == 0.: 169 169 shell_volume = 1. … … 171 171 if nout == 2 else None) 172 172 F2 = self.result[0:nout*self.q_input.nq:nout]/total_weight 173 return F1, F2, effective_radius, shell_volume, form_volume/shell_volume173 return F1, F2, radius_effective, shell_volume, form_volume/shell_volume 174 174 175 175 def release(self): … … 181 181 182 182 def _call_kernel(self, call_details, values, cutoff, magnetic, 183 effective_radius_type):183 radius_effective_mode): 184 184 # type: (CallDetails, np.ndarray, np.ndarray, float, bool, int) -> np.ndarray 185 185 """ -
sasmodels/kernel_iq.c
r12f4c19 ra34b811 27 27 // parameters in the parameter table. 28 28 // CALL_VOLUME(form, shell, table) : assign form and shell values 29 // CALL_ EFFECTIVE_RADIUS(type, table) : call the R_eff function29 // CALL_RADIUS_EFFECTIVE(mode, table) : call the R_eff function 30 30 // CALL_IQ(q, table) : call the Iq function for 1D calcs. 31 31 // CALL_IQ_A(q, table) : call the Iq function with |q| for 2D data. … … 285 285 pglobal double *result, // nq+1 return values, again with padding 286 286 const double cutoff, // cutoff in the dispersity weight product 287 int32_t effective_radius_type // which effective radius to compute287 int32_t radius_effective_mode // which effective radius to compute 288 288 ) 289 289 { … … 703 703 weighted_form += weight * form; 704 704 weighted_shell += weight * shell; 705 if ( effective_radius_type != 0) {706 weighted_radius += weight * CALL_ EFFECTIVE_RADIUS(effective_radius_type, local_values.table);705 if (radius_effective_mode != 0) { 706 weighted_radius += weight * CALL_RADIUS_EFFECTIVE(radius_effective_mode, local_values.table); 707 707 } 708 708 BUILD_ROTATION(); -
sasmodels/kernelcl.py
r069743a ra34b811 577 577 578 578 def _call_kernel(self, call_details, values, cutoff, magnetic, 579 effective_radius_type):579 radius_effective_mode): 580 580 # type: (CallDetails, np.ndarray, float, bool, int) -> np.ndarray 581 581 env = environment() … … 601 601 self._result_b, # Result storage. 602 602 self._as_dtype(cutoff), # Probability cutoff. 603 np.uint32( effective_radius_type), # R_eff mode.603 np.uint32(radius_effective_mode), # R_eff mode. 604 604 ] 605 605 -
sasmodels/kernelcuda.py
rb297ba9 ra34b811 473 473 474 474 def _call_kernel(self, call_details, values, cutoff, magnetic, 475 effective_radius_type):475 radius_effective_mode): 476 476 # type: (CallDetails, np.ndarray, float, bool, int) -> np.ndarray 477 477 … … 492 492 self._result_b, # Result storage. 493 493 self._as_dtype(cutoff), # Probability cutoff. 494 np.uint32( effective_radius_type), # R_eff mode.494 np.uint32(radius_effective_mode), # R_eff mode. 495 495 ] 496 496 grid = partition(self.q_input.nq) -
sasmodels/kerneldll.py
rb297ba9 ra34b811 403 403 404 404 def _call_kernel(self, call_details, values, cutoff, magnetic, 405 effective_radius_type):405 radius_effective_mode): 406 406 # type: (CallDetails, np.ndarray, float, bool, int) -> np.ndarray 407 407 … … 417 417 self.result.ctypes.data, # Result storage. 418 418 self._as_dtype(cutoff), # Probability cutoff. 419 effective_radius_type, # R_eff mode.419 radius_effective_mode, # R_eff mode. 420 420 ] 421 421 -
sasmodels/kernelpy.py
rb297ba9 ra34b811 172 172 volume = model_info.form_volume 173 173 shell = model_info.shell_volume 174 radius = model_info. effective_radius174 radius = model_info.radius_effective 175 175 self._volume = ((lambda: (shell(*volume_args), volume(*volume_args))) if shell and volume 176 176 else (lambda: [volume(*volume_args)]*2) if volume … … 180 180 else (lambda mode: 1.0)) 181 181 182 def _call_kernel(self, call_details, values, cutoff, magnetic, effective_radius_type):182 def _call_kernel(self, call_details, values, cutoff, magnetic, radius_effective_mode): 183 183 # type: (CallDetails, np.ndarray, np.ndarray, float, bool) -> np.ndarray 184 184 if magnetic: … … 186 186 #print("Calling python kernel") 187 187 #call_details.show(values) 188 radius = ((lambda: 0.0) if effective_radius_type == 0189 else (lambda: self._radius( effective_radius_type)))188 radius = ((lambda: 0.0) if radius_effective_mode == 0 189 else (lambda: self._radius(radius_effective_mode))) 190 190 self.result = _loops( 191 191 self._parameter_vector, self._form, self._volume, radius, -
sasmodels/modelinfo.py
rb297ba9 ra34b811 265 265 other sld parameters. The volume parameters are used for calls 266 266 to form_volume within the kernel (required for volume normalization), 267 to shell_volume (for hollow shapes), and to effective_radius(for267 to shell_volume (for hollow shapes), and to radius_effective (for 268 268 structure factor interactions) respectively. 269 269 … … 841 841 info.structure_factor = getattr(kernel_module, 'structure_factor', False) 842 842 # TODO: find Fq by inspection 843 info. effective_radius_type = getattr(kernel_module, 'effective_radius_type', None)843 info.radius_effective_modes = getattr(kernel_module, 'radius_effective_modes', None) 844 844 info.have_Fq = getattr(kernel_module, 'have_Fq', False) 845 845 info.profile_axes = getattr(kernel_module, 'profile_axes', ['x', 'y']) … … 848 848 info.source = getattr(kernel_module, 'source', []) 849 849 info.c_code = getattr(kernel_module, 'c_code', None) 850 info. effective_radius = getattr(kernel_module, 'effective_radius', None)850 info.radius_effective = getattr(kernel_module, 'radius_effective', None) 851 851 # TODO: check the structure of the tests 852 852 info.tests = getattr(kernel_module, 'tests', []) … … 961 961 #: List of options for computing the effective radius of the shape, 962 962 #: or None if the model is not usable as a form factor model. 963 effective_radius_type= None # type: List[str]963 radius_effective_modes = None # type: List[str] 964 964 #: List of C source files used to define the model. The source files 965 965 #: should define the *Iq* function, and possibly *Iqac* or *Iqabc* if the … … 989 989 #: monodisperse approximation for non-dilute solutions, P@S. The first 990 990 #: argument is the integer effective radius mode, with default 0. 991 effective_radius= None # type: Union[None, Callable[[int, np.ndarray], float]]991 radius_effective = None # type: Union[None, Callable[[int, np.ndarray], float]] 992 992 #: Returns *I(q, a, b, ...)* for parameters *a*, *b*, etc. defined 993 993 #: by the parameter table. *Iq* can be defined as a python function, or -
sasmodels/models/_spherepy.py
r0507e09 ra34b811 48 48 ---------------------------- 49 49 50 * **Author: P Kienzle** 51 * **Last Modified by:** 50 * **Author: P Kienzle** 51 * **Last Modified by:** 52 52 * **Last Reviewed by:** S King and P Parker **Date:** 2013/09/09 and 2014/01/06 53 53 * **Source added by :** Steve King **Date:** March 25, 2019 … … 83 83 return 1.333333333333333 * pi * radius ** 3 84 84 85 def effective_radius(mode, radius):85 def radius_effective(mode, radius): 86 86 """Calculate R_eff for sphere""" 87 return radius 87 return radius if mode else 0. 88 88 89 89 def Iq(q, sld, sld_solvent, radius): -
sasmodels/models/barbell.c
r99658f6 ra34b811 85 85 86 86 static double 87 effective_radius(int mode, double radius_bell, double radius, double length)87 radius_effective(int mode, double radius_bell, double radius, double length) 88 88 { 89 89 switch (mode) { -
sasmodels/models/barbell.py
r0507e09 ra34b811 126 126 source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "barbell.c"] 127 127 have_Fq = True 128 effective_radius_type= [128 radius_effective_modes = [ 129 129 "equivalent cylinder excluded volume", "equivalent volume sphere", 130 130 "radius", "half length", "half total length", -
sasmodels/models/capped_cylinder.c
r99658f6 ra34b811 107 107 108 108 static double 109 effective_radius(int mode, double radius, double radius_cap, double length)109 radius_effective(int mode, double radius, double radius_cap, double length) 110 110 { 111 111 switch (mode) { -
sasmodels/models/capped_cylinder.py
r0507e09 ra34b811 146 146 source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "capped_cylinder.c"] 147 147 have_Fq = True 148 effective_radius_type= [148 radius_effective_modes = [ 149 149 "equivalent cylinder excluded volume", "equivalent volume sphere", 150 150 "radius", "half length", "half total length", -
sasmodels/models/core_multi_shell.c
rd42dd4a ra34b811 26 26 27 27 static double 28 effective_radius(int mode, double core_radius, double fp_n, double thickness[])28 radius_effective(int mode, double core_radius, double fp_n, double thickness[]) 29 29 { 30 30 switch (mode) { -
sasmodels/models/core_multi_shell.py
r0507e09 ra34b811 108 108 source = ["lib/sas_3j1x_x.c", "core_multi_shell.c"] 109 109 have_Fq = True 110 effective_radius_type= ["outer radius", "core radius"]110 radius_effective_modes = ["outer radius", "core radius"] 111 111 112 112 def random(): -
sasmodels/models/core_shell_bicelle.c
r99658f6 ra34b811 60 60 61 61 static double 62 effective_radius(int mode, double radius, double thick_rim, double thick_face, double length)62 radius_effective(int mode, double radius, double thick_rim, double thick_face, double length) 63 63 { 64 64 switch (mode) { -
sasmodels/models/core_shell_bicelle.py
r0507e09 ra34b811 165 165 "core_shell_bicelle.c"] 166 166 have_Fq = True 167 effective_radius_type= [167 radius_effective_modes = [ 168 168 "excluded volume", "equivalent volume sphere", "outer rim radius", 169 169 "half outer thickness", "half diagonal", -
sasmodels/models/core_shell_bicelle_elliptical.c
r99658f6 ra34b811 35 35 36 36 static double 37 effective_radius(int mode, double r_minor, double x_core, double thick_rim, double thick_face, double length)37 radius_effective(int mode, double r_minor, double x_core, double thick_rim, double thick_face, double length) 38 38 { 39 39 switch (mode) { -
sasmodels/models/core_shell_bicelle_elliptical.py
r0507e09 ra34b811 155 155 "core_shell_bicelle_elliptical.c"] 156 156 have_Fq = True 157 effective_radius_type= [157 radius_effective_modes = [ 158 158 "equivalent cylinder excluded volume", "equivalent volume sphere", 159 159 "outer rim average radius", "outer rim min radius", -
sasmodels/models/core_shell_bicelle_elliptical_belt_rough.c
r99658f6 ra34b811 36 36 37 37 static double 38 effective_radius(int mode, double r_minor, double x_core, double thick_rim, double thick_face, double length)38 radius_effective(int mode, double r_minor, double x_core, double thick_rim, double thick_face, double length) 39 39 { 40 40 switch (mode) { -
sasmodels/models/core_shell_bicelle_elliptical_belt_rough.py
r0507e09 ra34b811 168 168 "core_shell_bicelle_elliptical_belt_rough.c"] 169 169 have_Fq = True 170 effective_radius_type= [170 radius_effective_modes = [ 171 171 "equivalent cylinder excluded volume", "equivalent volume sphere", 172 172 "outer rim average radius", "outer rim min radius", -
sasmodels/models/core_shell_cylinder.c
r99658f6 ra34b811 37 37 38 38 static double 39 effective_radius(int mode, double radius, double thickness, double length)39 radius_effective(int mode, double radius, double thickness, double length) 40 40 { 41 41 switch (mode) { -
sasmodels/models/core_shell_cylinder.py
r0507e09 ra34b811 141 141 source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "core_shell_cylinder.c"] 142 142 have_Fq = True 143 effective_radius_type= [143 radius_effective_modes = [ 144 144 "excluded volume", "equivalent volume sphere", "outer radius", "half outer length", 145 145 "half min outer dimension", "half max outer dimension", "half outer diagonal", -
sasmodels/models/core_shell_ellipsoid.c
r99658f6 ra34b811 68 68 69 69 static double 70 effective_radius(int mode, double radius_equat_core, double x_core, double thick_shell, double x_polar_shell)70 radius_effective(int mode, double radius_equat_core, double x_core, double thick_shell, double x_polar_shell) 71 71 { 72 72 const double radius_equat_tot = radius_equat_core + thick_shell; -
sasmodels/models/core_shell_ellipsoid.py
r0507e09 ra34b811 155 155 source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "core_shell_ellipsoid.c"] 156 156 have_Fq = True 157 effective_radius_type= [157 radius_effective_modes = [ 158 158 "average outer curvature", "equivalent volume sphere", 159 159 "min outer radius", "max outer radius", -
sasmodels/models/core_shell_parallelepiped.c
r99658f6 ra34b811 75 75 76 76 static double 77 effective_radius(int mode, double length_a, double length_b, double length_c,77 radius_effective(int mode, double length_a, double length_b, double length_c, 78 78 double thick_rim_a, double thick_rim_b, double thick_rim_c) 79 79 { -
sasmodels/models/core_shell_parallelepiped.py
r0507e09 ra34b811 236 236 source = ["lib/gauss76.c", "core_shell_parallelepiped.c"] 237 237 have_Fq = True 238 effective_radius_type= [238 radius_effective_modes = [ 239 239 "equivalent cylinder excluded volume", 240 240 "equivalent volume sphere", -
sasmodels/models/core_shell_sphere.c
rd42dd4a ra34b811 6 6 7 7 static double 8 effective_radius(int mode, double radius, double thickness)8 radius_effective(int mode, double radius, double thickness) 9 9 { 10 10 switch (mode) { -
sasmodels/models/core_shell_sphere.py
r0507e09 ra34b811 60 60 ---------------------------- 61 61 62 * **Author:** 63 * **Last Modified by:** 64 * **Last Reviewed by:** 62 * **Author:** 63 * **Last Modified by:** 64 * **Last Reviewed by:** 65 65 * **Source added by :** Steve King **Date:** March 25, 2019 66 66 """ … … 92 92 source = ["lib/sas_3j1x_x.c", "lib/core_shell.c", "core_shell_sphere.c"] 93 93 have_Fq = True 94 effective_radius_type= ["outer radius", "core radius"]94 radius_effective_modes = ["outer radius", "core radius"] 95 95 96 96 demo = dict(scale=1, background=0, radius=60, thickness=10, -
sasmodels/models/cylinder.c
r99658f6 ra34b811 32 32 33 33 static double 34 effective_radius(int mode, double radius, double length)34 radius_effective(int mode, double radius, double length) 35 35 { 36 36 switch (mode) { -
sasmodels/models/cylinder.py
r6652522 ra34b811 155 155 source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "cylinder.c"] 156 156 have_Fq = True 157 effective_radius_type= [157 radius_effective_modes = [ 158 158 "excluded volume", "equivalent volume sphere", "radius", 159 159 "half length", "half min dimension", "half max dimension", "half diagonal", -
sasmodels/models/ellipsoid.c
r99658f6 ra34b811 32 32 33 33 static double 34 effective_radius(int mode, double radius_polar, double radius_equatorial)34 radius_effective(int mode, double radius_polar, double radius_equatorial) 35 35 { 36 36 switch (mode) { -
sasmodels/models/ellipsoid.py
r0507e09 ra34b811 167 167 source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "ellipsoid.c"] 168 168 have_Fq = True 169 effective_radius_type= [169 radius_effective_modes = [ 170 170 "average curvature", "equivalent volume sphere", "min radius", "max radius", 171 171 ] -
sasmodels/models/elliptical_cylinder.c
r99658f6 ra34b811 41 41 42 42 static double 43 effective_radius(int mode, double radius_minor, double r_ratio, double length)43 radius_effective(int mode, double radius_minor, double r_ratio, double length) 44 44 { 45 45 switch (mode) { -
sasmodels/models/elliptical_cylinder.py
r0507e09 ra34b811 131 131 source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "elliptical_cylinder.c"] 132 132 have_Fq = True 133 effective_radius_type= [133 radius_effective_modes = [ 134 134 "equivalent cylinder excluded volume", 135 135 "equivalent volume sphere", "average radius", "min radius", "max radius", -
sasmodels/models/fuzzy_sphere.c
rd42dd4a ra34b811 5 5 6 6 static double 7 effective_radius(int mode, double radius, double fuzziness)7 radius_effective(int mode, double radius, double fuzziness) 8 8 { 9 9 switch (mode) { -
sasmodels/models/fuzzy_sphere.py
r0507e09 ra34b811 63 63 ---------------------------- 64 64 65 * **Author:** 66 * **Last Modified by:** 67 * **Last Reviewed by:** 65 * **Author:** 66 * **Last Modified by:** 67 * **Last Reviewed by:** 68 68 * **Source added by :** Steve King **Date:** March 25, 2019 69 69 """ … … 98 98 source = ["lib/sas_3j1x_x.c", "fuzzy_sphere.c"] 99 99 have_Fq = True 100 effective_radius_type= ["radius", "radius + fuzziness"]100 radius_effective_modes = ["radius", "radius + fuzziness"] 101 101 102 102 def random(): -
sasmodels/models/hollow_cylinder.c
r99658f6 ra34b811 34 34 35 35 static double 36 effective_radius(int mode, double radius, double thickness, double length)36 radius_effective(int mode, double radius, double thickness, double length) 37 37 { 38 38 switch (mode) { -
sasmodels/models/hollow_cylinder.py
r0507e09 ra34b811 110 110 source = ["lib/polevl.c", "lib/sas_J1.c", "lib/gauss76.c", "hollow_cylinder.c"] 111 111 have_Fq = True 112 effective_radius_type= [112 radius_effective_modes = [ 113 113 "excluded volume", "equivalent outer volume sphere", 114 114 "outer radius", "half length", -
sasmodels/models/hollow_rectangular_prism.c
r99658f6 ra34b811 30 30 31 31 static double 32 effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio, double thickness)32 radius_effective(int mode, double length_a, double b2a_ratio, double c2a_ratio, double thickness) 33 33 // NOTE length_a is external dimension! 34 34 { -
sasmodels/models/hollow_rectangular_prism.py
r0507e09 ra34b811 157 157 source = ["lib/gauss76.c", "hollow_rectangular_prism.c"] 158 158 have_Fq = True 159 effective_radius_type= [159 radius_effective_modes = [ 160 160 "equivalent cylinder excluded volume", "equivalent outer volume sphere", 161 161 "half length_a", "half length_b", "half length_c", -
sasmodels/models/hollow_rectangular_prism_thin_walls.c
r99658f6 ra34b811 26 26 27 27 static double 28 effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio)28 radius_effective(int mode, double length_a, double b2a_ratio, double c2a_ratio) 29 29 { 30 30 switch (mode) { -
sasmodels/models/hollow_rectangular_prism_thin_walls.py
r0507e09 ra34b811 117 117 source = ["lib/gauss76.c", "hollow_rectangular_prism_thin_walls.c"] 118 118 have_Fq = True 119 effective_radius_type= [119 radius_effective_modes = [ 120 120 "equivalent cylinder excluded volume", "equivalent outer volume sphere", 121 121 "half length_a", "half length_b", "half length_c", -
sasmodels/models/mono_gauss_coil.c
r153f8f6 ra34b811 6 6 7 7 static double 8 effective_radius(int mode, double rg)8 radius_effective(int mode, double rg) 9 9 { 10 10 switch (mode) { -
sasmodels/models/mono_gauss_coil.py
r0507e09 ra34b811 59 59 ---------------------------- 60 60 61 * **Author:** 62 * **Last Modified by:** 63 * **Last Reviewed by:** 61 * **Author:** 62 * **Last Modified by:** 63 * **Last Reviewed by:** 64 64 * **Source added by :** Steve King **Date:** March 25, 2019""" 65 65 … … 86 86 source = ["mono_gauss_coil.c"] 87 87 have_Fq = False 88 effective_radius_type= ["R_g", "2R_g", "3R_g", "sqrt(5/3)*R_g"]88 radius_effective_modes = ["R_g", "2R_g", "3R_g", "sqrt(5/3)*R_g"] 89 89 90 90 -
sasmodels/models/multilayer_vesicle.c
ree60aa7 ra34b811 48 48 49 49 static double 50 effective_radius(int mode, double radius, double thick_shell, double thick_solvent, double fp_n_shells)50 radius_effective(int mode, double radius, double thick_shell, double thick_solvent, double fp_n_shells) 51 51 { 52 52 // case 1: outer radius -
sasmodels/models/multilayer_vesicle.py
r0507e09 ra34b811 154 154 source = ["lib/sas_3j1x_x.c", "multilayer_vesicle.c"] 155 155 have_Fq = True 156 effective_radius_type= ["outer radius"]156 radius_effective_modes = ["outer radius"] 157 157 158 158 def random(): -
sasmodels/models/onion.c
ree60aa7 ra34b811 47 47 48 48 static double 49 effective_radius(int mode, double radius_core, double n_shells, double thickness[])49 radius_effective(int mode, double radius_core, double n_shells, double thickness[]) 50 50 { 51 51 // case 1: outer radius -
sasmodels/models/onion.py
r0507e09 ra34b811 182 182 ---------------------------- 183 183 184 * **Author:** 185 * **Last Modified by:** 186 * **Last Reviewed by:** 184 * **Author:** 185 * **Last Modified by:** 186 * **Last Reviewed by:** 187 187 * **Source added by :** Steve King **Date:** March 25, 2019 188 188 """ … … 329 329 single = False 330 330 have_Fq = True 331 effective_radius_type= ["outer radius"]331 radius_effective_modes = ["outer radius"] 332 332 333 333 profile_axes = ['Radius (A)', 'SLD (1e-6/A^2)'] -
sasmodels/models/parallelepiped.c
r99658f6 ra34b811 37 37 38 38 static double 39 effective_radius(int mode, double length_a, double length_b, double length_c)39 radius_effective(int mode, double length_a, double length_b, double length_c) 40 40 { 41 41 switch (mode) { -
sasmodels/models/parallelepiped.py
r0507e09 ra34b811 240 240 source = ["lib/gauss76.c", "parallelepiped.c"] 241 241 have_Fq = True 242 effective_radius_type= [242 radius_effective_modes = [ 243 243 "equivalent cylinder excluded volume", "equivalent volume sphere", 244 244 "half length_a", "half length_b", "half length_c", -
sasmodels/models/pearl_necklace.c
r9b5fd42 ra34b811 86 86 87 87 static double 88 effective_radius(int mode, double radius, double edge_sep, double thick_string, double fp_num_pearls)88 radius_effective(int mode, double radius, double edge_sep, double thick_string, double fp_num_pearls) 89 89 { 90 90 switch (mode) { -
sasmodels/models/pearl_necklace.py
r0507e09 ra34b811 65 65 ---------------------------- 66 66 67 * **Author:** 68 * **Last Modified by:** 69 * **Last Reviewed by:** 67 * **Author:** 68 * **Last Modified by:** 69 * **Last Reviewed by:** 70 70 * **Source added by :** Steve King **Date:** March 25, 2019 71 71 """ … … 111 111 source = ["lib/sas_Si.c", "lib/sas_3j1x_x.c", "pearl_necklace.c"] 112 112 single = False # use double precision unless told otherwise 113 effective_radius_type= ["equivalent volume sphere"]113 radius_effective_modes = ["equivalent volume sphere"] 114 114 115 115 def random(): -
sasmodels/models/poly_gauss_coil.py
r0507e09 ra34b811 58 58 ---------------------------- 59 59 60 * **Author:** 61 * **Last Modified by:** 62 * **Last Reviewed by:** 60 * **Author:** 61 * **Last Modified by:** 62 * **Last Reviewed by:** 63 63 * **Source added by :** Steve King **Date:** March 25, 2019 64 64 """ -
sasmodels/models/pringle.c
r99658f6 ra34b811 111 111 112 112 static double 113 effective_radius(int mode, double radius, double thickness, double alpha, double beta)113 radius_effective(int mode, double radius, double thickness, double alpha, double beta) 114 114 { 115 115 switch (mode) { -
sasmodels/models/pringle.py
r0507e09 ra34b811 85 85 source = ["lib/polevl.c", "lib/sas_J0.c", "lib/sas_J1.c", 86 86 "lib/sas_JN.c", "lib/gauss76.c", "pringle.c"] 87 effective_radius_type= [87 radius_effective_modes = [ 88 88 "equivalent cylinder excluded volume", 89 89 "equivalent volume sphere", -
sasmodels/models/raspberry.c
rd42dd4a ra34b811 15 15 16 16 static double 17 effective_radius(int mode, double radius_lg, double radius_sm, double penetration)17 radius_effective(int mode, double radius_lg, double radius_sm, double penetration) 18 18 { 19 19 switch (mode) { -
sasmodels/models/raspberry.py
r0507e09 ra34b811 161 161 162 162 source = ["lib/sas_3j1x_x.c", "raspberry.c"] 163 effective_radius_type= ["radius_large", "radius_outer"]163 radius_effective_modes = ["radius_large", "radius_outer"] 164 164 165 165 def random(): -
sasmodels/models/rectangular_prism.c
r99658f6 ra34b811 14 14 15 15 static double 16 effective_radius(int mode, double length_a, double b2a_ratio, double c2a_ratio)16 radius_effective(int mode, double length_a, double b2a_ratio, double c2a_ratio) 17 17 { 18 18 switch (mode) { -
sasmodels/models/rectangular_prism.py
r0507e09 ra34b811 110 110 ---------------------------- 111 111 112 * **Author:** 113 * **Last Modified by:** 114 * **Last Reviewed by:** 112 * **Author:** 113 * **Last Modified by:** 114 * **Last Reviewed by:** 115 115 * **Source added by :** Steve King **Date:** March 25, 2019 116 116 """ … … 151 151 source = ["lib/gauss76.c", "rectangular_prism.c"] 152 152 have_Fq = True 153 effective_radius_type= [153 radius_effective_modes = [ 154 154 "equivalent cylinder excluded volume", "equivalent volume sphere", 155 155 "half length_a", "half length_b", "half length_c", -
sasmodels/models/sphere.c
ree60aa7 ra34b811 5 5 6 6 static double 7 effective_radius(int mode, double radius)7 radius_effective(int mode, double radius) 8 8 { 9 9 // case 1: radius -
sasmodels/models/sphere.py
r6140894 ra34b811 81 81 source = ["lib/sas_3j1x_x.c", "sphere.c"] 82 82 have_Fq = True 83 effective_radius_type= ["radius"]83 radius_effective_modes = ["radius"] 84 84 85 85 def random(): … … 99 99 0.2, 792.0646662454202, 1166737.0473152, 120.0, 7246723.820358589, 1.0], # the longer list here checks F1, F2, R_eff, volume, volume_ratio = call_Fq(kernel, pars) 100 100 # But note P(Q) = F2/volume 101 # F and F^2 are "unscaled", with for n <F F*>S(q) or for beta approx I(q) = n [<F F*> + <F><F*> (S(q) - 1)] 102 # for n the number density and <.> the orientation average, and F = integral rho(r) exp(i q . r) dr. 103 # The number density is volume fraction divided by particle volume. 101 # F and F^2 are "unscaled", with for n <F F*>S(q) or for beta approx I(q) = n [<F F*> + <F><F*> (S(q) - 1)] 102 # for n the number density and <.> the orientation average, and F = integral rho(r) exp(i q . r) dr. 103 # The number density is volume fraction divided by particle volume. 104 104 # Effectively, this leaves F = V drho form, where form is the usual 3 j1(qr)/(qr) or whatever depending on the shape. 105 105 # [{"@S": "hardsphere"}, … … 124 124 "structure_factor_mode": 1, # 0 = normal decoupling approximation, 1 = beta(Q) approx 125 125 "radius_effective_mode": 0 # this used r_eff =0 or default 50? 126 }, 0.01, 1324.7375636587356 ], 126 }, 0.01, 1324.7375636587356 ], 127 127 [{"@S": "hardsphere", 128 128 "radius": 120., "radius_pd": 0.2, "radius_pd_n":45, … … 131 131 "structure_factor_mode": 1, # 0 = normal decoupling approximation, 1 = beta(Q) approx 132 132 "radius_effective_mode": 1 # this used 120 ??? 133 }, 0.01, 1579.2858949296565 ] 133 }, 0.01, 1579.2858949296565 ] 134 134 ] 135 135 # putting None for expected result will pass the test if there are no errors from the routine, but without any check on the value of the result -
sasmodels/models/spherical_sld.c
ree60aa7 ra34b811 19 19 20 20 static double 21 effective_radius(int mode, double fp_n_shells, double thickness[], double interface[])21 radius_effective(int mode, double fp_n_shells, double thickness[], double interface[]) 22 22 { 23 23 // case 1: outer radius -
sasmodels/models/spherical_sld.py
r0507e09 ra34b811 232 232 single = False # TODO: fix low q behaviour 233 233 have_Fq = True 234 effective_radius_type= ["outer radius"]234 radius_effective_modes = ["outer radius"] 235 235 236 236 profile_axes = ['Radius (A)', 'SLD (1e-6/A^2)'] -
sasmodels/models/triaxial_ellipsoid.c
r99658f6 ra34b811 76 76 77 77 static double 78 effective_radius(int mode, double radius_equat_minor, double radius_equat_major, double radius_polar)78 radius_effective(int mode, double radius_equat_minor, double radius_equat_major, double radius_polar) 79 79 { 80 80 switch (mode) { -
sasmodels/models/triaxial_ellipsoid.py
r0507e09 ra34b811 164 164 source = ["lib/sas_3j1x_x.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] 165 165 have_Fq = True 166 effective_radius_type= [166 radius_effective_modes = [ 167 167 "equivalent biaxial ellipsoid average curvature", 168 168 "equivalent volume sphere", "min radius", "max radius", -
sasmodels/models/vesicle.c
r12f4c19 ra34b811 13 13 14 14 static double 15 effective_radius(int mode, double radius, double thickness)15 radius_effective(int mode, double radius, double thickness) 16 16 { 17 17 // case 1: outer radius -
sasmodels/models/vesicle.py
r0507e09 ra34b811 107 107 source = ["lib/sas_3j1x_x.c", "vesicle.c"] 108 108 have_Fq = True 109 effective_radius_type= ["outer radius"]109 radius_effective_modes = ["outer radius"] 110 110 111 111 def random(): -
sasmodels/product.py
rd8e81f7 ra34b811 31 31 # pylint: enable=unused-import 32 32 33 # TODO: make estimates available to constraints33 # TODO: make shape averages available to constraints 34 34 #ESTIMATED_PARAMETERS = [ 35 # ["est_radius_effective", "A", 0.0, [0, np.inf], "", "Estimated effective radius"], 36 # ["est_volume_ratio", "", 1.0, [0, np.inf], "", "Estimated volume ratio"], 35 # ["mean_radius_effective", "A", 0.0, [0, np.inf], "", "mean effective radius"], 36 # ["mean_volume", "A", 0.0, [0, np.inf], "", "mean volume"], 37 # ["mean_volume_ratio", "", 1.0, [0, np.inf], "", "mean form: mean shell volume ratio"], 37 38 #] 38 # NOTE there are radius_effective_mode, effective_radius_type, but only structure_factor_mode39 39 STRUCTURE_MODE_ID = "structure_factor_mode" 40 40 RADIUS_MODE_ID = "radius_effective_mode" … … 44 44 # type: (ModelInfo) -> List[Parameter] 45 45 """ 46 Create parameters for structure _factor_type and radius_effective_type.46 Create parameters for structure factor and effective radius modes. 47 47 """ 48 48 pars = [] … … 56 56 "Structure factor calculation") 57 57 pars.append(par) 58 if p_info. effective_radius_typeis not None:58 if p_info.radius_effective_modes is not None: 59 59 par = parse_parameter( 60 60 RADIUS_MODE_ID, 61 61 "", 62 62 1, 63 [["unconstrained"] + p_info. effective_radius_type],63 [["unconstrained"] + p_info.radius_effective_modes], 64 64 "", 65 65 "Effective radius calculation") … … 177 177 S, # type: np.ndarray 178 178 scale, # type: float 179 effective_radius, # type: float179 radius_effective, # type: float 180 180 beta_mode, # type: bool 181 181 ): … … 193 193 ("beta(Q)", F1**2 / F2), 194 194 ("S_eff(Q)", 1 + (F1**2 / F2)*(S-1)), 195 ("effective_radius", effective_radius),195 ("effective_radius", radius_effective), 196 196 # ("I(Q)", scale*(F2 + (F1**2)*(S-1)) + bg), 197 197 )) … … 200 200 ("P(Q)", scale*F2), 201 201 ("S(Q)", S), 202 ("effective_radius", effective_radius),202 ("effective_radius", radius_effective), 203 203 )) 204 204 return parts … … 281 281 # R_eff type parameter is the second parameter after P and S parameters 282 282 # unless the model doesn't support beta mode, in which case it is first 283 have_radius_type = p_info. effective_radius_typeis not None283 have_radius_type = p_info.radius_effective_modes is not None 284 284 #print(p_npars,s_npars) 285 285 radius_type_offset = 2+p_npars+s_npars + (1 if have_beta_mode else 0) … … 333 333 # Call the form factor kernel to compute <F> and <F^2>. 334 334 # If the model doesn't support Fq the returned <F> will be None. 335 F1, F2, effective_radius, shell_volume, volume_ratio = self.p_kernel.Fq(335 F1, F2, radius_effective, shell_volume, volume_ratio = self.p_kernel.Fq( 336 336 p_details, p_values, cutoff, magnetic, radius_type) 337 337 … … 343 343 # implementation details in kernel_iq.c. 344 344 print("R_eff=%d:%g, volfrac=%g, volume ratio=%g" 345 % (radius_type, effective_radius, volfrac, volume_ratio))345 % (radius_type, radius_effective, volfrac, volume_ratio)) 346 346 if radius_type > 0: 347 347 # set the value to the model R_eff and set the weight to 1 348 s_values[2] = s_values[2+s_npars+s_offset[0]] = effective_radius348 s_values[2] = s_values[2+s_npars+s_offset[0]] = radius_effective 349 349 s_values[2+s_npars+s_offset[0]+nweights] = 1.0 350 350 s_values[3] = s_values[2+s_npars+s_offset[1]] = volfrac*volume_ratio … … 372 372 # the results directly rather than through a lazy evaluator. 373 373 self.results = lambda: _intermediates( 374 F1, F2, S, combined_scale, effective_radius, beta_mode)374 F1, F2, S, combined_scale, radius_effective, beta_mode) 375 375 376 376 return final_result -
sasmodels/sasview_model.py
rb297ba9 ra34b811 299 299 attrs['category'] = model_info.category 300 300 attrs['is_structure_factor'] = model_info.structure_factor 301 attrs['is_form_factor'] = model_info. effective_radius_typeis not None301 attrs['is_form_factor'] = model_info.radius_effective_modes is not None 302 302 attrs['is_multiplicity_model'] = variants[0] > 1 303 303 attrs['multiplicity_info'] = variants … … 763 763 # if er_mode > 0: 764 764 # res = calculator.Fq(call_details, values, cutoff=self.cutoff, 765 # magnetic=False, effective_radius_type=mode)765 # magnetic=False, radius_effective_mode=mode) 766 766 # R_eff, form_shell_ratio = res[2], res[4] 767 767 # return R_eff, form_shell_ratio
Note: See TracChangeset
for help on using the changeset viewer.