source: sasmodels/sasmodels/models/lorentz.py @ 2d81cfe

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 2d81cfe was 2d81cfe, checked in by Paul Kienzle <pkienzle@…>, 6 years ago

lint

  • Property mode set to 100644
File size: 1.5 KB
Line 
1r"""
2Lorentz (Ornstein-Zernicke Model)
3
4Definition
5----------
6
7The Ornstein-Zernicke model is defined by
8
9.. math:: I(q)=\frac{\text{scale}}{1+(qL)^2}+\text{background}
10
11The parameter $L$ is the screening length *cor_length*.
12
13For 2D data the scattering intensity is calculated in the same way as 1D,
14where the $q$ vector is defined as
15
16.. math:: q=\sqrt{q_x^2 + q_y^2}
17
18
19References
20----------
21
22L.S. Qrnstein and F. Zernike, *Proc. Acad. Sci. Amsterdam* 17, 793 (1914), and
23*Z. Phys.* 19, 134 (1918), and 27, 761 {1926); referred to as QZ.
24"""
25
26import numpy as np
27from numpy import inf
28
29name = "lorentz"
30title = "Ornstein-Zernicke correlation length model"
31description = """
32Model that evaluates a Lorentz (Ornstein-Zernicke) model.
33
34I(q) = scale/( 1 + (q*L)^2 ) + bkd
35
36The model has three parameters:
37    length = screening Length
38    scale = scale factor
39    background = incoherent background
40"""
41category = "shape-independent"
42
43#             ["name", "units", default, [lower, upper], "type","description"],
44parameters = [["cor_length", "Ang", 50.0, [0, inf], "", "Screening length"],]
45
46Iq = """
47    double denominator = 1 + (q*cor_length)*(q*cor_length);
48    return 1/denominator;
49"""
50
51def random():
52    pars = dict(
53        #background=0,
54        scale=10**np.random.uniform(1, 4),
55        cor_length=10**np.random.uniform(0, 3),
56    )
57    return pars
58
59# parameters for demo
60demo = dict(scale=1.0, background=0.0, cor_length=50.0)
61
62# parameters for unit tests
63tests = [[{'cor_length': 250}, 0.01, 0.138931]]
Note: See TracBrowser for help on using the repository browser.