source: sasmodels/sasmodels/models/lorentz.py @ c1e44e5

Last change on this file since c1e44e5 was c1e44e5, checked in by Paul Kienzle <pkienzle@…>, 5 years ago

Add local link to source files. Refs #1263.

  • Property mode set to 100644
File size: 1.7 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
22.. [#] L.S. Qrnstein and F. Zernike, *Proc. Acad. Sci. Amsterdam* 17, 793 (1914), and *Z. Phys.* 19, 134 (1918), and 27, 761 {1926); referred to as QZ.
23
24Authorship and Verification
25----------------------------
26
27* **Author:**
28* **Last Modified by:**
29* **Last Reviewed by:**
30"""
31
32import numpy as np
33from numpy import inf
34
35name = "lorentz"
36title = "Ornstein-Zernicke correlation length model"
37description = """
38Model that evaluates a Lorentz (Ornstein-Zernicke) model.
39
40I(q) = scale/( 1 + (q*L)^2 ) + bkd
41
42The model has three parameters:
43    length = screening Length
44    scale = scale factor
45    background = incoherent background
46"""
47category = "shape-independent"
48
49#             ["name", "units", default, [lower, upper], "type","description"],
50parameters = [["cor_length", "Ang", 50.0, [0, inf], "", "Screening length"],]
51
52Iq = """
53    double denominator = 1 + (q*cor_length)*(q*cor_length);
54    return 1/denominator;
55"""
56
57def random():
58    """Return a random parameter set for the model."""
59    pars = dict(
60        #background=0,
61        scale=10**np.random.uniform(1, 4),
62        cor_length=10**np.random.uniform(0, 3),
63    )
64    return pars
65
66# parameters for demo
67demo = dict(scale=1.0, background=0.0, cor_length=50.0)
68
69# parameters for unit tests
70tests = [[{'cor_length': 250}, 0.01, 0.138931]]
Note: See TracBrowser for help on using the repository browser.