[77ad412] | 1 | r""" |
---|
| 2 | Lorentz (Ornstein-Zernicke Model) |
---|
| 3 | |
---|
| 4 | Definition |
---|
| 5 | ---------- |
---|
| 6 | |
---|
| 7 | The Ornstein-Zernicke model is defined by |
---|
| 8 | |
---|
[eb69cce] | 9 | .. math:: I(q)=\frac{\text{scale}}{1+(qL)^2}+\text{background} |
---|
[77ad412] | 10 | |
---|
[eb69cce] | 11 | The parameter $L$ is the screening length *cor_length*. |
---|
[77ad412] | 12 | |
---|
[eb69cce] | 13 | For 2D data the scattering intensity is calculated in the same way as 1D, |
---|
[d138d43] | 14 | where the $q$ vector is defined as |
---|
[77ad412] | 15 | |
---|
| 16 | .. math:: q=\sqrt{q_x^2 + q_y^2} |
---|
| 17 | |
---|
[d138d43] | 18 | |
---|
[eb69cce] | 19 | References |
---|
| 20 | ---------- |
---|
[77ad412] | 21 | |
---|
| 22 | L.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 | |
---|
| 26 | from numpy import inf |
---|
| 27 | |
---|
| 28 | name = "lorentz" |
---|
| 29 | title = "Ornstein-Zernicke correlation length model" |
---|
| 30 | description = """ |
---|
| 31 | Model that evaluates a Lorentz (Ornstein-Zernicke) model. |
---|
[404ebbd] | 32 | |
---|
[77ad412] | 33 | I(q) = scale/( 1 + (q*L)^2 ) + bkd |
---|
[404ebbd] | 34 | |
---|
| 35 | The model has three parameters: |
---|
| 36 | length = screening Length |
---|
| 37 | scale = scale factor |
---|
| 38 | background = incoherent background |
---|
[77ad412] | 39 | """ |
---|
| 40 | category = "shape-independent" |
---|
| 41 | |
---|
| 42 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
| 43 | parameters = [["cor_length", "Ang", 50.0, [0, inf], "", "Screening length"],] |
---|
| 44 | |
---|
| 45 | Iq = """ |
---|
| 46 | double denominator = 1 + (q*cor_length)*(q*cor_length); |
---|
| 47 | return 1/denominator; |
---|
| 48 | """ |
---|
| 49 | |
---|
[404ebbd] | 50 | def random(): |
---|
| 51 | import numpy as np |
---|
| 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 | |
---|
[77ad412] | 59 | # parameters for demo |
---|
[705bcb1] | 60 | demo = dict(scale=1.0, background=0.0, cor_length=50.0) |
---|
[77ad412] | 61 | |
---|
[66ebdd6] | 62 | # parameters for unit tests |
---|
[6dd90c1] | 63 | tests = [[{'cor_length': 250}, 0.01, 0.138931]] |
---|