source:
sasmodels/sasmodels/models/porod.py
@
82923a6
Last change on this file since 82923a6 was 82923a6, checked in by Paul Kienzle <pkienzle@…>, 8 years ago | |
---|---|
|
|
File size: 1.4 KB |
Rev | Line | |
---|---|---|
[19b6d28] | 1 | r""" |
2 | This model fits the Porod function | |
3 | ||
4 | .. math:: | |
5 | ||
6 | I(q) = C/q^4 | |
7 | \\ | |
8 | C = 2\pi (\Delta\rho)^2 S_v | |
9 | ||
10 | to the data directly without any need for linearisation (cf. Log I(q) vs Log q). | |
11 | ||
[16bb433] | 12 | Here $C$ is the scale factor and $S_v$ is the specific surface area (ie, surface area / volume) |
[19b6d28] | 13 | of the sample, and $\Delta\rho$ is the contrast factor. |
14 | ||
[cc3fac6] | 15 | For 2D data: The 2D scattering intensity is calculated in the same way as 1D, |
[16bb433] | 16 | where the q vector is defined as |
[19b6d28] | 17 | |
18 | .. math:: | |
19 | q = \sqrt{q_x^2+q_y^2} | |
20 | ||
[2f63032] | 21 | References |
22 | ---------- | |
23 | ||
24 | G Porod. *Kolloid Zeit*. 124 (1951) 83. | |
25 | L A Feigin, D I Svergun, G W Taylor. *Structure Analysis by Small-Angle X-ray and Neutron Scattering*. Springer. (1987) | |
[19b6d28] | 26 | """ |
27 | ||
[82923a6] | 28 | from numpy import sqrt, power, inf, errstate |
[19b6d28] | 29 | |
30 | name = "porod" | |
31 | title = "Porod function" | |
32 | description = """\ | |
33 | I(q) = scale/q^4 + background | |
34 | """ | |
35 | ||
36 | category = "shape-independent" | |
37 | ||
38 | parameters = [] | |
39 | ||
40 | def Iq(q): | |
41 | """ | |
42 | @param q: Input q-value | |
43 | """ | |
[82923a6] | 44 | with errstate(divide='ignore'): |
45 | return power(q, -4) | |
[19b6d28] | 46 | |
47 | Iq.vectorized = True # Iq accepts an array of q values | |
48 | ||
49 | def Iqxy(qx, qy, *args): | |
50 | """ | |
51 | @param qx: Input q_x-value | |
52 | @param qy: Input q_y-value | |
53 | @param args: Remaining arguments | |
54 | """ | |
55 | return Iq(sqrt(qx ** 2 + qy ** 2), *args) | |
56 | ||
57 | Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values | |
58 | ||
59 | demo = dict(scale=1.5, background=0.5) | |
60 | ||
[82923a6] | 61 | tests = [ |
62 | [{'scale': 0.00001, 'background':0.01}, 0.04, 3.916250], | |
63 | [{}, 0.0, inf], | |
64 | ] |
Note: See TracBrowser
for help on using the repository browser.