Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/guide/pd/polydispersity.rst

    rf41027b rd089a00  
    88.. _polydispersityhelp: 
    99 
    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 
     10Polydispersity & Orientational Distributions 
     11-------------------------------------------- 
     12 
     13For some models we can calculate the average intensity for a population of  
     14particles that possess size and/or orientational (ie, angular) distributions.  
     15In SasView we call the former *polydispersity* but use the parameter *PD* to  
     16parameterise both. In other words, the meaning of *PD* in a model depends on  
     17the actual parameter it is being applied too. 
     18 
     19The resultant intensity is then normalized by the average particle volume such  
     20that 
    1721 
    1822.. math:: 
     
    2125 
    2226where $F$ is the scattering amplitude and $\langle\cdot\rangle$ denotes an  
    23 average over the size distribution $f(x; \bar x, \sigma)$, giving 
     27average over the distribution $f(x; \bar x, \sigma)$, giving 
    2428 
    2529.. math:: 
     
    3034Each distribution is characterized by a center value $\bar x$ or 
    3135$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}$. 
     36the standard deviation, so read the description of the distribution carefully),  
     37the number of sigmas $N_\sigma$ to include from the tails of the distribution,  
     38and the number of points used to compute the average. The center of the  
     39distribution is set by the value of the model parameter. 
     40 
     41The distribution width applied to *volume* (ie, shape-describing) parameters  
     42is relative to the center value such that $\sigma = \mathrm{PD} \cdot \bar x$.  
     43However, the distribution width applied to *orientation* parameters is just  
     44$\sigma = \mathrm{PD}$. 
    4445 
    4546$N_\sigma$ determines how far into the tails to evaluate the distribution, 
     
    5152 
    5253Users 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. 
     54polydispersion and/or orientational distributions to multiple parameters at  
     55the same time, or increasing the number of points in the distribution, will  
     56require patience! However, the calculations are generally more robust with  
     57more data points or more angles. 
    5658 
    5759The following distribution functions are provided: 
     
    6466*  *Schulz Distribution* 
    6567*  *Array Distribution* 
    66 *  *User-defined Distributions* 
    6768 
    6869These are all implemented as *number-average* distributions. 
    6970 
     71Additional 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.** 
    7076 
    7177.. note:: In 2009 IUPAC decided to introduce the new term 'dispersity' to replace  
    7278           the term 'polydispersity' (see `Pure Appl. Chem., (2009), 81(2),  
    7379           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. 
    7984 
    8085Suggested Applications 
    8186^^^^^^^^^^^^^^^^^^^^^^ 
    8287 
    83 If applying polydispersion to parameters describing particle sizes, use 
     88If applying polydispersion to parameters describing particle sizes, consider using 
    8489the Lognormal or Schulz distributions. 
    8590 
    8691If applying polydispersion to parameters describing interfacial thicknesses 
    87 or angular orientations, use the 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 
     92or angular orientations, consider using the Gaussian or Boltzmann distributions. 
     93 
     94If applying polydispersion to parameters describing angles, use the Uniform  
     95distribution. Beware of using distributions that are always positive (eg, the  
    9196Lognormal) because angles can be negative! 
    9297 
    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.  
     98The array distribution allows a user-defined distribution to be applied. 
    9699 
    97100.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    331334.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    332335 
    333 User-defined Distributions 
    334 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 
    335  
    336 You can also define your own distribution by creating a python file defining a 
    337 *Distribution* object with a *_weights* method.  The *_weights* method takes 
    338 *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 zero 
    342   if it is an angular dispersity.  This parameter may be fitted. 
    343  
    344 * *sigma* the width of the distribution, which is the polydispersity parameter 
    345   times the center for size dispersity, or the polydispersity parameter alone 
    346   for angular dispersity.  This parameter may be fitted. 
    347  
    348 * *lb*, *ub* are the parameter limits (lower & upper bounds) given in the model 
    349   definition file.  For example, a radius parameter has *lb* equal to zero.  A 
    350   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 the 
    353   distribution.  For a two parameter distribution, this value could be 
    354   co-opted to use for the second parameter, though it will not be available 
    355   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 the 
    359   distribution code is free to return more or fewer, or use it for the third 
    360   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 np 
    365     from scipy.stats import laplace 
    366  
    367     from sasmodels import weights 
    368  
    369     class Dispersion(weights.Dispersion): 
    370         r""" 
    371         Laplace distribution 
    372  
    373         .. math:: 
    374  
    375             w(x) = e^{-\sigma |x - \mu|} 
    376         """ 
    377         type = "laplace" 
    378         default = dict(npts=35, width=0, nsigmas=3)  # default values 
    379         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, wx 
    383  
    384 You can plot the weights for a given value and width using the following:: 
    385  
    386     from numpy import inf 
    387     from matplotlib import pyplot as plt 
    388     from sasmodels import weights 
    389  
    390     # reload the user-defined weights 
    391     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 weights 
    396     plt.interactive(True) 
    397     plt.plot(x, wx, 'x') 
    398  
    399 The *self.nsigmas* and *self.npts* parameters are normally used to control 
    400 the accuracy of the distribution integral. The *self._linspace* function 
    401 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 or 
    403 nsigmas you will need to generate your own *x*.  Be sure to honour the 
    404 limits *lb* and *ub*, for example to disallow a negative radius or constrain 
    405 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 environment 
    409 variable, defaulting to:: 
    410  
    411     SAS_WEIGHTS_PATH=~/.sasview/weights 
    412  
    413 The weights path is loaded on startup.  To update the distribution definition 
    414 in a running application you will need to enter the following python commands:: 
    415  
    416     import sasmodels.weights 
    417     sasmodels.weights.load_weights('path/to/distname.py') 
    418  
    419 .. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
    420  
    421336Note about DLS polydispersity 
    422337^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
    423338 
    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$. 
     339Several measures of polydispersity abound in Dynamic Light Scattering (DLS) and  
     340it should not be assumed that any of the following can be simply equated with  
     341the polydispersity *PD* parameter used in SasView. 
     342 
     343The dimensionless **Polydispersity Index (PI)** is a measure of the width of the  
     344distribution of autocorrelation function decay rates (*not* the distribution of  
     345particle sizes itself, though the two are inversely related) and is defined by  
     346ISO 22412:2017 as 
     347 
     348.. math:: 
     349 
     350    PI = \mu_{2} / \bar \Gamma^2 
     351 
     352where $\mu_\text{2}$ is the second cumulant, and $\bar \Gamma^2$ is the  
     353intensity-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 
     361where $\sigma$ is the standard deviation, allowing a **Relative Polydispersity (RP)**  
     362to be defined as 
     363 
     364.. math:: 
     365 
     366    RP = \sigma / \bar \Gamma = \sqrt{2 \cdot PI} 
     367 
     368PI values smaller than 0.05 indicate a highly monodisperse system. Values  
     369greater than 0.7 indicate significant polydispersity. 
     370 
     371The **size polydispersity P-parameter** is defined as the relative standard  
     372deviation coefficient of variation   
     373 
     374.. math:: 
     375 
     376    P = \sqrt\nu / \bar R 
     377 
     378where $\nu$ is the variance of the distribution and $\bar R$ is the mean 
     379value of $R$. Here, the product $P \bar R$ is *equal* to the standard  
     380deviation of the Lognormal distribution. 
     381 
     382P values smaller than 0.13 indicate a monodisperse system. 
    437383 
    438384For 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 
     392S King, C Washington & R Heenan, *Phys Chem Chem Phys*, (2005), 7, 143. 
     393 
     394T Allen, in *Particle Size Measurement*, 4th Edition, Chapman & Hall, London (1990). 
    440395 
    441396.. ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 
     
    447402| 2018-03-20 Steve King 
    448403| 2018-04-04 Steve King 
     404| 2018-08-09 Steve King 
Note: See TracChangeset for help on using the changeset viewer.