1 | r""" |
---|
2 | This model fits the Porod function |
---|
3 | |
---|
4 | .. math:: I(q) = C/q^4 |
---|
5 | |
---|
6 | to the data directly without any need for linearisation (cf. Log I(q) vs Log q). |
---|
7 | |
---|
8 | Here $C = 2\pi (\Delta\rho)^2 S_v$ is the scale factor where $S_v$ is |
---|
9 | the specific surface area (ie, surface area / volume) of the sample, and |
---|
10 | $\Delta\rho$ is the contrast factor. |
---|
11 | |
---|
12 | For 2D data: The 2D scattering intensity is calculated in the same way as 1D, |
---|
13 | where the q vector is defined as |
---|
14 | |
---|
15 | .. math:: q = \sqrt{q_x^2+q_y^2} |
---|
16 | |
---|
17 | References |
---|
18 | ---------- |
---|
19 | |
---|
20 | .. [#] G Porod. *Kolloid Zeit*. 124 (1951) 83 |
---|
21 | .. [#] L A Feigin, D I Svergun, G W Taylor. *Structure Analysis by Small-Angle X-ray and Neutron Scattering*. Springer. (1987) |
---|
22 | |
---|
23 | Source |
---|
24 | ------ |
---|
25 | |
---|
26 | `porod.py <https://github.com/SasView/sasmodels/blob/master/sasmodels/models/porod.py>`_ |
---|
27 | |
---|
28 | Authorship and Verification |
---|
29 | ---------------------------- |
---|
30 | |
---|
31 | * **Author:** |
---|
32 | * **Last Modified by:** |
---|
33 | * **Last Reviewed by:** |
---|
34 | * **Source added by :** Steve King **Date:** March 25, 2019 |
---|
35 | """ |
---|
36 | |
---|
37 | import numpy as np |
---|
38 | from numpy import inf, errstate |
---|
39 | |
---|
40 | name = "porod" |
---|
41 | title = "Porod function" |
---|
42 | description = """\ |
---|
43 | I(q) = scale/q^4 + background |
---|
44 | """ |
---|
45 | |
---|
46 | category = "shape-independent" |
---|
47 | |
---|
48 | parameters = [] |
---|
49 | |
---|
50 | def Iq(q): |
---|
51 | """ |
---|
52 | @param q: Input q-value |
---|
53 | """ |
---|
54 | with errstate(divide='ignore'): |
---|
55 | return q**-4 |
---|
56 | |
---|
57 | Iq.vectorized = True # Iq accepts an array of q values |
---|
58 | |
---|
59 | def random(): |
---|
60 | """Return a random parameter set for the model.""" |
---|
61 | sld, solvent = np.random.uniform(-0.5, 12, size=2) |
---|
62 | radius = 10**np.random.uniform(1, 4.7) |
---|
63 | Vf = 10**np.random.uniform(-3, -1) |
---|
64 | scale = 1e-4 * Vf * 2*np.pi*(sld-solvent)**2/(3*radius) |
---|
65 | pars = dict( |
---|
66 | scale=scale, |
---|
67 | ) |
---|
68 | return pars |
---|
69 | |
---|
70 | demo = dict(scale=1.5, background=0.5) |
---|
71 | |
---|
72 | tests = [ |
---|
73 | [{'scale': 0.00001, 'background':0.01}, 0.04, 3.916250], |
---|
74 | [{}, 0.0, inf], |
---|
75 | ] |
---|