source: sasmodels/sasmodels/models/lorentz.py @ 0507e09

core_shell_microgelsmagnetic_modelticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 0507e09 was 0507e09, checked in by smk78, 5 years ago

Added link to source code to each model. Closes #883

  • Property mode set to 100644
File size: 1.8 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
24Source
25------
26
27`lorentz.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/lorentz.py>`_
28
29Authorship and Verification
30----------------------------
31
32* **Author:**
33* **Last Modified by:**
34* **Last Reviewed by:**
35* **Source added by :** Steve King **Date:** March 25, 2019"""
36
37import numpy as np
38from numpy import inf
39
40name = "lorentz"
41title = "Ornstein-Zernicke correlation length model"
42description = """
43Model that evaluates a Lorentz (Ornstein-Zernicke) model.
44
45I(q) = scale/( 1 + (q*L)^2 ) + bkd
46
47The model has three parameters:
48    length = screening Length
49    scale = scale factor
50    background = incoherent background
51"""
52category = "shape-independent"
53
54#             ["name", "units", default, [lower, upper], "type","description"],
55parameters = [["cor_length", "Ang", 50.0, [0, inf], "", "Screening length"],]
56
57Iq = """
58    double denominator = 1 + (q*cor_length)*(q*cor_length);
59    return 1/denominator;
60"""
61
62def random():
63    """Return a random parameter set for the model."""
64    pars = dict(
65        #background=0,
66        scale=10**np.random.uniform(1, 4),
67        cor_length=10**np.random.uniform(0, 3),
68    )
69    return pars
70
71# parameters for demo
72demo = dict(scale=1.0, background=0.0, cor_length=50.0)
73
74# parameters for unit tests
75tests = [[{'cor_length': 250}, 0.01, 0.138931]]
Note: See TracBrowser for help on using the repository browser.