[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 | .. figure:: img/lorentz_1d.jpg |
---|
[77ad412] | 19 | |
---|
[d138d43] | 20 | 1D plot using the default values (w/200 data point). |
---|
| 21 | |
---|
[eb69cce] | 22 | References |
---|
| 23 | ---------- |
---|
[77ad412] | 24 | |
---|
| 25 | L.S. Qrnstein and F. Zernike, *Proc. Acad. Sci. Amsterdam* 17, 793 (1914), and |
---|
| 26 | *Z. Phys.* 19, 134 (1918), and 27, 761 {1926); referred to as QZ. |
---|
| 27 | """ |
---|
| 28 | |
---|
| 29 | from numpy import inf |
---|
| 30 | |
---|
| 31 | name = "lorentz" |
---|
| 32 | title = "Ornstein-Zernicke correlation length model" |
---|
| 33 | description = """ |
---|
| 34 | Model that evaluates a Lorentz (Ornstein-Zernicke) model. |
---|
| 35 | |
---|
| 36 | I(q) = scale/( 1 + (q*L)^2 ) + bkd |
---|
| 37 | |
---|
| 38 | The model has three parameters: |
---|
| 39 | length = screening Length |
---|
| 40 | scale = scale factor |
---|
| 41 | background = incoherent background |
---|
| 42 | """ |
---|
| 43 | category = "shape-independent" |
---|
| 44 | |
---|
| 45 | # ["name", "units", default, [lower, upper], "type","description"], |
---|
| 46 | parameters = [["cor_length", "Ang", 50.0, [0, inf], "", "Screening length"],] |
---|
| 47 | |
---|
| 48 | Iq = """ |
---|
| 49 | double denominator = 1 + (q*cor_length)*(q*cor_length); |
---|
| 50 | return 1/denominator; |
---|
| 51 | """ |
---|
| 52 | |
---|
| 53 | Iqxy = """ |
---|
| 54 | return Iq(sqrt(qx*qx + qy*qy), cor_length); |
---|
| 55 | """ |
---|
| 56 | |
---|
| 57 | # parameters for demo |
---|
| 58 | demo = dict(scale=1.0,background=0.0,cor_length=50.0) |
---|
| 59 | |
---|
| 60 | # For testing against the old sasview models, include the converted parameter |
---|
| 61 | # names and the target sasview model name. |
---|
| 62 | oldname = 'LorentzModel' |
---|
[66ebdd6] | 63 | oldpars = dict(cor_length='length') |
---|
| 64 | |
---|
| 65 | # parameters for unit tests |
---|
| 66 | tests = [ |
---|
| 67 | [{'cor_length' : 250},0.01,0.137931] |
---|
| 68 | ] |
---|