1 | #correlation length model |
---|
2 | # Note: model title and parameter table are inserted automatically |
---|
3 | r""" |
---|
4 | Definition |
---|
5 | ---------- |
---|
6 | |
---|
7 | The scattering intensity I(q) is calculated as |
---|
8 | |
---|
9 | .. math:: |
---|
10 | I(Q) = \frac{A}{Q^n} + \frac{C}{1 + (Q\xi)^m} + \text{background} |
---|
11 | |
---|
12 | The first term describes Porod scattering from clusters (exponent = $n$) and |
---|
13 | the second term is a Lorentzian function describing scattering from |
---|
14 | polymer chains (exponent = $m$). This second term characterizes the |
---|
15 | polymer/solvent interactions and therefore the thermodynamics. The two |
---|
16 | multiplicative factors $A$ and $C$, and the two exponents $n$ and $m$ are |
---|
17 | used as fitting parameters. (Respectively *porod_scale*, *lorentz_scale*, |
---|
18 | *porod_exp* and *lorentz_exp* in the parameter list.) The remaining |
---|
19 | parameter $\xi$ (*cor_length* in the parameter list) is a correlation |
---|
20 | length for the polymer chains. Note that when $m=2$ this functional form |
---|
21 | becomes the familiar Lorentzian function. Some interpretation of the |
---|
22 | values of $A$ and $C$ may be possible depending on the values of $m$ and $n$. |
---|
23 | |
---|
24 | For 2D data: The 2D scattering intensity is calculated in the same way as 1D, |
---|
25 | where the q vector is defined as |
---|
26 | |
---|
27 | .. math:: q = \sqrt{q_x^2 + q_y^2} |
---|
28 | |
---|
29 | References |
---|
30 | ---------- |
---|
31 | |
---|
32 | .. [#] B Hammouda, D L Ho and S R Kline, Insight into Clustering in Poly(ethylene oxide) Solutions, Macromolecules, 37 (2004) 6932-6937 |
---|
33 | |
---|
34 | Source |
---|
35 | ------ |
---|
36 | |
---|
37 | `correlation_length.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/correlation_length.py>`_ |
---|
38 | |
---|
39 | Authorship and Verification |
---|
40 | ---------------------------- |
---|
41 | |
---|
42 | * **Author:** |
---|
43 | * **Last Modified by:** |
---|
44 | * **Last Reviewed by:** |
---|
45 | * **Source added by :** Steve King **Date:** March 25, 2019 |
---|
46 | """ |
---|
47 | |
---|
48 | from numpy import inf, errstate |
---|
49 | |
---|
50 | name = "correlation_length" |
---|
51 | title = """Calculates an empirical functional form for SAS data characterized |
---|
52 | by a low-Q signal and a high-Q signal.""" |
---|
53 | description = """ |
---|
54 | """ |
---|
55 | category = "shape-independent" |
---|
56 | # pylint: disable=bad-continuation, line-too-long |
---|
57 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
58 | parameters = [ |
---|
59 | ["lorentz_scale", "", 10.0, [0, inf], "", "Lorentzian Scaling Factor"], |
---|
60 | ["porod_scale", "", 1e-06, [0, inf], "", "Porod Scaling Factor"], |
---|
61 | ["cor_length", "Ang", 50.0, [0, inf], "", "Correlation length, xi, in Lorentzian"], |
---|
62 | ["porod_exp", "", 3.0, [0, inf], "", "Porod Exponent, n, in q^-n"], |
---|
63 | ["lorentz_exp", "1/Ang^2", 2.0, [0, inf], "", "Lorentzian Exponent, m, in 1/( 1 + (q.xi)^m)"], |
---|
64 | ] |
---|
65 | # pylint: enable=bad-continuation, line-too-long |
---|
66 | |
---|
67 | def Iq(q, lorentz_scale, porod_scale, cor_length, porod_exp, lorentz_exp): |
---|
68 | """ |
---|
69 | 1D calculation of the Correlation length model |
---|
70 | """ |
---|
71 | with errstate(divide='ignore'): |
---|
72 | porod = porod_scale / q**porod_exp |
---|
73 | lorentz = lorentz_scale / (1.0 + (q * cor_length)**lorentz_exp) |
---|
74 | inten = porod + lorentz |
---|
75 | return inten |
---|
76 | Iq.vectorized = True |
---|
77 | |
---|
78 | # parameters for demo |
---|
79 | demo = dict(lorentz_scale=10.0, porod_scale=1.0e-06, cor_length=50.0, |
---|
80 | porod_exp=3.0, lorentz_exp=2.0, background=0.1, |
---|
81 | ) |
---|
82 | |
---|
83 | tests = [[{}, 0.001, 1009.98], |
---|
84 | [{}, 0.150141, 0.175645], |
---|
85 | [{}, 0.442528, 0.0213957]] |
---|