source: sasmodels/sasmodels/models/gaussian_peak.py @ 13ed84c

core_shell_microgelscostrafo411magnetic_modelrelease_v0.94release_v0.95ticket-1257-vesicle-productticket_1156ticket_1265_superballticket_822_more_unit_tests
Last change on this file since 13ed84c was 13ed84c, checked in by Paul Kienzle <pkienzle@…>, 8 years ago

set single=False on all models that fail the single precision tests

  • Property mode set to 100644
File size: 1.7 KB
Line 
1r"""
2
3Definition
4----------
5
6This model describes a Gaussian shaped peak on a flat background
7
8.. math::
9
10    I(q) = (\text{scale}) \exp\left[ -\tfrac12 (q-q_0)^2 / \sigma^2 \right]
11        + \text{background}
12
13with the peak having height of *scale* centered at $q_0$ and having a standard
14deviation of $\sigma$. The FWHM (full-width half-maximum) is $2.354 \sigma$.
15
16For 2D data, scattering intensity is calculated in the same way as 1D,
17where the $q$ vector is defined as
18
19.. math::
20
21    q = \sqrt{q_x^2 + q_y^2}
22
23
24.. figure:: img/gaussian_peak_1d.jpg
25
26    1D plot using the default values (w/500 data points).
27
28References
29----------
30
31None.
32"""
33
34from numpy import inf
35
36name = "gaussian_peak"
37title = "Gaussian shaped peak"
38description = """
39    Model describes a Gaussian shaped peak including a flat background
40    Provide F(q) = scale*exp( -1/2 *[(q-q0)/sigma]^2 )+ background
41"""
42category = "shape-independent"
43
44single = False
45#             ["name", "units", default, [lower, upper], "type","description"],
46parameters = [["q0", "1/Ang", 0.05, [-inf, inf], "", "Peak position"],
47              ["sigma", "1/Ang", 0.005, [0, inf], "",
48               "Peak width (standard deviation)"],
49             ]
50
51# No volume normalization despite having a volume parameter
52# This should perhaps be volume normalized?
53form_volume = """
54    return 1.0;
55    """
56
57Iq = """
58    double scaled_dq = (q - q0)/sigma;
59    return exp(-0.5*scaled_dq*scaled_dq); //sqrt(2*M_PI*sigma*sigma);
60    """
61
62
63Iqxy = """
64    // never called since no orientation or magnetic parameters.
65    //return -1.0;
66    return Iq(sqrt(qx*qx + qy*qy), q0, sigma);
67    """
68
69
70# VR defaults to 1.0
71
72demo = dict(scale=1, background=0, q0=0.05, sigma=0.005)
73oldname = "PeakGaussModel"
74oldpars = dict(sigma='B')
Note: See TracBrowser for help on using the repository browser.