[636adb6] | 1 | r""" |
---|
| 2 | This model calculates an empirical functional form for SAS data characterized |
---|
| 3 | by a broad scattering peak. Many SAS spectra are characterized by a broad peak |
---|
| 4 | even though they are from amorphous soft materials. For example, soft systems |
---|
| 5 | that show a SAS peak include copolymers, polyelectrolytes, multiphase systems, |
---|
| 6 | layered structures, etc. |
---|
| 7 | |
---|
[3c56da87] | 8 | The d-spacing corresponding to the broad peak is a characteristic distance |
---|
| 9 | between the scattering inhomogeneities (such as in lamellar, cylindrical, or |
---|
[636adb6] | 10 | spherical morphologies, or for bicontinuous structures). |
---|
| 11 | |
---|
| 12 | Definition |
---|
| 13 | ---------- |
---|
| 14 | |
---|
[eb69cce] | 15 | The scattering intensity $I(q)$ is calculated as |
---|
[636adb6] | 16 | |
---|
[eb69cce] | 17 | .. math:: |
---|
[f57d123] | 18 | |
---|
[aad336c] | 19 | I(q) = \frac{A}{q^n} + \frac{C}{1 + (|q - q_0|\xi)^m} + B |
---|
[636adb6] | 20 | |
---|
[eb69cce] | 21 | Here the peak position is related to the d-spacing as $q_o = 2\pi / d_o$. |
---|
[636adb6] | 22 | |
---|
[aad336c] | 23 | $A$ is the Porod law scale factor, $n$ the Porod exponent, $C$ is the Lorentzian |
---|
| 24 | scale factor, $m$ the exponent of q, \ |xi|\ the screening length, and $B$ the flat background. |
---|
| 25 | |
---|
[eb69cce] | 26 | For 2D data the scattering intensity is calculated in the same way as 1D, |
---|
| 27 | where the $q$ vector is defined as |
---|
[636adb6] | 28 | |
---|
[eb69cce] | 29 | .. math:: |
---|
[f57d123] | 30 | |
---|
| 31 | q = \sqrt{q_x^2 + q_y^2} |
---|
[636adb6] | 32 | |
---|
| 33 | |
---|
[eb69cce] | 34 | References |
---|
| 35 | ---------- |
---|
[636adb6] | 36 | |
---|
| 37 | None. |
---|
| 38 | |
---|
| 39 | *2013/09/09 - Description reviewed by King, S and Parker, P.* |
---|
| 40 | |
---|
| 41 | """ |
---|
| 42 | |
---|
[3c56da87] | 43 | from numpy import inf, sqrt |
---|
[636adb6] | 44 | |
---|
| 45 | name = "broad_peak" |
---|
| 46 | title = "Broad Lorentzian type peak on top of a power law decay" |
---|
| 47 | description = """\ |
---|
| 48 | I(q) = scale_p/pow(q,exponent)+scale_l/ |
---|
| 49 | (1.0 + pow((fabs(q-q_peak)*length_l),exponent_l) )+ background |
---|
| 50 | |
---|
| 51 | List of default parameters: |
---|
| 52 | porod_scale = Porod term scaling |
---|
| 53 | porod_exp = Porod exponent |
---|
| 54 | lorentz_scale = Lorentzian term scaling |
---|
| 55 | lorentz_length = Lorentzian screening length [A] |
---|
| 56 | peak_pos = peak location [1/A] |
---|
| 57 | lorentz_exp = Lorentzian exponent |
---|
| 58 | background = Incoherent background""" |
---|
[485aee2] | 59 | category = "shape-independent" |
---|
[636adb6] | 60 | |
---|
[dcdf29d] | 61 | # pylint: disable=bad-whitespace, line-too-long |
---|
[485aee2] | 62 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
[dcdf29d] | 63 | parameters = [["porod_scale", "", 1.0e-05, [-inf, inf], "", "Power law scale factor"], |
---|
| 64 | ["porod_exp", "", 3.0, [-inf, inf], "", "Exponent of power law"], |
---|
| 65 | ["lorentz_scale", "", 10.0, [-inf, inf], "", "Scale factor for broad Lorentzian peak"], |
---|
| 66 | ["lorentz_length", "Ang", 50.0, [-inf, inf], "", "Lorentzian screening length"], |
---|
| 67 | ["peak_pos", "1/Ang", 0.1, [-inf, inf], "", "Peak position in q"], |
---|
| 68 | ["lorentz_exp", "", 2.0, [-inf, inf], "", "Exponent of Lorentz function"], |
---|
[485aee2] | 69 | ] |
---|
[dcdf29d] | 70 | # pylint: enable=bad-whitespace, line-too-long |
---|
| 71 | |
---|
| 72 | def Iq(q, |
---|
| 73 | porod_scale=1.0e-5, |
---|
| 74 | porod_exp=3.0, |
---|
| 75 | lorentz_scale=10.0, |
---|
| 76 | lorentz_length=50.0, |
---|
| 77 | peak_pos=0.1, |
---|
| 78 | lorentz_exp=2.0): |
---|
| 79 | """ |
---|
| 80 | :param q: Input q-value |
---|
| 81 | :param porod_scale: Power law scale factor |
---|
| 82 | :param porod_exp: Exponent of power law |
---|
| 83 | :param lorentz_scale: Scale factor for broad Lorentzian peak |
---|
| 84 | :param lorentz_length: Lorentzian screening length |
---|
| 85 | :param peak_pos: Peak position in q |
---|
| 86 | :param lorentz_exp: Exponent of Lorentz function |
---|
| 87 | :return: Calculated intensity |
---|
| 88 | """ |
---|
[636adb6] | 89 | |
---|
[485aee2] | 90 | inten = (porod_scale / q ** porod_exp + lorentz_scale |
---|
| 91 | / (1.0 + (abs(q - peak_pos) * lorentz_length) ** lorentz_exp)) |
---|
[3c56da87] | 92 | return inten |
---|
[eb69cce] | 93 | Iq.vectorized = True # Iq accepts an array of q values |
---|
[636adb6] | 94 | |
---|
[f734e7d] | 95 | def Iqxy(qx, qy, *args): |
---|
[dcdf29d] | 96 | """ |
---|
| 97 | :param qx: Input q_x-value |
---|
| 98 | :param qy: Input q_y-value |
---|
| 99 | :param args: Remaining arguments |
---|
| 100 | :return: 2D-Intensity |
---|
| 101 | """ |
---|
[485aee2] | 102 | return Iq(sqrt(qx ** 2 + qy ** 2), *args) |
---|
[dcdf29d] | 103 | Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values |
---|
[636adb6] | 104 | |
---|
[485aee2] | 105 | demo = dict(scale=1, background=0, |
---|
| 106 | porod_scale=1.0e-05, porod_exp=3, |
---|
| 107 | lorentz_scale=10, lorentz_length=50, peak_pos=0.1, lorentz_exp=2) |
---|