[3330bb4] | 1 | r""" |
---|
| 2 | Definition |
---|
| 3 | ---------- |
---|
| 4 | |
---|
| 5 | This model fits the Guinier function |
---|
| 6 | |
---|
| 7 | .. math:: |
---|
| 8 | |
---|
[4476951] | 9 | I(q) = \text{scale} \cdot \exp{\left[ \frac{-Q^2 R_g^2 }{3} \right]} |
---|
[3330bb4] | 10 | + \text{background} |
---|
| 11 | |
---|
| 12 | to the data directly without any need for linearisation (*cf*. the usual |
---|
| 13 | plot of $\ln I(q)$ vs $q^2$\ ). Note that you may have to restrict the data |
---|
| 14 | range to include small q only, where the Guinier approximation actually |
---|
| 15 | applies. See also the guinier_porod model. |
---|
| 16 | |
---|
| 17 | For 2D data the scattering intensity is calculated in the same way as 1D, |
---|
| 18 | where the $q$ vector is defined as |
---|
| 19 | |
---|
[751da81] | 20 | .. math:: q = \sqrt{q_x^2 + q_y^2} |
---|
[3ba2251] | 21 | |
---|
| 22 | In scattering, the radius of gyration $R_g$ quantifies the objects's |
---|
| 23 | distribution of SLD (not mass density, as in mechanics) from the objects's |
---|
[c9fc873] | 24 | SLD centre of mass. It is defined by |
---|
[3ba2251] | 25 | |
---|
[c9fc873] | 26 | .. math:: R_g^2 = \frac{\sum_i\rho_i\left(r_i-r_0\right)^2}{\sum_i\rho_i} |
---|
[3ba2251] | 27 | |
---|
[c9fc873] | 28 | where $r_0$ denotes the object's SLD centre of mass and $\rho_i$ is the SLD at |
---|
| 29 | a point $i$. |
---|
[3ba2251] | 30 | |
---|
| 31 | Notice that $R_g^2$ may be negative (since SLD can be negative), which happens |
---|
| 32 | when a form factor $P(Q)$ is increasing with $Q$ rather than decreasing. This |
---|
| 33 | can occur for core/shell particles, hollow particles, or for composite |
---|
| 34 | particles with domains of different SLDs in a solvent with an SLD close to the |
---|
| 35 | average match point. (Alternatively, this might be regarded as there being an |
---|
| 36 | internal inter-domain "structure factor" within a single particle which gives |
---|
| 37 | rise to a peak in the scattering). |
---|
[4476951] | 38 | |
---|
| 39 | To specify a negative value of $R_g^2$ in SasView, simply give $R_g$ a negative |
---|
[b297ba9] | 40 | value ($R_g^2$ will be evaluated as $R_g |R_g|$). Note that the physical radius |
---|
| 41 | of gyration, of the exterior of the particle, will still be large and positive. |
---|
| 42 | It is only the apparent size from the small $Q$ data that will give a small or |
---|
[3b8a004] | 43 | negative value of $R_g^2$. |
---|
[4476951] | 44 | |
---|
[3330bb4] | 45 | References |
---|
| 46 | ---------- |
---|
| 47 | |
---|
[0507e09] | 48 | .. [#] A Guinier and G Fournet, *Small-Angle Scattering of X-Rays*, John Wiley & Sons, New York (1955) |
---|
| 49 | |
---|
| 50 | Source |
---|
| 51 | ------ |
---|
| 52 | |
---|
| 53 | `guinier.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/guinier.py>`_ |
---|
| 54 | |
---|
| 55 | Authorship and Verification |
---|
| 56 | ---------------------------- |
---|
| 57 | |
---|
| 58 | * **Author:** |
---|
| 59 | * **Last Modified by:** |
---|
| 60 | * **Last Reviewed by:** |
---|
| 61 | * **Source added by :** Steve King **Date:** March 25, 2019 |
---|
[3330bb4] | 62 | """ |
---|
| 63 | |
---|
[2d81cfe] | 64 | import numpy as np |
---|
[3330bb4] | 65 | from numpy import inf |
---|
| 66 | |
---|
| 67 | name = "guinier" |
---|
| 68 | title = "" |
---|
| 69 | description = """ |
---|
| 70 | I(q) = scale.exp ( - rg^2 q^2 / 3.0 ) |
---|
[404ebbd] | 71 | |
---|
[3330bb4] | 72 | List of default parameters: |
---|
| 73 | scale = scale |
---|
| 74 | rg = Radius of gyration |
---|
| 75 | """ |
---|
| 76 | category = "shape-independent" |
---|
| 77 | |
---|
| 78 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
[4476951] | 79 | parameters = [["rg", "Ang", 60.0, [-inf, inf], "", "Radius of Gyration"]] |
---|
[3330bb4] | 80 | |
---|
| 81 | Iq = """ |
---|
[05cd67f] | 82 | double exponent = fabs(rg)*rg*q*q/3.0; |
---|
[3330bb4] | 83 | double value = exp(-exponent); |
---|
| 84 | return value; |
---|
| 85 | """ |
---|
| 86 | |
---|
[404ebbd] | 87 | def random(): |
---|
[b297ba9] | 88 | """Return a random parameter set for the model.""" |
---|
[48462b0] | 89 | scale = 10**np.random.uniform(1, 4) |
---|
| 90 | # Note: compare.py has Rg cutoff of 1e-30 at q=1 for guinier, so use that |
---|
| 91 | # log_10 Ae^(-(q Rg)^2/3) = log_10(A) - (q Rg)^2/ (3 ln 10) > -30 |
---|
| 92 | # => log_10(A) > Rg^2/(3 ln 10) - 30 |
---|
[404ebbd] | 93 | q_max = 1.0 |
---|
| 94 | rg_max = np.sqrt(90*np.log(10) + 3*np.log(scale))/q_max |
---|
| 95 | rg = 10**np.random.uniform(0, np.log10(rg_max)) |
---|
| 96 | pars = dict( |
---|
| 97 | #background=0, |
---|
| 98 | scale=scale, |
---|
| 99 | rg=rg, |
---|
| 100 | ) |
---|
| 101 | return pars |
---|
| 102 | |
---|
[3330bb4] | 103 | # parameters for demo |
---|
[b297ba9] | 104 | demo = dict(scale=1.0, background=0.001, rg=60.0) |
---|
[3330bb4] | 105 | |
---|
| 106 | # parameters for unit tests |
---|
| 107 | tests = [[{'rg' : 31.5}, 0.005, 0.992756]] |
---|