Changeset a1c91c2 in sasmodels
- Timestamp:
- Mar 16, 2016 3:40:30 PM (9 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 4c05f49
- Parents:
- bf227cd (diff), 310ddcb (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/convert.py
r667a6f2 r310ddcb 4 4 import warnings 5 5 6 STRUCTURE_FACTORS = [7 'hardsphere',8 'stickyhardsphere',9 'squarewell',10 'HayterMSAsq'11 ]12 6 # List of models which SasView versions don't contain the explicit 'scale' argument. 13 7 # When converting such a model, please update this list. 14 MODELS_WITHOUT_SCALE = STRUCTURE_FACTORS +[8 MODELS_WITHOUT_SCALE = [ 15 9 'teubner_strey', 16 10 'broad_peak', … … 27 21 # List of models which SasView versions don't contain the explicit 'background' argument. 28 22 # When converting such a model, please update this list. 29 MODELS_WITHOUT_BACKGROUND = STRUCTURE_FACTORS +[23 MODELS_WITHOUT_BACKGROUND = [ 30 24 'guinier', 31 25 ] … … 128 122 # Note: update compare.constrain_pars to match 129 123 name = model_info['id'] 130 if name in MODELS_WITHOUT_SCALE :124 if name in MODELS_WITHOUT_SCALE or model_info['structure_factor']: 131 125 if oldpars.pop('scale', 1.0) != 1.0: 132 126 warnings.warn("parameter scale not used in sasview %s"%name) 133 if name in MODELS_WITHOUT_BACKGROUND :127 if name in MODELS_WITHOUT_BACKGROUND or model_info['structure_factor']: 134 128 if oldpars.pop('background', 0.0) != 0.0: 135 129 warnings.warn("parameter background not used in sasview %s"%name) … … 161 155 name = model_info['id'] 162 156 # Note: update convert.revert_model to match 163 if name in MODELS_WITHOUT_SCALE :157 if name in MODELS_WITHOUT_SCALE or model_info['structure_factor']: 164 158 pars['scale'] = 1 165 if name in MODELS_WITHOUT_BACKGROUND :159 if name in MODELS_WITHOUT_BACKGROUND or model_info['structure_factor']: 166 160 pars['background'] = 0 167 161 # sasview multiplies background by structure factor -
sasmodels/models/mono_gauss_coil.py
rcb97bff rbf227cd 8 8 This model strictly describes the scattering from *monodisperse* polymer chains in theta solvents or polymer melts, conditions under which the distances between segments follow a Gaussian distribution. Provided the number of segments is large (ie, high molecular weight polymers) the single-chain form factor P(Q) is that described by Debye (1947). 9 9 10 To describe the scattering from *polydisperse* polymer chains, see the poly_gauss_coilmodel.10 To describe the scattering from *polydisperse* polymer chains, see the To describe the scattering from *monodisperse* polymer chains, see the :ref:`poly_gauss_coil <poly-gauss-coil>` model. 11 11 12 12 Definition 13 13 ---------- 14 14 15 *I(q)* = *scale* |cdot| * P(q)* + *background*15 *I(q)* = *scale* |cdot| *I* \ :sub:`0` |cdot| *P(q)* + *background* 16 16 17 17 where 18 18 19 * scale*= |phi|\ :sub:`poly` |cdot| *V* |cdot| (|rho|\ :sub:`poly` - |rho|\ :sub:`solv`)\ :sup:`2`19 *I*\ :sub:`0` = |phi|\ :sub:`poly` |cdot| *V* |cdot| (|rho|\ :sub:`poly` - |rho|\ :sub:`solv`)\ :sup:`2` 20 20 21 21 *P(q)* = 2 [exp(-Z) + Z - 1] / Z \ :sup:`2` … … 28 28 29 29 Here, |phi|\ :sub:`poly` is the volume fraction of polymer, *V* is the volume of a polymer coil, *M* is the molecular weight of the polymer, *N*\ :sub:`A` is Avogadro's Number, |delta| is the bulk density of the polymer, |rho|\ :sub:`poly` is the sld of the polymer, |rho|\ :sub:`solv` is the sld of the solvent, and *R*\ :sub:`g` is the radius of gyration of the polymer coil. 30 31 .. figure:: img/mono_gauss_coil_1d.jpg32 33 1D plot using the default values.34 30 35 31 The 2D scattering intensity is calculated in the same way as the 1D, but where the *q* vector is redefined as … … 59 55 60 56 # ["name", "units", default, [lower, upper], "type", "description"], 61 parameters = [["radius_gyration", "Ang", 50.0, [0.0, inf], "", "Radius of gyration"]] 57 parameters = [["i_zero", "1/cm", 1.0, [-inf, inf], "", "Intensity at q=0"], 58 ["radius_gyration", "Ang", 50.0, [0.0, inf], "", "Radius of gyration"]] 62 59 63 60 # NB: Scale and Background are implicit parameters on every model … … 68 65 inten = 1.0 69 66 else: 70 inten = 2.0 * (exp(-z) + z - 1.0 ) / (z * z)67 inten = i_zero * 2.0 * (exp(-z) + z - 1.0 ) / (z * z) 71 68 return inten 72 69 Iq.vectorized = True # Iq accepts an array of q values … … 78 75 79 76 demo = dict(scale = 1.0, 77 i_zero = 1.0, 80 78 radius_gyration = 50.0, 81 79 background = 0.0) -
sasmodels/models/poly_gauss_coil.py
rcb97bff rbf227cd 5 5 6 6 7 .._ poly_gauss_coil:8 7 r""" 9 8 This empirical model describes the scattering from *polydisperse* polymer chains in theta solvents or polymer melts, assuming a Schulz-Zimm type molecular weight distribution. 10 9 11 To describe the scattering from *monodisperse* polymer chains, see the mono_gauss_coilmodel.10 To describe the scattering from *monodisperse* polymer chains, see the :ref:`mono_gauss_coil <mono-gauss-coil>` model. 12 11 13 12 Definition 14 13 ---------- 15 14 16 *I(q)* = *scale* |cdot| * P(q)* + *background*15 *I(q)* = *scale* |cdot| *I* \ :sub:`0` |cdot| *P(q)* + *background* 17 16 18 17 where 19 18 20 * scale*= |phi|\ :sub:`poly` |cdot| *V* |cdot| (|rho|\ :sub:`poly` - |rho|\ :sub:`solv`)\ :sup:`2`19 *I*\ :sub:`0` = |phi|\ :sub:`poly` |cdot| *V* |cdot| (|rho|\ :sub:`poly` - |rho|\ :sub:`solv`)\ :sup:`2` 21 20 22 21 *P(q)* = 2 [(1 + UZ)\ :sup:`-1/U` + Z - 1] / [(1 + U) Z\ :sup:`2`] … … 31 30 32 31 Here, |phi|\ :sub:`poly`, is the volume fraction of polymer, *V* is the volume of a polymer coil, *M* is the molecular weight of the polymer, *N*\ :sub:`A` is Avogadro's Number, |delta| is the bulk density of the polymer, |rho|\ :sub:`poly` is the sld of the polymer, |rho|\ :sub:`solv` is the sld of the solvent, and *R*\ :sub:`g` is the radius of gyration of the polymer coil. 33 34 .. figure:: img/poly_gauss_coil_1d.jpg35 36 1D plot using the default values.37 32 38 33 The 2D scattering intensity is calculated in the same way as the 1D, but where the *q* vector is redefined as … … 65 60 66 61 # ["name", "units", default, [lower, upper], "type", "description"], 67 parameters = [["radius_gyration", "Ang", 50.0, [0.0, inf], "", "Radius of gyration"], 62 parameters = [["i_zero", "1/cm", 1.0, [-inf, inf], "", "Intensity at q=0"], 63 ["radius_gyration", "Ang", 50.0, [0.0, inf], "", "Radius of gyration"], 68 64 ["polydispersity", "None", 2.0, [1.0, inf], "", "Polymer Mw/Mn"]] 69 65 … … 77 73 z = ((x * radius_gyration) * (x * radius_gyration)) / (1.0 + 2.0 * u) 78 74 if x == 0: 79 inten = 1.075 inten = i_zero * 1.0 80 76 else: 81 inten = 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z))77 inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 82 78 return inten 83 79 Iq.vectorized = True # Iq accepts an array of q values … … 89 85 90 86 demo = dict(scale = 1.0, 87 i_zero = 1.0, 91 88 radius_gyration = 50.0, 92 89 polydispersity = 2.0,
Note: See TracChangeset
for help on using the changeset viewer.