source: sasmodels/sasmodels/models/broad_peak.py @ 3c56da87

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 3c56da87 was 3c56da87, checked in by Paul Kienzle <pkienzle@…>, 9 years ago

lint cleanup

  • Property mode set to 100644
File size: 3.1 KB
Line 
1r"""
2This model calculates an empirical functional form for SAS data characterized
3by a broad scattering peak. Many SAS spectra are characterized by a broad peak
4even though they are from amorphous soft materials. For example, soft systems
5that show a SAS peak include copolymers, polyelectrolytes, multiphase systems,
6layered structures, etc.
7
8The d-spacing corresponding to the broad peak is a characteristic distance
9between the scattering inhomogeneities (such as in lamellar, cylindrical, or
10spherical morphologies, or for bicontinuous structures).
11
12The returned value is scaled to units of |cm^-1|, absolute scale.
13
14Definition
15----------
16
17The 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
23Here the peak position is related to the d-spacing as *Q0* = 2|pi| / *d0*.
24
25For 2D data: The 2D scattering intensity is calculated in the same way as 1D,
26where 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
37REFERENCE
38---------
39
40None.
41
42*2013/09/09 - Description reviewed by King, S and Parker, P.*
43
44"""
45
46from numpy import inf, sqrt
47
48name = "broad_peak"
49title = "Broad Lorentzian type peak on top of a power law decay"
50description = """\
51      I(q) = scale_p/pow(q,exponent)+scale_l/
52      (1.0 + pow((fabs(q-q_peak)*length_l),exponent_l) )+ background
53
54      List of default parameters:
55      porod_scale = Porod term scaling
56      porod_exp = Porod exponent
57      lorentz_scale = Lorentzian term scaling
58      lorentz_length = Lorentzian screening length [A]
59      peak_pos = peak location [1/A]
60      lorentz_exp = Lorentzian exponent
61      background = Incoherent background"""
62category="shape-independent"
63
64parameters = [
65#   [ "name", "units", default, [lower, upper], "type",
66#     "description" ],
67
68    [ "porod_scale", "", 1.0e-05, [-inf,inf], "",
69      "Power law scale factor" ],
70    [ "porod_exp", "", 3.0, [-inf,inf], "",
71      "Exponent of power law" ],
72    [ "lorentz_scale", "", 10.0, [-inf,inf], "",
73      "Scale factor for broad Lorentzian peak" ],
74    [ "lorentz_length", "Ang",  50.0, [-inf, inf], "",
75      "Lorentzian screening length" ],
76    [ "peak_pos", "1/Ang",  0.1, [-inf, inf], "",
77      "Peak postion in q" ],
78    [ "lorentz_exp", "",  2.0, [-inf, inf], "",
79      "exponent of Lorentz function" ],
80    ]
81
82
83def Iq(q, porod_scale, porod_exp, lorentz_scale, lorentz_length, peak_pos, lorentz_exp):
84    inten = (porod_scale/q**porod_exp + lorentz_scale
85        / (1.0 + (abs(q-peak_pos)*lorentz_length)**lorentz_exp))
86    return inten
87Iq.vectorized = True  # Iq accepts an array of Q values
88
89def Iqxy(qx, qy, *args):
90    return Iq(sqrt(qx**2 + qy**2), *args)
91Iqxy.vectorized = True # Iqxy accepts an array of Qx, Qy values
92
93
94demo = dict(
95    scale=1, background=0,
96    porod_scale=1.0e-05, porod_exp=3,
97    lorentz_scale=10,lorentz_length=50, peak_pos=0.1, lorentz_exp=2,
98    )
99
100oldname = "BroadPeakModel"
101oldpars = dict(porod_scale='scale_p', porod_exp='exponent_p',
102        lorentz_scale='scale_l', lorentz_length='length_l', peak_pos='q_peak',
103        lorentz_exp='exponent_l', scale=None)
Note: See TracBrowser for help on using the repository browser.