Changeset 5a22548 in sasmodels
- Timestamp:
- Oct 10, 2016 11:13:49 AM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 20a70bc
- Parents:
- e77872e (diff), 2f2c70c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- sasmodels
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/sasview_model.py
red10b57 r2f2c70c 127 127 model = _make_model_from_info(model_info) 128 128 129 # If we are trying to load a model that already exists, 130 # append a version number to its name. 131 # Note that models appear to be periodically reloaded 132 # by SasView and keeping track of whether we are reloading 133 # a model or loading it for the first time is tricky. 134 # For now, just allow one custom model of a given name. 135 if model.name in MODELS: 136 model.name = "%s_v2" % model.name 129 # If a model name already exists and we are loading a different model, 130 # use the model file name as the model name. 131 if model.name in MODELS and not model.filename == MODELS[model.name].filename: 132 _previous_name = model.name 133 model.name = model.id 134 135 # If the new model name is still in the model list (for instance, 136 # if we put a cylinder.py in our plug-in directory), then append 137 # an identifier. 138 if model.name in MODELS and not model.filename == MODELS[model.name].filename: 139 model.name = model.id + '_user' 140 logging.info("Model %s already exists: using %s [%s]", _previous_name, model.name, model.filename) 137 141 138 142 MODELS[model.name] = model … … 163 167 attrs = _generate_model_attributes(model_info) 164 168 attrs['__init__'] = __init__ 169 attrs['filename'] = model_info.filename 165 170 ConstructedModel = type(model_info.name, (SasviewModel,), attrs) # type: SasviewModelType 166 171 return ConstructedModel … … 320 325 else: 321 326 hidden = set() 327 if self._model_info.structure_factor: 328 hidden.add('scale') 329 hidden.add('background') 330 self._model_info.parameters.defaults['background'] = 0. 322 331 323 332 self._persistency_dict = {} … … 668 677 return [self.multiplicity], [1.0] 669 678 else: 670 return [np.NaN], [1.0] 679 # For hidden parameters use the default value. 680 value = self._model_info.parameters.defaults.get(par.name, np.NaN) 681 return [value], [1.0] 671 682 elif par.polydisperse: 672 683 dis = self.dispersion[par.name] … … 689 700 cylinder = Cylinder() 690 701 return cylinder.evalDistribution([0.1, 0.1]) 702 703 def test_structure_factor(): 704 # type: () -> float 705 """ 706 Test that a sasview model (cylinder) can be run. 707 """ 708 Model = _make_standard_model('hardsphere') 709 model = Model() 710 value = model.evalDistribution([0.1, 0.1]) 711 if np.isnan(value): 712 raise ValueError("hardsphere returns null") 691 713 692 714 def test_rpa(): -
sasmodels/models/multilayer_vesicle.py
r9a4811a re77872e 5 5 This model is a trivial extension of the core_shell_sphere function to include 6 6 *N* shells where the core is filled with solvent and the shells are interleaved 7 with layers of solvent. For *N = 1*, this returns the same as the vesicle model. 8 The shell thicknessess and SLD are constant across all shells as expected for 7 with layers of solvent. For *N = 1*, this returns the same as the vesicle model, 8 except for the normalisation, which here is to outermost volume. 9 The shell thicknessess and SLD are constant for all shells as expected for 9 10 a multilayer vesicle. 10 11 … … 24 25 .. note: 25 26 The outer most radius 26 $radius + n_pairs * thicn_shell + (n_pairs - 1) * thick_solvent$ 27 is used as the effective radius for *S(Q)* when $P(Q) * S(Q)$ is applied. 27 $radius + n_pairs * thick_shell + (n_pairs - 1) * thick_solvent$ 28 is used for both the volume fraction normalization and for the 29 effective radius for *S(Q)* when $P(Q) * S(Q)$ is applied. 28 30 29 31 For information about polarised and magnetic scattering, see … … 62 64 sld_solvent: solvent scattering length density 63 65 sld: shell scattering length density 64 n_pairs:number of pairs of water/shell66 n_pairs:number of "shell plus solvent" layer pairs 65 67 background: incoherent background 66 68 """ … … 71 73 parameters = [ 72 74 ["volfraction", "", 0.05, [0.0, 1], "", "volume fraction of vesicles"], 73 ["radius", "Ang", 60.0, [0.0, inf], "", " Core radius of the multishell"],74 ["thick_shell", "Ang", 10.0, [0.0, inf], "", " Shell thickness"],75 ["thick_solvent", "Ang", 10.0, [0.0, inf], "", " Water thickness"],76 ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "sld", " Corescattering length density"],75 ["radius", "Ang", 60.0, [0.0, inf], "", "radius of solvent filled core"], 76 ["thick_shell", "Ang", 10.0, [0.0, inf], "", "thickness of one shell"], 77 ["thick_solvent", "Ang", 10.0, [0.0, inf], "", "solvent thickness between shells"], 78 ["sld_solvent", "1e-6/Ang^2", 6.4, [-inf, inf], "sld", "solvent scattering length density"], 77 79 ["sld", "1e-6/Ang^2", 0.4, [-inf, inf], "sld", "Shell scattering length density"], 78 ["n_pairs", "", 2.0, [1.0, inf], "", "Number of pairs of water and shell"],80 ["n_pairs", "", 2.0, [1.0, inf], "", "Number of shell plus solvent layer pairs"], 79 81 ] 80 82 # pylint: enable=bad-whitespace, line-too-long -
sasmodels/models/vesicle.py
r42356c8 re77872e 75 75 thickness: the shell thickness 76 76 sld: the shell SLD 77 sld_s lovent: the solvent (and core) SLD77 sld_solvent: the solvent (and core) SLD 78 78 background: incoherent background 79 79 volfraction: shell volume fraction
Note: See TracChangeset
for help on using the changeset viewer.