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 | The returned value is scaled to units of |cm^-1|, absolute scale. |
---|
13 | |
---|
14 | Definition |
---|
15 | ---------- |
---|
16 | |
---|
17 | The scattering intensity *I(q)* is calculated as |
---|
18 | |
---|
19 | .. math: |
---|
20 | |
---|
21 | I(q) = \frac{A}{Q^n} + \frac{C}{1 + (Q\xi}^m} + B |
---|
22 | |
---|
23 | Here the peak position is related to the d-spacing as *Q0* = 2|pi| / *d0*. |
---|
24 | |
---|
25 | For 2D data: The 2D scattering intensity is calculated in the same way as 1D, |
---|
26 | where the *q* vector is defined as |
---|
27 | |
---|
28 | .. math: |
---|
29 | |
---|
30 | q = \sqrt{q_x^2 + q_y^2} |
---|
31 | |
---|
32 | |
---|
33 | .. image:: img/image175.jpg |
---|
34 | |
---|
35 | *Figure. 1D plot using the default values (w/200 data point).* |
---|
36 | |
---|
37 | REFERENCE |
---|
38 | --------- |
---|
39 | |
---|
40 | None. |
---|
41 | |
---|
42 | *2013/09/09 - Description reviewed by King, S and Parker, P.* |
---|
43 | |
---|
44 | """ |
---|
45 | |
---|
46 | import numpy as np |
---|
47 | from numpy import pi, inf, sin, cos, sqrt, exp, log, fabs |
---|
48 | |
---|
49 | name = "broad_peak" |
---|
50 | title = "Broad Lorentzian type peak on top of a power law decay" |
---|
51 | description = """\ |
---|
52 | I(q) = scale_p/pow(q,exponent)+scale_l/ |
---|
53 | (1.0 + pow((fabs(q-q_peak)*length_l),exponent_l) )+ background |
---|
54 | |
---|
55 | List of default parameters: |
---|
56 | porod_scale = Porod term scaling |
---|
57 | porod_exp = Porod exponent |
---|
58 | lorentz_scale = Lorentzian term scaling |
---|
59 | lorentz_length = Lorentzian screening length [A] |
---|
60 | peak_pos = peak location [1/A] |
---|
61 | lorentz_exp = Lorentzian exponent |
---|
62 | background = Incoherent background""" |
---|
63 | category="shape-independent" |
---|
64 | |
---|
65 | parameters = [ |
---|
66 | # [ "name", "units", default, [lower, upper], "type", |
---|
67 | # "description" ], |
---|
68 | |
---|
69 | [ "porod_scale", "", 1.0e-05, [-inf,inf], "", |
---|
70 | "Power law scale factor" ], |
---|
71 | [ "porod_exp", "", 3.0, [-inf,inf], "", |
---|
72 | "Exponent of power law" ], |
---|
73 | [ "lorentz_scale", "", 10.0, [-inf,inf], "", |
---|
74 | "Scale factor for broad Lorentzian peak" ], |
---|
75 | [ "lorentz_length", "Ang", 50.0, [-inf, inf], "", |
---|
76 | "Lorentzian screening length" ], |
---|
77 | [ "peak_pos", "1/Ang", 0.1, [-inf, inf], "", |
---|
78 | "Peak postion in q" ], |
---|
79 | [ "lorentz_exp", "", 2.0, [-inf, inf], "", |
---|
80 | "exponent of Lorentz function" ], |
---|
81 | ] |
---|
82 | |
---|
83 | |
---|
84 | #def form_volume(): |
---|
85 | # return 1 |
---|
86 | |
---|
87 | def Iq(q, porod_scale, porod_exp, lorentz_scale, lorentz_length, peak_pos, lorentz_exp): |
---|
88 | inten = porod_scale/pow(q,porod_exp) + lorentz_scale/(1.0 \ |
---|
89 | + pow((fabs(q-peak_pos)*lorentz_length),lorentz_exp)) |
---|
90 | return inten |
---|
91 | |
---|
92 | # FOR VECTORIZED VERSION, UNCOMMENT THE NEXT LINE |
---|
93 | Iq.vectorized = True |
---|
94 | |
---|
95 | def Iqxy(qx, qy, *args): |
---|
96 | return Iq(sqrt(qx**2 + qy**2), *args) |
---|
97 | |
---|
98 | # FOR VECTORIZED VERSION, UNCOMMENT THE NEXT LINE |
---|
99 | Iqxy.vectorized = True |
---|
100 | |
---|
101 | |
---|
102 | demo = dict( |
---|
103 | scale=1, background=0, |
---|
104 | porod_scale=1.0e-05, porod_exp=3, |
---|
105 | lorentz_scale=10,lorentz_length=50, peak_pos=0.1, lorentz_exp=2, |
---|
106 | ) |
---|
107 | oldname = "BroadPeakModel" |
---|
108 | oldpars = dict(porod_scale='scale_p', porod_exp='exponent_p', |
---|
109 | lorentz_scale='scale_l', lorentz_length='length_l', peak_pos='q_peak', |
---|
110 | lorentz_exp='exponent_l', scale=None) |
---|