source: sasmodels/sasmodels/models/lorentz.py @ 66ebdd6

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 66ebdd6 was 66ebdd6, checked in by krzywon, 8 years ago

Finished the hollow_cylinder model and added unit tests to guinier and
lorentz models.

  • Property mode set to 100644
File size: 1.6 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{bkg}
10
11The parameter *L* is the screening length.
12
13For 2D data: The 2D 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.. image:: img/image179.jpg
19
20*Figure. 1D plot using the default values (w/200 data point).*
21REFERENCE
22
23L.S. Qrnstein and F. Zernike, *Proc. Acad. Sci. Amsterdam* 17, 793 (1914), and
24*Z. Phys.* 19, 134 (1918), and 27, 761 {1926); referred to as QZ.
25"""
26
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
51Iqxy = """
52    return Iq(sqrt(qx*qx + qy*qy), cor_length);
53    """
54
55# parameters for demo
56demo = dict(scale=1.0,background=0.0,cor_length=50.0)
57
58# For testing against the old sasview models, include the converted parameter
59# names and the target sasview model name.
60oldname = 'LorentzModel'
61oldpars = dict(cor_length='length')
62
63# parameters for unit tests
64tests = [
65         [{'cor_length' : 250},0.01,0.137931]
66         ]
Note: See TracBrowser for help on using the repository browser.