[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 | The returned value is scaled to units of |cm^-1|, absolute scale. |
---|
| 13 | |
---|
| 14 | Definition |
---|
| 15 | ---------- |
---|
| 16 | |
---|
| 17 | The scattering intensity *I(q)* is calculated as |
---|
| 18 | |
---|
[f57d123] | 19 | .. math: |
---|
| 20 | |
---|
| 21 | I(q) = \frac{A}{Q^n} + \frac{C}{1 + (Q\xi}^m} + B |
---|
[636adb6] | 22 | |
---|
| 23 | Here the peak position is related to the d-spacing as *Q0* = 2|pi| / *d0*. |
---|
| 24 | |
---|
| 25 | For 2D data: The 2D scattering intensity is calculated in the same way as 1D, |
---|
| 26 | where the *q* vector is defined as |
---|
| 27 | |
---|
[f57d123] | 28 | .. math: |
---|
| 29 | |
---|
| 30 | q = \sqrt{q_x^2 + q_y^2} |
---|
[636adb6] | 31 | |
---|
| 32 | |
---|
[d138d43] | 33 | .. figure:: img/broad_peak_1d.jpg |
---|
[636adb6] | 34 | |
---|
[d138d43] | 35 | 1D plot using the default values (w/200 data point). |
---|
[636adb6] | 36 | |
---|
| 37 | REFERENCE |
---|
[a5d0d00] | 38 | --------- |
---|
[636adb6] | 39 | |
---|
| 40 | None. |
---|
| 41 | |
---|
| 42 | *2013/09/09 - Description reviewed by King, S and Parker, P.* |
---|
| 43 | |
---|
| 44 | """ |
---|
| 45 | |
---|
[3c56da87] | 46 | from numpy import inf, sqrt |
---|
[636adb6] | 47 | |
---|
| 48 | name = "broad_peak" |
---|
| 49 | title = "Broad Lorentzian type peak on top of a power law decay" |
---|
| 50 | description = """\ |
---|
| 51 | I(q) = scale_p/pow(q,exponent)+scale_l/ |
---|
| 52 | (1.0 + pow((fabs(q-q_peak)*length_l),exponent_l) )+ background |
---|
| 53 | |
---|
| 54 | List of default parameters: |
---|
| 55 | porod_scale = Porod term scaling |
---|
| 56 | porod_exp = Porod exponent |
---|
| 57 | lorentz_scale = Lorentzian term scaling |
---|
| 58 | lorentz_length = Lorentzian screening length [A] |
---|
| 59 | peak_pos = peak location [1/A] |
---|
| 60 | lorentz_exp = Lorentzian exponent |
---|
| 61 | background = Incoherent background""" |
---|
[485aee2] | 62 | category = "shape-independent" |
---|
[636adb6] | 63 | |
---|
[485aee2] | 64 | # ["name", "units", default, [lower, upper], "type", "description"], |
---|
| 65 | parameters = [["porod_scale", "", 1.0e-05, [-inf, inf], "", "Power law scale factor"], |
---|
| 66 | ["porod_exp", "", 3.0, [-inf, inf], "", "Exponent of power law"], |
---|
| 67 | ["lorentz_scale", "", 10.0, [-inf, inf], "", "Scale factor for broad Lorentzian peak"], |
---|
| 68 | ["lorentz_length", "Ang", 50.0, [-inf, inf], "", "Lorentzian screening length"], |
---|
| 69 | ["peak_pos", "1/Ang", 0.1, [-inf, inf], "", "Peak postion in q"], |
---|
| 70 | ["lorentz_exp", "", 2.0, [-inf, inf], "", "exponent of Lorentz function"], |
---|
| 71 | ] |
---|
[636adb6] | 72 | |
---|
| 73 | def Iq(q, porod_scale, porod_exp, lorentz_scale, lorentz_length, peak_pos, lorentz_exp): |
---|
[485aee2] | 74 | inten = (porod_scale / q ** porod_exp + lorentz_scale |
---|
| 75 | / (1.0 + (abs(q - peak_pos) * lorentz_length) ** lorentz_exp)) |
---|
[3c56da87] | 76 | return inten |
---|
| 77 | Iq.vectorized = True # Iq accepts an array of Q values |
---|
[636adb6] | 78 | |
---|
[f734e7d] | 79 | def Iqxy(qx, qy, *args): |
---|
[485aee2] | 80 | return Iq(sqrt(qx ** 2 + qy ** 2), *args) |
---|
[3c56da87] | 81 | Iqxy.vectorized = True # Iqxy accepts an array of Qx, Qy values |
---|
[636adb6] | 82 | |
---|
| 83 | |
---|
[485aee2] | 84 | demo = dict(scale=1, background=0, |
---|
| 85 | porod_scale=1.0e-05, porod_exp=3, |
---|
| 86 | lorentz_scale=10, lorentz_length=50, peak_pos=0.1, lorentz_exp=2) |
---|
[3c56da87] | 87 | |
---|
[636adb6] | 88 | oldname = "BroadPeakModel" |
---|
[3c56da87] | 89 | oldpars = dict(porod_scale='scale_p', porod_exp='exponent_p', |
---|
[485aee2] | 90 | lorentz_scale='scale_l', lorentz_length='length_l', peak_pos='q_peak', |
---|
| 91 | lorentz_exp='exponent_l', scale=None) |
---|