Changes in doc/guide/pd/polydispersity.rst [f41027b:d089a00] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/guide/pd/polydispersity.rst
rf41027b rd089a00 8 8 .. _polydispersityhelp: 9 9 10 Polydispersity Distributions 11 ---------------------------- 12 13 With some models in sasmodels we can calculate the average intensity for a 14 population of particles that exhibit size and/or orientational 15 polydispersity. The resultant intensity is normalized by the average 16 particle volume such that 10 Polydispersity & Orientational Distributions 11 -------------------------------------------- 12 13 For some models we can calculate the average intensity for a population of 14 particles that possess size and/or orientational (ie, angular) distributions. 15 In SasView we call the former *polydispersity* but use the parameter *PD* to 16 parameterise both. In other words, the meaning of *PD* in a model depends on 17 the actual parameter it is being applied too. 18 19 The resultant intensity is then normalized by the average particle volume such 20 that 17 21 18 22 .. math:: … … 21 25 22 26 where $F$ is the scattering amplitude and $\langle\cdot\rangle$ denotes an 23 average over the sizedistribution $f(x; \bar x, \sigma)$, giving27 average over the distribution $f(x; \bar x, \sigma)$, giving 24 28 25 29 .. math:: … … 30 34 Each distribution is characterized by a center value $\bar x$ or 31 35 $x_\text{med}$, a width parameter $\sigma$ (note this is *not necessarily* 32 the standard deviation, so read the description carefully), the number of 33 sigmas $N_\sigma$ to include from the tails of the distribution, and the 34 number of points used to compute the average. The center of the distribution 35 is set by the value of the model parameter. The meaning of a polydispersity 36 parameter *PD* (not to be confused with a molecular weight distributions 37 in polymer science) in a model depends on the type of parameter it is being 38 applied too. 39 40 The distribution width applied to *volume* (ie, shape-describing) parameters 41 is relative to the center value such that $\sigma = \mathrm{PD} \cdot \bar x$. 42 However, the distribution width applied to *orientation* (ie, angle-describing) 43 parameters is just $\sigma = \mathrm{PD}$. 36 the standard deviation, so read the description of the distribution carefully), 37 the number of sigmas $N_\sigma$ to include from the tails of the distribution, 38 and the number of points used to compute the average. The center of the 39 distribution is set by the value of the model parameter. 40 41 The distribution width applied to *volume* (ie, shape-describing) parameters 42 is relative to the center value such that $\sigma = \mathrm{PD} \cdot \bar x$. 43 However, the distribution width applied to *orientation* parameters is just 44 $\sigma = \mathrm{PD}$. 44 45 45 46 $N_\sigma$ determines how far into the tails to evaluate the distribution, … … 51 52 52 53 Users should note that the averaging computation is very intensive. Applying 53 polydispersion to multiple parameters at the same time or increasing the 54 number of points in the distribution will require patience! However, the 55 calculations are generally more robust with more data points or more angles. 54 polydispersion and/or orientational distributions to multiple parameters at 55 the same time, or increasing the number of points in the distribution, will 56 require patience! However, the calculations are generally more robust with 57 more data points or more angles. 56 58 57 59 The following distribution functions are provided: … … 64 66 * *Schulz Distribution* 65 67 * *Array Distribution* 66 * *User-defined Distributions*67 68 68 69 These are all implemented as *number-average* distributions. 69 70 71 Additional distributions are under consideration. 72 73 **Beware: when the Polydispersity & Orientational Distribution panel in SasView is** 74 **first opened, the default distribution for all parameters is the Gaussian Distribution.** 75 **This may not be suitable. See Suggested Applications below.** 70 76 71 77 .. note:: In 2009 IUPAC decided to introduce the new term 'dispersity' to replace 72 78 the term 'polydispersity' (see `Pure Appl. Chem., (2009), 81(2), 73 79 351-353 <http://media.iupac.org/publications/pac/2009/pdf/8102x0351.pdf>`_ 74 in order to make the terminology describing distributions of properties 75 unambiguous. Throughout the SasView documentation we continue to use the 76 term polydispersity because one of the consequences of the IUPAC change is 77 that orientational polydispersity would not meet their new criteria (which 78 requires dispersity to be dimensionless). 80 in order to make the terminology describing distributions of chemical 81 properties unambiguous. However, these terms are unrelated to the 82 proportional size distributions and orientational distributions used in 83 SasView models. 79 84 80 85 Suggested Applications 81 86 ^^^^^^^^^^^^^^^^^^^^^^ 82 87 83 If applying polydispersion to parameters describing particle sizes, use88 If applying polydispersion to parameters describing particle sizes, consider using 84 89 the Lognormal or Schulz distributions. 85 90 86 91 If applying polydispersion to parameters describing interfacial thicknesses 87 or angular orientations, usethe Gaussian or Boltzmann distributions.88 89 If applying polydispersion to parameters describing angles, use the Uniform 90 distribution. Beware of using distributions that are always positive (eg, the 92 or angular orientations, consider using the Gaussian or Boltzmann distributions. 93 94 If applying polydispersion to parameters describing angles, use the Uniform 95 distribution. Beware of using distributions that are always positive (eg, the 91 96 Lognormal) because angles can be negative! 92 97 93 The array distribution provides a very simple means of implementing a user- 94 defined distribution, but without any fittable parameters. Greater flexibility 95 is conferred by the user-defined distribution. 98 The array distribution allows a user-defined distribution to be applied. 96 99 97 100 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ … … 331 334 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 332 335 333 User-defined Distributions334 ^^^^^^^^^^^^^^^^^^^^^^^^^^335 336 You can also define your own distribution by creating a python file defining a337 *Distribution* object with a *_weights* method. The *_weights* method takes338 *center*, *sigma*, *lb* and *ub* as arguments, and can access *self.npts*339 and *self.nsigmas* from the distribution. They are interpreted as follows:340 341 * *center* the value of the shape parameter (for size dispersity) or zero342 if it is an angular dispersity. This parameter may be fitted.343 344 * *sigma* the width of the distribution, which is the polydispersity parameter345 times the center for size dispersity, or the polydispersity parameter alone346 for angular dispersity. This parameter may be fitted.347 348 * *lb*, *ub* are the parameter limits (lower & upper bounds) given in the model349 definition file. For example, a radius parameter has *lb* equal to zero. A350 volume fraction parameter would have *lb* equal to zero and *ub* equal to one.351 352 * *self.nsigmas* the distance to go into the tails when evaluating the353 distribution. For a two parameter distribution, this value could be354 co-opted to use for the second parameter, though it will not be available355 for fitting.356 357 * *self.npts* the number of points to use when evaluating the distribution.358 The user will adjust this to trade calculation time for accuracy, but the359 distribution code is free to return more or fewer, or use it for the third360 parameter in a three parameter distribution.361 362 As an example, the code following wraps the Laplace distribution from scipy stats::363 364 import numpy as np365 from scipy.stats import laplace366 367 from sasmodels import weights368 369 class Dispersion(weights.Dispersion):370 r"""371 Laplace distribution372 373 .. math::374 375 w(x) = e^{-\sigma |x - \mu|}376 """377 type = "laplace"378 default = dict(npts=35, width=0, nsigmas=3) # default values379 def _weights(self, center, sigma, lb, ub):380 x = self._linspace(center, sigma, lb, ub)381 wx = laplace.pdf(x, center, sigma)382 return x, wx383 384 You can plot the weights for a given value and width using the following::385 386 from numpy import inf387 from matplotlib import pyplot as plt388 from sasmodels import weights389 390 # reload the user-defined weights391 weights.load_weights()392 x, wx = weights.get_weights('laplace', n=35, width=0.1, nsigmas=3, value=50,393 limits=[0, inf], relative=True)394 395 # plot the weights396 plt.interactive(True)397 plt.plot(x, wx, 'x')398 399 The *self.nsigmas* and *self.npts* parameters are normally used to control400 the accuracy of the distribution integral. The *self._linspace* function401 uses them to define the *x* values (along with the *center*, *sigma*,402 *lb*, and *ub* which are passed as parameters). If you repurpose npts or403 nsigmas you will need to generate your own *x*. Be sure to honour the404 limits *lb* and *ub*, for example to disallow a negative radius or constrain405 the volume fraction to lie between zero and one.406 407 To activate a user-defined distribution, put it in a file such as *distname.py*408 in the *SAS_WEIGHTS_PATH* folder. This is defined with an environment409 variable, defaulting to::410 411 SAS_WEIGHTS_PATH=~/.sasview/weights412 413 The weights path is loaded on startup. To update the distribution definition414 in a running application you will need to enter the following python commands::415 416 import sasmodels.weights417 sasmodels.weights.load_weights('path/to/distname.py')418 419 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ420 421 336 Note about DLS polydispersity 422 337 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 423 338 424 Many commercial Dynamic Light Scattering (DLS) instruments produce a size 425 polydispersity parameter, sometimes even given the symbol $p$\ ! This 426 parameter is defined as the relative standard deviation coefficient of 427 variation of the size distribution and is NOT the same as the polydispersity 428 parameters in the Lognormal and Schulz distributions above (though they all 429 related) except when the DLS polydispersity parameter is <0.13. 430 431 .. math:: 432 433 p_{DLS} = \sqrt(\nu / \bar x^2) 434 435 where $\nu$ is the variance of the distribution and $\bar x$ is the mean 436 value of $x$. 339 Several measures of polydispersity abound in Dynamic Light Scattering (DLS) and 340 it should not be assumed that any of the following can be simply equated with 341 the polydispersity *PD* parameter used in SasView. 342 343 The dimensionless **Polydispersity Index (PI)** is a measure of the width of the 344 distribution of autocorrelation function decay rates (*not* the distribution of 345 particle sizes itself, though the two are inversely related) and is defined by 346 ISO 22412:2017 as 347 348 .. math:: 349 350 PI = \mu_{2} / \bar \Gamma^2 351 352 where $\mu_\text{2}$ is the second cumulant, and $\bar \Gamma^2$ is the 353 intensity-weighted average value, of the distribution of decay rates. 354 355 *If the distribution of decay rates is Gaussian* then 356 357 .. math:: 358 359 PI = \sigma^2 / 2\bar \Gamma^2 360 361 where $\sigma$ is the standard deviation, allowing a **Relative Polydispersity (RP)** 362 to be defined as 363 364 .. math:: 365 366 RP = \sigma / \bar \Gamma = \sqrt{2 \cdot PI} 367 368 PI values smaller than 0.05 indicate a highly monodisperse system. Values 369 greater than 0.7 indicate significant polydispersity. 370 371 The **size polydispersity P-parameter** is defined as the relative standard 372 deviation coefficient of variation 373 374 .. math:: 375 376 P = \sqrt\nu / \bar R 377 378 where $\nu$ is the variance of the distribution and $\bar R$ is the mean 379 value of $R$. Here, the product $P \bar R$ is *equal* to the standard 380 deviation of the Lognormal distribution. 381 382 P values smaller than 0.13 indicate a monodisperse system. 437 383 438 384 For more information see: 439 S King, C Washington & R Heenan, *Phys Chem Chem Phys*, (2005), 7, 143 385 386 `ISO 22412:2017, International Standards Organisation (2017) <https://www.iso.org/standard/65410.html>`_. 387 388 `Polydispersity: What does it mean for DLS and Chromatography <http://www.materials-talks.com/blog/2014/10/23/polydispersity-what-does-it-mean-for-dls-and-chromatography/>`_. 389 390 `Dynamic Light Scattering: Common Terms Defined, Whitepaper WP111214. Malvern Instruments (2011) <http://www.biophysics.bioc.cam.ac.uk/wp-content/uploads/2011/02/DLS_Terms_defined_Malvern.pdf>`_. 391 392 S King, C Washington & R Heenan, *Phys Chem Chem Phys*, (2005), 7, 143. 393 394 T Allen, in *Particle Size Measurement*, 4th Edition, Chapman & Hall, London (1990). 440 395 441 396 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ … … 447 402 | 2018-03-20 Steve King 448 403 | 2018-04-04 Steve King 404 | 2018-08-09 Steve King
Note: See TracChangeset
for help on using the changeset viewer.