1 | r""" |
---|
2 | This model calculates an empirical functional form for SAS data characterized |
---|
3 | by a broad scattering peak. Many SAS spectra are characterized by a broad peak |
---|
4 | even though they are from amorphous soft materials. For example, soft systems |
---|
5 | that show a SAS peak include copolymers, polyelectrolytes, multiphase systems, |
---|
6 | layered structures, etc. |
---|
7 | |
---|
8 | The d-spacing corresponding to the broad peak is a characteristic distance |
---|
9 | between the scattering inhomogeneities (such as in lamellar, cylindrical, or |
---|
10 | spherical morphologies, or for bicontinuous structures). |
---|
11 | |
---|
12 | Definition |
---|
13 | ---------- |
---|
14 | |
---|
15 | The scattering intensity $I(q)$ is calculated as |
---|
16 | |
---|
17 | .. math:: I(q) = \frac{A}{q^n} + \frac{C}{1 + (|q - q_0|\xi)^m} + B |
---|
18 | |
---|
19 | Here the peak position is related to the d-spacing as $q_o = 2\pi / d_o$. |
---|
20 | |
---|
21 | $A$ is the Porod law scale factor, $n$ the Porod exponent, $C$ is the |
---|
22 | Lorentzian scale factor, $m$ the exponent of $q$, $\xi$ the screening length, |
---|
23 | and $B$ the flat background. |
---|
24 | |
---|
25 | For 2D data the scattering intensity is calculated in the same way as 1D, |
---|
26 | where the $q$ vector is defined as |
---|
27 | |
---|
28 | .. math:: q = \sqrt{q_x^2 + q_y^2} |
---|
29 | |
---|
30 | References |
---|
31 | ---------- |
---|
32 | |
---|
33 | None. |
---|
34 | |
---|
35 | *2013/09/09 - Description reviewed by King, S and Parker, P.* |
---|
36 | """ |
---|
37 | |
---|
38 | from numpy import inf, errstate |
---|
39 | |
---|
40 | name = "broad_peak" |
---|
41 | title = "Broad Lorentzian type peak on top of a power law decay" |
---|
42 | description = """\ |
---|
43 | I(q) = scale_p/pow(q,exponent)+scale_l/ |
---|
44 | (1.0 + pow((fabs(q-q_peak)*length_l),exponent_l) )+ background |
---|
45 | |
---|
46 | List of default parameters: |
---|
47 | porod_scale = Porod term scaling |
---|
48 | porod_exp = Porod exponent |
---|
49 | lorentz_scale = Lorentzian term scaling |
---|
50 | lorentz_length = Lorentzian screening length [A] |
---|
51 | peak_pos = peak location [1/A] |
---|
52 | lorentz_exp = Lorentzian exponent |
---|
53 | background = Incoherent background""" |
---|
54 | category = "shape-independent" |
---|
55 | |
---|
56 | # pylint: disable=bad-whitespace, line-too-long |
---|
57 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
58 | parameters = [["porod_scale", "", 1.0e-05, [-inf, inf], "", "Power law scale factor"], |
---|
59 | ["porod_exp", "", 3.0, [-inf, inf], "", "Exponent of power law"], |
---|
60 | ["lorentz_scale", "", 10.0, [-inf, inf], "", "Scale factor for broad Lorentzian peak"], |
---|
61 | ["lorentz_length", "Ang", 50.0, [-inf, inf], "", "Lorentzian screening length"], |
---|
62 | ["peak_pos", "1/Ang", 0.1, [-inf, inf], "", "Peak position in q"], |
---|
63 | ["lorentz_exp", "", 2.0, [-inf, inf], "", "Exponent of Lorentz function"], |
---|
64 | ] |
---|
65 | # pylint: enable=bad-whitespace, line-too-long |
---|
66 | |
---|
67 | def Iq(q, |
---|
68 | porod_scale=1.0e-5, |
---|
69 | porod_exp=3.0, |
---|
70 | lorentz_scale=10.0, |
---|
71 | lorentz_length=50.0, |
---|
72 | peak_pos=0.1, |
---|
73 | lorentz_exp=2.0): |
---|
74 | """ |
---|
75 | :param q: Input q-value |
---|
76 | :param porod_scale: Power law scale factor |
---|
77 | :param porod_exp: Exponent of power law |
---|
78 | :param lorentz_scale: Scale factor for broad Lorentzian peak |
---|
79 | :param lorentz_length: Lorentzian screening length |
---|
80 | :param peak_pos: Peak position in q |
---|
81 | :param lorentz_exp: Exponent of Lorentz function |
---|
82 | :return: Calculated intensity |
---|
83 | """ |
---|
84 | z = abs(q - peak_pos) * lorentz_length |
---|
85 | with errstate(divide='ignore'): |
---|
86 | inten = (porod_scale / q ** porod_exp |
---|
87 | + lorentz_scale / (1 + z ** lorentz_exp)) |
---|
88 | return inten |
---|
89 | Iq.vectorized = True # Iq accepts an array of q values |
---|
90 | |
---|
91 | demo = dict(scale=1, background=0, |
---|
92 | porod_scale=1.0e-05, porod_exp=3, |
---|
93 | lorentz_scale=10, lorentz_length=50, peak_pos=0.1, lorentz_exp=2) |
---|