Changeset a807206 in sasmodels


Ignore:
Timestamp:
Oct 1, 2016 12:42:06 AM (5 years ago)
Author:
butler
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
caddb14, 5031ca3
Parents:
2222134
Message:

updating more parameter names addressing #649

Location:
sasmodels/models
Files:
43 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/correlation_length.py

    r40a87fa ra807206  
    1616multiplicative factors $A$ and $C$, and the two exponents $n$ and $m$ are 
    1717used as fitting parameters. (Respectively *porod_scale*, *lorentz_scale*, 
    18 *exponent_p* and *exponent_l* in the parameter list.) The remaining 
     18*porod_exp* and *lorentz_exp* in the parameter list.) The remaining 
    1919parameter $\xi$ (*cor_length* in the parameter list) is a correlation 
    2020length for the polymer chains. Note that when $m=2$ this functional form 
     
    4848              ["porod_scale", "", 1e-06, [0, inf], "", "Porod Scaling Factor"], 
    4949              ["cor_length", "Ang", 50.0, [0, inf], "", "Correlation length, xi, in Lorentzian"], 
    50               ["exponent_p", "", 3.0, [0, inf], "", "Porod Exponent, n, in q^-n"], 
    51               ["exponent_l", "1/Ang^2", 2.0, [0, inf], "", "Lorentzian Exponent, m, in 1/( 1 + (q.xi)^m)"], 
     50              ["porod_exp", "", 3.0, [0, inf], "", "Porod Exponent, n, in q^-n"], 
     51              ["lorentz_exp", "1/Ang^2", 2.0, [0, inf], "", "Lorentzian Exponent, m, in 1/( 1 + (q.xi)^m)"], 
    5252             ] 
    5353# pylint: enable=bad-continuation, line-too-long 
    5454 
    55 def Iq(q, lorentz_scale, porod_scale, cor_length, exponent_p, exponent_l): 
     55def Iq(q, lorentz_scale, porod_scale, cor_length, porod_exp, lorentz_exp): 
    5656    """ 
    5757    1D calculation of the Correlation length model 
    5858    """ 
    5959    with errstate(divide='ignore'): 
    60         porod = porod_scale / q**exponent_p 
    61         lorentz = lorentz_scale / (1.0 + (q * cor_length)**exponent_l) 
     60        porod = porod_scale / q**porod_exp 
     61        lorentz = lorentz_scale / (1.0 + (q * cor_length)**lorentz_exp) 
    6262    inten = porod + lorentz 
    6363    return inten 
     
    6666# parameters for demo 
    6767demo = dict(lorentz_scale=10.0, porod_scale=1.0e-06, cor_length=50.0, 
    68             exponent_p=3.0, exponent_l=2.0, background=0.1, 
     68            porod_exp=3.0, lorentz_exp=2.0, background=0.1, 
    6969           ) 
    7070 
  • sasmodels/models/dab.py

    r2c74c11 ra807206  
    5555 
    5656#             ["name", "units", default, [lower, upper], "type", "description"], 
    57 parameters = [["length", "Ang", 50.0, [0, inf], "", "correlation length"], 
     57parameters = [["cor_length", "Ang", 50.0, [0, inf], "", "correlation length"], 
    5858             ] 
    5959 
    6060Iq = """ 
    61     double numerator   = pow(length, 3); 
    62     double denominator = pow(1 + pow(q*length,2), 2); 
     61    double numerator   = pow(cor_length, 3); 
     62    double denominator = pow(1 + pow(q*cor_length,2), 2); 
    6363     
    6464    return numerator / denominator ; 
     
    6969# VR defaults to 1.0 
    7070 
    71 demo = dict(scale=1, background=0, length=50) 
     71demo = dict(scale=1, background=0, cor_length=50) 
  • sasmodels/models/ellipsoid.c

    r50e1e40 ra807206  
    1 double form_volume(double rpolar, double requatorial); 
    2 double Iq(double q, double sld, double solvent_sld, double rpolar, double requatorial); 
    3 double Iqxy(double qx, double qy, double sld, double solvent_sld, 
    4     double rpolar, double requatorial, double theta, double phi); 
     1double form_volume(double radius_polar, double radius_equatorial); 
     2double Iq(double q, double sld, double sld_solvent, double radius_polar, double radius_equatorial); 
     3double Iqxy(double qx, double qy, double sld, double sld_solvent, 
     4    double radius_polar, double radius_equatorial, double theta, double phi); 
    55 
    6 double _ellipsoid_kernel(double q, double rpolar, double requatorial, double sin_alpha); 
    7 double _ellipsoid_kernel(double q, double rpolar, double requatorial, double sin_alpha) 
     6double _ellipsoid_kernel(double q, double radius_polar, double radius_equatorial, double sin_alpha); 
     7double _ellipsoid_kernel(double q, double radius_polar, double radius_equatorial, double sin_alpha) 
    88{ 
    9     double ratio = rpolar/requatorial; 
    10     const double u = q*requatorial*sqrt(1.0 
     9    double ratio = radius_polar/radius_equatorial; 
     10    const double u = q*radius_equatorial*sqrt(1.0 
    1111                   + sin_alpha*sin_alpha*(ratio*ratio - 1.0)); 
    1212    const double f = sph_j1c(u); 
     
    1515} 
    1616 
    17 double form_volume(double rpolar, double requatorial) 
     17double form_volume(double radius_polar, double radius_equatorial) 
    1818{ 
    19     return M_4PI_3*rpolar*requatorial*requatorial; 
     19    return M_4PI_3*radius_polar*radius_equatorial*radius_equatorial; 
    2020} 
    2121 
    2222double Iq(double q, 
    2323    double sld, 
    24     double solvent_sld, 
    25     double rpolar, 
    26     double requatorial) 
     24    double sld_solvent, 
     25    double radius_polar, 
     26    double radius_equatorial) 
    2727{ 
    2828    // translate a point in [-1,1] to a point in [0, 1] 
     
    3333        //const double sin_alpha = (Gauss76Z[i]*(upper-lower) + upper + lower)/2; 
    3434        const double sin_alpha = Gauss76Z[i]*zm + zb; 
    35         total += Gauss76Wt[i] * _ellipsoid_kernel(q, rpolar, requatorial, sin_alpha); 
     35        total += Gauss76Wt[i] * _ellipsoid_kernel(q, radius_polar, radius_equatorial, sin_alpha); 
    3636    } 
    3737    // translate dx in [-1,1] to dx in [lower,upper] 
    3838    const double form = total*zm; 
    39     const double s = (sld - solvent_sld) * form_volume(rpolar, requatorial); 
     39    const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); 
    4040    return 1.0e-4 * s * s * form; 
    4141} 
     
    4343double Iqxy(double qx, double qy, 
    4444    double sld, 
    45     double solvent_sld, 
    46     double rpolar, 
    47     double requatorial, 
     45    double sld_solvent, 
     46    double radius_polar, 
     47    double radius_equatorial, 
    4848    double theta, 
    4949    double phi) 
     
    5555    // TODO: check if this is actually sin(alpha), not cos(alpha) 
    5656    const double cos_alpha = cn*cos(phi*M_PI_180)*(qx/q) + sn*(qy/q); 
    57     const double form = _ellipsoid_kernel(q, rpolar, requatorial, cos_alpha); 
    58     const double s = (sld - solvent_sld) * form_volume(rpolar, requatorial); 
     57    const double form = _ellipsoid_kernel(q, radius_polar, radius_equatorial, cos_alpha); 
     58    const double s = (sld - sld_solvent) * form_volume(radius_polar, radius_equatorial); 
    5959 
    6060    return 1.0e-4 * form * s * s; 
  • sasmodels/models/ellipsoid.py

    r42356c8 ra807206  
    7474    calculated from our 2D model and the intensity from the NIST SANS 
    7575    analysis software. The parameters used were: *scale* = 1.0, 
    76     *r_polar* = 20 |Ang|, *r_equatorial* = 400 |Ang|, 
     76    *radius_polar* = 20 |Ang|, *radius_equatorial* = 400 |Ang|, 
    7777    *contrast* = 3e-6 |Ang^-2|, and *background* = 0.0 |cm^-1|. 
    7878 
     
    122122              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", 
    123123               "Solvent scattering length density"], 
    124               ["r_polar", "Ang", 20, [0, inf], "volume", 
     124              ["radius_polar", "Ang", 20, [0, inf], "volume", 
    125125               "Polar radius"], 
    126               ["r_equatorial", "Ang", 400, [0, inf], "volume", 
     126              ["radius_equatorial", "Ang", 400, [0, inf], "volume", 
    127127               "Equatorial radius"], 
    128128              ["theta", "degrees", 60, [-inf, inf], "orientation", 
     
    134134source = ["lib/sph_j1c.c", "lib/gauss76.c", "ellipsoid.c"] 
    135135 
    136 def ER(r_polar, r_equatorial): 
     136def ER(radius_polar, radius_equatorial): 
    137137    import numpy as np 
    138138 
    139     ee = np.empty_like(r_polar) 
    140     idx = r_polar > r_equatorial 
    141     ee[idx] = (r_polar[idx] ** 2 - r_equatorial[idx] ** 2) / r_polar[idx] ** 2 
    142     idx = r_polar < r_equatorial 
    143     ee[idx] = (r_equatorial[idx] ** 2 - r_polar[idx] ** 2) / r_equatorial[idx] ** 2 
    144     idx = r_polar == r_equatorial 
    145     ee[idx] = 2 * r_polar[idx] 
    146     valid = (r_polar * r_equatorial != 0) 
     139    ee = np.empty_like(radius_polar) 
     140    idx = radius_polar > radius_equatorial 
     141    ee[idx] = (radius_polar[idx] ** 2 - radius_equatorial[idx] ** 2) / radius_polar[idx] ** 2 
     142    idx = radius_polar < radius_equatorial 
     143    ee[idx] = (radius_equatorial[idx] ** 2 - radius_polar[idx] ** 2) / radius_equatorial[idx] ** 2 
     144    idx = radius_polar == radius_equatorial 
     145    ee[idx] = 2 * radius_polar[idx] 
     146    valid = (radius_polar * radius_equatorial != 0) 
    147147    bd = 1.0 - ee[valid] 
    148148    e1 = np.sqrt(ee[valid]) 
     
    152152    delta = 0.75 * b1 * b2 
    153153 
    154     ddd = np.zeros_like(r_polar) 
    155     ddd[valid] = 2.0 * (delta + 1.0) * r_polar * r_equatorial ** 2 
     154    ddd = np.zeros_like(radius_polar) 
     155    ddd[valid] = 2.0 * (delta + 1.0) * radius_polar * radius_equatorial ** 2 
    156156    return 0.5 * ddd ** (1.0 / 3.0) 
    157157 
     
    159159demo = dict(scale=1, background=0, 
    160160            sld=6, sld_solvent=1, 
    161             r_polar=50, r_equatorial=30, 
     161            radius_polar=50, radius_equatorial=30, 
    162162            theta=30, phi=15, 
    163             r_polar_pd=.2, r_polar_pd_n=15, 
    164             r_equatorial_pd=.2, r_equatorial_pd_n=15, 
     163            radius_polar_pd=.2, radius_polar_pd_n=15, 
     164            radius_equatorial_pd=.2, radius_equatorial_pd_n=15, 
    165165            theta_pd=15, theta_pd_n=45, 
    166166            phi_pd=15, phi_pd_n=1) 
  • sasmodels/models/elliptical_cylinder.c

    r40a87fa ra807206  
    1 double form_volume(double r_minor, double r_ratio, double length); 
    2 double Iq(double q, double r_minor, double r_ratio, double length, 
     1double form_volume(double radius_minor, double r_ratio, double length); 
     2double Iq(double q, double radius_minor, double r_ratio, double length, 
    33          double sld, double solvent_sld); 
    4 double Iqxy(double qx, double qy, double r_minor, double r_ratio, double length, 
     4double Iqxy(double qx, double qy, double radius_minor, double r_ratio, double length, 
    55            double sld, double solvent_sld, double theta, double phi, double psi); 
    66 
    77 
    8 double _elliptical_cylinder_kernel(double q, double r_minor, double r_ratio, double theta); 
     8double _elliptical_cylinder_kernel(double q, double radius_minor, double r_ratio, double theta); 
    99 
    10 double _elliptical_cylinder_kernel(double q, double r_minor, double r_ratio, double theta) 
     10double _elliptical_cylinder_kernel(double q, double radius_minor, double r_ratio, double theta) 
    1111{ 
    1212    // This is the function LAMBDA1^2 in Feigin's notation 
    1313    // q is the q-value for the calculation (1/A) 
    14     // r_minor is the transformed radius"a" in Feigin's notation 
     14    // radius_minor is the transformed radius"a" in Feigin's notation 
    1515    // r_ratio is the ratio (major radius)/(minor radius) of the Ellipsoid [=] --- 
    1616    // theta is the dummy variable of the integration 
     
    1818    double retval,arg; 
    1919 
    20     arg = q*r_minor*sqrt((1.0+r_ratio*r_ratio)/2+(1.0-r_ratio*r_ratio)*cos(theta)/2); 
     20    arg = q*radius_minor*sqrt((1.0+r_ratio*r_ratio)/2+(1.0-r_ratio*r_ratio)*cos(theta)/2); 
    2121    //retval = 2.0*J1(arg)/arg; 
    2222    retval = sas_J1c(arg); 
     
    2525 
    2626 
    27 double form_volume(double r_minor, double r_ratio, double length) 
     27double form_volume(double radius_minor, double r_ratio, double length) 
    2828{ 
    29     return M_PI * r_minor * r_minor * r_ratio * length; 
     29    return M_PI * radius_minor * radius_minor * r_ratio * length; 
    3030} 
    3131 
    32 double Iq(double q, double r_minor, double r_ratio, double length, 
     32double Iq(double q, double radius_minor, double r_ratio, double length, 
    3333          double sld, double solvent_sld) { 
    3434 
     
    5555        summj=0; 
    5656        zi = ( Gauss76Z[i]*(vb-va) + va + vb )/2.0;     //the "x" dummy 
    57         arg = r_minor*sqrt(1.0-zi*zi); 
     57        arg = radius_minor*sqrt(1.0-zi*zi); 
    5858        for(int j=0;j<nordj;j++) { 
    5959            //20 gauss points for the inner integral 
     
    7777    answer *= delrho*delrho; 
    7878 
    79     const double vol = form_volume(r_minor, r_ratio, length); 
     79    const double vol = form_volume(radius_minor, r_ratio, length); 
    8080    return answer*vol*vol*1.0e-4; 
    8181} 
    8282 
    8383 
    84 double Iqxy(double qx, double qy, double r_minor, double r_ratio, double length, 
     84double Iqxy(double qx, double qy, double radius_minor, double r_ratio, double length, 
    8585            double sld, double solvent_sld, double theta, double phi, double psi) { 
    8686    const double _theta = theta * M_PI / 180.0; 
     
    139139    } 
    140140 
    141     const double r_major = r_ratio * r_minor; 
    142     const double qr = q*sqrt( r_major*r_major*cos_nu*cos_nu + r_minor*r_minor*cos_mu*cos_mu ); 
     141    const double r_major = r_ratio * radius_minor; 
     142    const double qr = q*sqrt( r_major*r_major*cos_nu*cos_nu + radius_minor*radius_minor*cos_mu*cos_mu ); 
    143143    const double qL = q*length*cos_val/2.0; 
    144144 
     
    159159 
    160160    const double k = 2.0 * Be * Si; 
    161     const double vol = form_volume(r_minor, r_ratio, length); 
     161    const double vol = form_volume(radius_minor, r_ratio, length); 
    162162    return (sld - solvent_sld) * (sld - solvent_sld) * k * k *vol*vol*1.0e-4; 
    163163} 
  • sasmodels/models/elliptical_cylinder.py

    r40a87fa ra807206  
    110110# pylint: disable=bad-whitespace, line-too-long 
    111111#             ["name", "units", default, [lower, upper], "type","description"], 
    112 parameters = [["r_minor",     "Ang",        20.0,  [0, inf],    "volume",      "Ellipse minor radius"], 
     112parameters = [["radius_minor",     "Ang",        20.0,  [0, inf],    "volume",      "Ellipse minor radius"], 
    113113              ["axis_ratio",   "",          1.5,   [1, inf],    "volume",      "Ratio of major radius over minor radius"], 
    114114              ["length",      "Ang",        400.0, [1, inf],    "volume",      "Length of the cylinder"], 
     
    124124          "elliptical_cylinder.c"] 
    125125 
    126 demo = dict(scale=1, background=0, r_minor=100, axis_ratio=1.5, length=400.0, 
     126demo = dict(scale=1, background=0, radius_minor=100, axis_ratio=1.5, length=400.0, 
    127127            sld=4.0, sld_solvent=1.0, theta=10.0, phi=20, psi=30, 
    128128            theta_pd=10, phi_pd=2, psi_pd=3) 
    129129 
    130 def ER(r_minor, axis_ratio, length): 
     130def ER(radius_minor, axis_ratio, length): 
    131131    """ 
    132132        Equivalent radius 
    133         @param r_minor: Ellipse minor radius 
     133        @param radius_minor: Ellipse minor radius 
    134134        @param axis_ratio: Ratio of major radius over minor radius 
    135135        @param length: Length of the cylinder 
    136136    """ 
    137     radius = sqrt(r_minor * r_minor * axis_ratio) 
     137    radius = sqrt(radius_minor * radius_minor * axis_ratio) 
    138138    ddd = 0.75 * radius * (2 * radius * length 
    139139                           + (length + radius) * (length + pi * radius)) 
     
    141141 
    142142tests = [ 
    143     [{'r_minor': 20.0, 'axis_ratio': 1.5, 'length':400.0}, 'ER', 79.89245454155024], 
    144     [{'r_minor': 20.0, 'axis_ratio': 1.2, 'length':300.0}, 'VR', 1], 
     143    [{'radius_minor': 20.0, 'axis_ratio': 1.5, 'length':400.0}, 'ER', 79.89245454155024], 
     144    [{'radius_minor': 20.0, 'axis_ratio': 1.2, 'length':300.0}, 'VR', 1], 
    145145 
    146146    # The SasView test result was 0.00169, with a background of 0.001 
    147     [{'r_minor': 20.0, 'axis_ratio': 1.5, 'sld': 4.0, 'length':400.0, 
     147    [{'radius_minor': 20.0, 'axis_ratio': 1.5, 'sld': 4.0, 'length':400.0, 
    148148      'sld_solvent':1.0, 'background':0.0}, 
    149149     0.001, 675.504402], 
  • sasmodels/models/fractal_core_shell.c

    r2c74c11 ra807206  
    88          double solvent_sld, 
    99          double volfraction, 
    10           double frac_dim, 
     10          double fractal_dim, 
    1111          double cor_length); 
    1212 
     
    2323          double solvent_sld, 
    2424          double volfraction, 
    25           double frac_dim, 
     25          double fractal_dim, 
    2626          double cor_length) { 
    2727 
     
    3434                              solvent_sld); 
    3535    //calculate S(q) 
    36     double frac_1 = frac_dim-1.0; 
     36    double frac_1 = fractal_dim-1.0; 
    3737    double qr = q*radius; 
    3838 
    39     double t1 = frac_dim*sas_gamma(frac_1)*sin(frac_1*atan(q*cor_length)); 
     39    double t1 = fractal_dim*sas_gamma(frac_1)*sin(frac_1*atan(q*cor_length)); 
    4040    double t2 = (1.0 + 1.0/(q*cor_length)/(q*cor_length)); 
    41     double t3 = pow(qr, frac_dim) * pow(t2, (frac_1/2.0)); 
     41    double t3 = pow(qr, fractal_dim) * pow(t2, (frac_1/2.0)); 
    4242    double sq = t1/t3; 
    4343    sq += 1.0; 
  • sasmodels/models/fractal_core_shell.py

    r42356c8 ra807206  
    3131    {(qr_c)^{D_f}\left(1+\frac{1}{q^2\xi ^2} \right)^{\frac{D_f-1}{2}}} 
    3232 
    33 where $D_f$ = frac_dim, |xi| = cor_length, $r_c$ = (core) radius, and 
     33where $D_f$ = fractal_dim, |xi| = cor_length, $r_c$ = (core) radius, and 
    3434$scale$ = volume fraction. 
    3535 
     
    6969    ["sld_solvent", "1e-6/Ang^2", 3.0,  [-inf, inf], "sld",    "Solvent scattering length density"], 
    7070    ["volfraction", "",           1.0,  [0, inf],    "",       "Volume fraction of building block spheres"], 
    71     ["frac_dim",    "",           2.0,  [-inf, inf], "",       "Fractal dimension"], 
     71    ["fractal_dim",    "",           2.0,  [-inf, inf], "",       "Fractal dimension"], 
    7272    ["cor_length",  "Ang",      100.0,  [0, inf],    "",       "Correlation length of fractal-like aggregates"]] 
    7373# pylint: enable=bad-whitespace, line-too-long 
     
    8383            sld_solvent=6.35, 
    8484            volfraction=0.05, 
    85             frac_dim=2.0, 
     85            fractal_dim=2.0, 
    8686            cor_length=100.0) 
    8787 
  • sasmodels/models/gauss_lorentz_gel.py

    r40a87fa ra807206  
    5656# pylint: disable=bad-whitespace, line-too-long 
    5757#            ["name", "units", default, [lower, upper], "type", "description"], 
    58 parameters = [["gauss_scale_factor",   "",    100.0,  [-inf, inf], "", "Gauss scale factor"], 
    59               ["static_cor_length",    "Ang", 100.0,  [0, inf],    "", "Static correlation length"], 
    60               ["lorentz_scale_factor", "",     50.0,  [-inf, inf], "", "Lorentzian scale factor"], 
    61               ["dynamic_cor_length",   "Ang",  20.0,  [0, inf],    "", "Dynamic correlation length"], 
     58parameters = [["gauss_scale",   "",    100.0,  [-inf, inf], "", "Gauss scale factor"], 
     59              ["cor_length_static",    "Ang", 100.0,  [0, inf],    "", "Static correlation length"], 
     60              ["lorentz_scale", "",     50.0,  [-inf, inf], "", "Lorentzian scale factor"], 
     61              ["cor_length_dynamic",   "Ang",  20.0,  [0, inf],    "", "Dynamic correlation length"], 
    6262             ] 
    6363# pylint: enable=bad-whitespace, line-too-long 
    6464 
    6565def Iq(q, 
    66        gauss_scale_factor=100.0, 
    67        static_cor_length=100.0, 
    68        lorentz_scale_factor=50.0, 
    69        dynamic_cor_length=20.0): 
     66       gauss_scale=100.0, 
     67       cor_length_static=100.0, 
     68       lorentz_scale=50.0, 
     69       cor_length_dynamic=20.0): 
    7070    """ 
    7171 
    7272    :param q:                    Input q-value 
    73     :param gauss_scale_factor:   Gauss scale factor 
    74     :param static_cor_length:    Static correlation length 
    75     :param lorentz_scale_factor: Lorentzian scale factor 
    76     :param dynamic_cor_length:   Dynamic correlation length 
     73    :param gauss_scale:   Gauss scale factor 
     74    :param cor_length_static:    Static correlation length 
     75    :param lorentz_scale: Lorentzian scale factor 
     76    :param cor_length_dynamic:   Dynamic correlation length 
    7777    :return:                     1-D intensity 
    7878    """ 
    7979 
    80     term1 = gauss_scale_factor *\ 
    81             exp(-1.0*q*q*static_cor_length*static_cor_length/2.0) 
    82     term2 = lorentz_scale_factor /\ 
    83             (1.0+(q*dynamic_cor_length)*(q*dynamic_cor_length)) 
     80    term1 = gauss_scale *\ 
     81            exp(-1.0*q*q*cor_length_static*cor_length_static/2.0) 
     82    term2 = lorentz_scale /\ 
     83            (1.0+(q*cor_length_dynamic)*(q*cor_length_dynamic)) 
    8484 
    8585    return term1 + term2 
     
    8989 
    9090demo = dict(scale=1, background=0.1, 
    91             gauss_scale_factor=100.0, 
    92             static_cor_length=100.0, 
    93             lorentz_scale_factor=50.0, 
    94             dynamic_cor_length=20.0) 
     91            gauss_scale=100.0, 
     92            cor_length_static=100.0, 
     93            lorentz_scale=50.0, 
     94            cor_length_dynamic=20.0) 
    9595 
    9696tests = [ 
    9797 
    9898    # Accuracy tests based on content in test/utest_extra_models.py 
    99     [{'gauss_scale_factor':  100.0, 
    100       'static_cor_length':   100.0, 
    101       'lorentz_scale_factor': 50.0, 
    102       'dynamic_cor_length':   20.0, 
     99    [{'gauss_scale':  100.0, 
     100      'cor_length_static':   100.0, 
     101      'lorentz_scale': 50.0, 
     102      'cor_length_dynamic':   20.0, 
    103103     }, 0.001, 149.482], 
    104104 
    105     [{'gauss_scale_factor':  100.0, 
    106       'static_cor_length':   100.0, 
    107       'lorentz_scale_factor': 50.0, 
    108       'dynamic_cor_length':   20.0, 
     105    [{'gauss_scale':  100.0, 
     106      'cor_length_static':   100.0, 
     107      'lorentz_scale': 50.0, 
     108      'cor_length_dynamic':   20.0, 
    109109     }, 0.105363, 9.1913], 
    110110 
    111     [{'gauss_scale_factor':  100.0, 
    112       'static_cor_length':   100.0, 
    113       'lorentz_scale_factor': 50.0, 
    114       'dynamic_cor_length':   20.0, 
     111    [{'gauss_scale':  100.0, 
     112      'cor_length_static':   100.0, 
     113      'lorentz_scale': 50.0, 
     114      'cor_length_dynamic':   20.0, 
    115115     }, 0.441623, 0.633811], 
    116116 
    117117    # Additional tests with larger range of parameters 
    118     [{'gauss_scale_factor':  10.0, 
    119       'static_cor_length':  100.0, 
    120       'lorentz_scale_factor': 3.0, 
    121       'dynamic_cor_length':   1.0, 
     118    [{'gauss_scale':  10.0, 
     119      'cor_length_static':  100.0, 
     120      'lorentz_scale': 3.0, 
     121      'cor_length_dynamic':   1.0, 
    122122     }, 0.1, 2.9712970297], 
    123123 
    124     [{'gauss_scale_factor':  10.0, 
    125       'static_cor_length':  100.0, 
    126       'lorentz_scale_factor': 3.0, 
    127       'dynamic_cor_length':   1.0, 
     124    [{'gauss_scale':  10.0, 
     125      'cor_length_static':  100.0, 
     126      'lorentz_scale': 3.0, 
     127      'cor_length_dynamic':   1.0, 
    128128      'background':         100.0 
    129129     }, 5.0, 100.116384615], 
    130130 
    131     [{'gauss_scale_factor':  10.0, 
    132       'static_cor_length':  100.0, 
    133       'lorentz_scale_factor': 3.0, 
    134       'dynamic_cor_length':   1.0, 
     131    [{'gauss_scale':  10.0, 
     132      'cor_length_static':  100.0, 
     133      'lorentz_scale': 3.0, 
     134      'cor_length_dynamic':   1.0, 
    135135      'background':           0.0, 
    136136     }, 200., 7.49981250469e-05], 
  • sasmodels/models/gaussian_peak.py

    r7f1ee79 ra807206  
    3434description = """ 
    3535    Model describes a Gaussian shaped peak including a flat background 
    36     Provide F(q) = scale*exp( -1/2 *[(q-q0)/sigma]^2 )+ background 
     36    Provide F(q) = scale*exp( -1/2 *[(q-peak_pos)/sigma]^2 )+ background 
    3737""" 
    3838category = "shape-independent" 
    3939 
    4040#             ["name", "units", default, [lower, upper], "type","description"], 
    41 parameters = [["q0", "1/Ang", 0.05, [-inf, inf], "", "Peak position"], 
     41parameters = [["peak_pos", "1/Ang", 0.05, [-inf, inf], "", "Peak position"], 
    4242              ["sigma", "1/Ang", 0.005, [0, inf], "", 
    4343               "Peak width (standard deviation)"], 
     
    4545 
    4646Iq = """ 
    47     double scaled_dq = (q - q0)/sigma; 
     47    double scaled_dq = (q - peak_pos)/sigma; 
    4848    return exp(-0.5*scaled_dq*scaled_dq); //sqrt(2*M_PI*sigma*sigma); 
    4949    """ 
     
    5151# VR defaults to 1.0 
    5252 
    53 demo = dict(scale=1, background=0, q0=0.05, sigma=0.005) 
     53demo = dict(scale=1, background=0, peak_pos=0.05, sigma=0.005) 
  • sasmodels/models/gel_fit.c

    r03cac08 ra807206  
    11static double Iq(double q, 
    22          double guinier_scale, 
    3           double lorentzian_scale, 
    4           double gyration_radius, 
    5           double fractal_exp, 
     3          double lorentz_scale, 
     4          double rg, 
     5          double fractal_dim, 
    66          double cor_length) 
    77{ 
     
    99    ////////////////////////double a(x[i]*x[i]*zeta*zeta); 
    1010    double lorentzian_term = square(q*cor_length); 
    11     lorentzian_term = 1.0 + ((fractal_exp + 1.0)/3.0)*lorentzian_term; 
    12     lorentzian_term = pow(lorentzian_term, (fractal_exp/2.0) ); 
     11    lorentzian_term = 1.0 + ((fractal_dim + 1.0)/3.0)*lorentzian_term; 
     12    lorentzian_term = pow(lorentzian_term, (fractal_dim/2.0) ); 
    1313 
    1414    // Exponential Term 
    1515    ////////////////////////double d(x[i]*x[i]*rg*rg); 
    16     double exp_term = square(q*gyration_radius); 
     16    double exp_term = square(q*rg); 
    1717    exp_term = exp(-1.0*(exp_term/3.0)); 
    1818 
    1919    // Scattering Law 
    20     double result = lorentzian_scale/lorentzian_term + guinier_scale*exp_term; 
     20    double result = lorentz_scale/lorentzian_term + guinier_scale*exp_term; 
    2121    return result; 
    2222} 
  • sasmodels/models/gel_fit.py

    r40a87fa ra807206  
    6262#             ["name", "units", default, [lower, upper], "type","description"], 
    6363parameters = [["guinier_scale",    "cm^-1",   1.7, [-inf, inf], "", "Guinier length scale"], 
    64               ["lorentzian_scale", "cm^-1",   3.5, [-inf, inf], "", "Lorentzian length scale"], 
    65               ["gyration_radius",  "Ang",     104.0, [2, inf],    "", "Radius of gyration"], 
    66               ["fractal_exp",      "",          2.0, [0, inf],    "", "Fractal exponent"], 
     64              ["lorentz_scale", "cm^-1",   3.5, [-inf, inf], "", "Lorentzian length scale"], 
     65              ["rg",  "Ang",     104.0, [2, inf],    "", "Radius of gyration"], 
     66              ["fractal_dim",      "",          2.0, [0, inf],    "", "Fractal exponent"], 
    6767              ["cor_length",       "Ang",      16.0, [0, inf],    "", "Correlation length"] 
    6868             ] 
     
    7373demo = dict(background=0.01, 
    7474            guinier_scale=1.7, 
    75             lorentzian_scale=3.5, 
    76             gyration_radius=104, 
    77             fractal_exp=2.0, 
     75            lorentz_scale=3.5, 
     76            rg=104, 
     77            fractal_dim=2.0, 
    7878            cor_length=16.0) 
    7979 
    8080tests = [[{'guinier_scale': 1.0, 
    81            'lorentzian_scale': 1.0, 
    82            'gyration_radius': 10.0, 
    83            'fractal_exp': 10.0, 
     81           'lorentz_scale': 1.0, 
     82           'rg': 10.0, 
     83           'fractal_dim': 10.0, 
    8484           'cor_length': 20.0, 
    8585           'background': 0.0, 
     
    8787 
    8888         [{'guinier_scale': 4.0, 
    89            'lorentzian_scale': 10.0, 
    90            'gyration_radius': 500.0, 
    91            'fractal_exp': 1.0, 
     89           'lorentz_scale': 10.0, 
     90           'rg': 500.0, 
     91           'fractal_dim': 1.0, 
    9292           'cor_length': 20.0, 
    9393           'background': 20.0, 
  • sasmodels/models/guinier_porod.py

    r40a87fa ra807206  
    7272description = """\ 
    7373         I(q) = scale/q^s* exp ( - R_g^2 q^2 / (3-s) ) for q<= ql 
    74          = scale/q^m*exp((-ql^2*Rg^2)/(3-s))*ql^(m-s) for q>=ql 
    75                         where ql = sqrt((m-s)(3-s)/2)/Rg. 
     74         = scale/q^porod_exp*exp((-ql^2*Rg^2)/(3-s))*ql^(porod_exp-s) for q>=ql 
     75                        where ql = sqrt((porod_exp-s)(3-s)/2)/Rg. 
    7676                        List of parameters: 
    7777                        scale = Guinier Scale 
    7878                        s = Dimension Variable 
    7979                        Rg = Radius of Gyration [A]  
    80                         m = Porod Exponent 
     80                        porod_exp = Porod Exponent 
    8181                        background  = Background [1/cm]""" 
    8282 
     
    8787parameters = [["rg", "Ang", 60.0, [0, inf], "", "Radius of gyration"], 
    8888              ["s",  "",    1.0,  [0, inf], "", "Dimension variable"], 
    89               ["m",  "",    3.0,  [0, inf], "", "Porod exponent"]] 
     89              ["porod_exp",  "",    3.0,  [0, inf], "", "Porod exponent"]] 
    9090# pylint: enable=bad-whitespace, line-too-long 
    9191 
    9292# pylint: disable=C0103 
    93 def Iq(q, rg, s, m): 
     93def Iq(q, rg, s, porod_exp): 
    9494    """ 
    9595    @param q: Input q-value 
    9696    """ 
    9797    n = 3.0 - s 
    98     ms = 0.5*(m-s) # =(n-3+m)/2 
     98    ms = 0.5*(porod_exp-s) # =(n-3+porod_exp)/2 
    9999 
    100100    # preallocate return value 
     
    109109    with errstate(divide='ignore'): 
    110110        iq[idx] = q[idx]**-s * exp(-(q[idx]*rg)**2/n) 
    111         iq[~idx] = q[~idx]**-m * (exp(-ms) * (n*ms/rg**2)**ms) 
     111        iq[~idx] = q[~idx]**-porod_exp * (exp(-ms) * (n*ms/rg**2)**ms) 
    112112    return iq 
    113113 
    114114Iq.vectorized = True # Iq accepts an array of q values 
    115115 
    116 demo = dict(scale=1.5, background=0.5, rg=60, s=1.0, m=3.0) 
     116demo = dict(scale=1.5, background=0.5, rg=60, s=1.0, porod_exp=3.0) 
    117117 
    118118tests = [[{'scale': 1.5, 'background':0.5}, 0.04, 5.290096890253155]] 
  • sasmodels/models/hayter_msa.py

    r0bef47b ra807206  
    5151#  dp[2] = volfraction(); 
    5252#  dp[3] = temperature(); 
    53 #  dp[4] = salt_concentration(); 
     53#  dp[4] = concentration_salt(); 
    5454#  dp[5] = dielectconst(); 
    5555 
     
    7676    ["charge",        "e",   19.0,    [0, inf],    "", "charge on sphere (in electrons)"], 
    7777    ["temperature",   "K",  318.16,   [0, inf],    "", "temperature, in Kelvin, for Debye length calculation"], 
    78     ["salt_concentration",      "M",    0.0,    [-inf, inf], "", "conc of salt, moles/litre, 1:1 electolyte, for Debye length"], 
     78    ["concentration_salt",      "M",    0.0,    [-inf, inf], "", "conc of salt, moles/litre, 1:1 electolyte, for Debye length"], 
    7979    ["dielectconst",  "None",    71.08,   [-inf, inf], "", "dielectric constant (relative permittivity) of solvent, default water, for Debye length"] 
    8080    ] 
     
    9393# note the calculation varies in different limiting cases so a wide range of 
    9494# parameters will be required for a thorough test! 
    95 # odd that the default st has salt_concentration zero 
     95# odd that the default st has concentration_salt zero 
    9696demo = dict(radius_effective=20.75, 
    9797            charge=19.0, 
    9898            volfraction=0.0192, 
    9999            temperature=318.16, 
    100             salt_concentration=0.05, 
     100            concentration_salt=0.05, 
    101101            dielectconst=71.08, 
    102102            radius_effective_pd=0.1, 
     
    113113      'volfraction': 0.0192, 
    114114      'temperature': 298.0, 
    115       'salt_concentration': 0, 
     115      'concentration_salt': 0, 
    116116      'dielectconst': 78.0, 
    117117      'radius_effective_pd': 0}, 
     
    123123      'volfraction': 0.0192, 
    124124      'temperature': 298.0, 
    125       'salt_concentration': 0.05, 
     125      'concentration_salt': 0.05, 
    126126      'dielectconst': 78.0, 
    127127      'radius_effective_pd': 0.1, 
  • sasmodels/models/hollow_cylinder.c

    rf95556f ra807206  
    1 double form_volume(double radius, double core_radius, double length); 
     1double form_volume(double radius, double radius_core, double length); 
    22 
    3 double Iq(double q, double radius, double core_radius, double length, double sld, 
     3double Iq(double q, double radius, double radius_core, double length, double sld, 
    44        double solvent_sld); 
    5 double Iqxy(double qx, double qy, double radius, double core_radius, double length, double sld, 
     5double Iqxy(double qx, double qy, double radius, double radius_core, double length, double sld, 
    66        double solvent_sld, double theta, double phi); 
    77 
    8 #define INVALID(v) (v.core_radius >= v.radius) 
     8#define INVALID(v) (v.radius_core >= v.radius) 
    99 
    1010// From Igor library 
     
    2727 
    2828static double _hollow_cylinder_kernel( 
    29     double q, double core_radius, double radius, double length, double dum) 
     29    double q, double radius_core, double radius, double length, double dum) 
    3030{ 
    3131    const double qs = q*sqrt(1.0-dum*dum); 
    3232    const double lam1 = sas_J1c(radius*qs); 
    33     const double lam2 = sas_J1c(core_radius*qs); 
    34     const double gamma_sq = square(core_radius/radius); 
    35     //Note: lim_{r -> r_c} psi = J0(core_radius*qs) 
     33    const double lam2 = sas_J1c(radius_core*qs); 
     34    const double gamma_sq = square(radius_core/radius); 
     35    //Note: lim_{r -> r_c} psi = J0(radius_core*qs) 
    3636    const double psi = (lam1 - gamma_sq*lam2)/(1.0 - gamma_sq); //SRK 10/19/00 
    3737    const double t2 = sinc(q*length*dum/2.0); 
     
    4141 
    4242static double hollow_cylinder_analytical_2D_scaled( 
    43     double q, double q_x, double q_y, double radius, double core_radius, 
     43    double q, double q_x, double q_y, double radius, double radius_core, 
    4444    double length, double sld, double solvent_sld, double theta, double phi) 
    4545{ 
     
    6565    cos_val = cyl_x*q_x + cyl_y*q_y;// + cyl_z*q_z; 
    6666 
    67     answer = _hollow_cylinder_kernel(q, core_radius, radius, length, cos_val); 
     67    answer = _hollow_cylinder_kernel(q, radius_core, radius, length, cos_val); 
    6868 
    69     vol = form_volume(radius, core_radius, length); 
     69    vol = form_volume(radius, radius_core, length); 
    7070    answer = hollow_cylinder_scaling(answer, delrho, vol); 
    7171 
     
    7474 
    7575 
    76 double form_volume(double radius, double core_radius, double length) 
     76double form_volume(double radius, double radius_core, double length) 
    7777{ 
    78     double v_shell = M_PI*length*(radius*radius-core_radius*core_radius); 
     78    double v_shell = M_PI*length*(radius*radius-radius_core*radius_core); 
    7979    return(v_shell); 
    8080} 
    8181 
    8282 
    83 double Iq(double q, double radius, double core_radius, double length, 
     83double Iq(double q, double radius, double radius_core, double length, 
    8484    double sld, double solvent_sld) 
    8585{ 
     
    9595    for (i=0;i<76;i++) { 
    9696        zi = ( Gauss76Z[i] * (upper-lower) + lower + upper )/2.0; 
    97         inter = Gauss76Wt[i] * _hollow_cylinder_kernel(q, core_radius, radius, length, zi); 
     97        inter = Gauss76Wt[i] * _hollow_cylinder_kernel(q, radius_core, radius, length, zi); 
    9898        summ += inter; 
    9999    } 
    100100 
    101101    norm = summ*(upper-lower)/2.0; 
    102     volume = form_volume(radius, core_radius, length); 
     102    volume = form_volume(radius, radius_core, length); 
    103103    delrho = solvent_sld - sld; 
    104104    answer = hollow_cylinder_scaling(norm, delrho, volume); 
     
    108108 
    109109 
    110 double Iqxy(double qx, double qy, double radius, double core_radius, 
     110double Iqxy(double qx, double qy, double radius, double radius_core, 
    111111    double length, double sld, double solvent_sld, double theta, double phi) 
    112112{ 
    113113    const double q = sqrt(qx*qx+qy*qy); 
    114     return hollow_cylinder_analytical_2D_scaled(q, qx/q, qy/q, radius, core_radius, length, sld, solvent_sld, theta, phi); 
     114    return hollow_cylinder_analytical_2D_scaled(q, qx/q, qy/q, radius, radius_core, length, sld, solvent_sld, theta, phi); 
    115115} 
  • sasmodels/models/hollow_cylinder.py

    r58210db ra807206  
    3939 
    4040In the parameters, the contrast represents SLD :sub:`shell` - SLD :sub:`solvent` 
    41 and the *radius* is $R_\text{shell}$ while *core_radius* is $R_\text{core}$. 
     41and the *radius* is $R_\text{shell}$ while *radius_core* is $R_\text{core}$. 
    4242 
    4343To provide easy access to the orientation of the core-shell cylinder, we define 
     
    5858description = """ 
    5959P(q) = scale*<f*f>/Vol + background, where f is the scattering amplitude. 
    60 core_radius = the radius of core 
     60radius_core = the radius of core 
    6161radius = the radius of shell 
    6262length = the total length of the cylinder 
     
    7070parameters = [ 
    7171    ["radius",      "Ang",     30.0, [0, inf],    "volume",      "Cylinder radius"], 
    72     ["core_radius", "Ang",     20.0, [0, inf],    "volume",      "Hollow core radius"], 
     72    ["radius_core", "Ang",     20.0, [0, inf],    "volume",      "Hollow core radius"], 
    7373    ["length",      "Ang",    400.0, [0, inf],    "volume",      "Cylinder length"], 
    7474    ["sld",         "1/Ang^2",  6.3, [-inf, inf], "sld",         "Cylinder sld"], 
     
    8282 
    8383# pylint: disable=W0613 
    84 def ER(radius, core_radius, length): 
     84def ER(radius, radius_core, length): 
    8585    """ 
    8686    :param radius:      Cylinder radius 
    87     :param core_radius: Hollow core radius, UNUSED 
     87    :param radius_core: Hollow core radius, UNUSED 
    8888    :param length:      Cylinder length 
    8989    :return:            Effective radius 
     
    9999    return diam 
    100100 
    101 def VR(radius, core_radius, length): 
     101def VR(radius, radius_core, length): 
    102102    """ 
    103103    :param radius:      Cylinder radius 
    104     :param core_radius: Hollow core radius 
     104    :param radius_core: Hollow core radius 
    105105    :param length:      Cylinder length 
    106106    :return:            Volf ratio for P(q)*S(q) 
    107107    """ 
    108     vol_core = pi*core_radius*core_radius*length 
     108    vol_core = pi*radius_core*radius_core*length 
    109109    vol_total = pi*radius*radius*length 
    110110    vol_shell = vol_total - vol_core 
     
    113113# parameters for demo 
    114114demo = dict(scale=1.0, background=0.0, length=400.0, radius=30.0, 
    115             core_radius=20.0, sld=6.3, sld_solvent=1, theta=90, phi=0, 
     115            radius_core=20.0, sld=6.3, sld_solvent=1, theta=90, phi=0, 
    116116            radius_pd=.2, radius_pd_n=9, 
    117117            length_pd=.2, length_pd_n=10, 
    118             core_radius_pd=.2, core_radius_pd_n=9, 
     118            radius_core_pd=.2, radius_core_pd_n=9, 
    119119            theta_pd=10, theta_pd_n=5, 
    120120           ) 
  • sasmodels/models/hollow_rectangular_prism.c

    rdeb7ee0 ra807206  
    1 double form_volume(double a_side, double b2a_ratio, double c2a_ratio, double thickness); 
    2 double Iq(double q, double sld, double solvent_sld, double a_side,  
     1double form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness); 
     2double Iq(double q, double sld, double solvent_sld, double length_a,  
    33          double b2a_ratio, double c2a_ratio, double thickness); 
    44double Iqxy(double qx, double qy, double sld, double solvent_sld,  
    5             double a_side, double b2a_ratio, double c2a_ratio, double thickness); 
     5            double length_a, double b2a_ratio, double c2a_ratio, double thickness); 
    66 
    7 double form_volume(double a_side, double b2a_ratio, double c2a_ratio, double thickness) 
     7double form_volume(double length_a, double b2a_ratio, double c2a_ratio, double thickness) 
    88{ 
    9     double b_side = a_side * b2a_ratio; 
    10     double c_side = a_side * c2a_ratio; 
    11     double a_core = a_side - 2.0*thickness; 
     9    double b_side = length_a * b2a_ratio; 
     10    double c_side = length_a * c2a_ratio; 
     11    double a_core = length_a - 2.0*thickness; 
    1212    double b_core = b_side - 2.0*thickness; 
    1313    double c_core = c_side - 2.0*thickness; 
    1414    double vol_core = a_core * b_core * c_core; 
    15     double vol_total = a_side * b_side * c_side; 
     15    double vol_total = length_a * b_side * c_side; 
    1616    double vol_shell = vol_total - vol_core; 
    1717    return vol_shell; 
     
    2121    double sld, 
    2222    double solvent_sld, 
    23     double a_side, 
     23    double length_a, 
    2424    double b2a_ratio, 
    2525    double c2a_ratio, 
     
    2828    double termA1, termA2, termB1, termB2, termC1, termC2; 
    2929     
    30     double b_side = a_side * b2a_ratio; 
    31     double c_side = a_side * c2a_ratio; 
    32     double a_half = 0.5 * a_side; 
     30    double b_side = length_a * b2a_ratio; 
     31    double c_side = length_a * c2a_ratio; 
     32    double a_half = 0.5 * length_a; 
    3333    double b_half = 0.5 * b_side; 
    3434    double c_half = 0.5 * c_side; 
     
    7373                if (fabs(arg) > 1.e-16) {termB2 = sin(arg)/arg;} else {termB2 = 1.0;} 
    7474 
    75             double AP1 = (a_side*b_side*c_side) * termA1 * termB1 * termC1; 
     75            double AP1 = (length_a*b_side*c_side) * termA1 * termB1 * termC1; 
    7676            double AP2 = 8.0 * (a_half-thickness) * (b_half-thickness) * (c_half-thickness) * termA2 * termB2 * termC2; 
    7777            double AP = AP1 - AP2; 
     
    105105    double sld, 
    106106    double solvent_sld, 
    107     double a_side, 
     107    double length_a, 
    108108    double b2a_ratio, 
    109109    double c2a_ratio, 
     
    111111{ 
    112112    double q = sqrt(qx*qx + qy*qy); 
    113     double intensity = Iq(q, sld, solvent_sld, a_side, b2a_ratio, c2a_ratio, thickness);  
     113    double intensity = Iq(q, sld, solvent_sld, length_a, b2a_ratio, c2a_ratio, thickness);  
    114114    return intensity;     
    115115} 
  • sasmodels/models/hollow_rectangular_prism.py

    r40a87fa ra807206  
    105105              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", 
    106106               "Solvent scattering length density"], 
    107               ["a_side", "Ang", 35, [0, inf], "volume", 
     107              ["length_a", "Ang", 35, [0, inf], "volume", 
    108108               "Shorter side of the parallelepiped"], 
    109109              ["b2a_ratio", "Ang", 1, [0, inf], "volume", 
     
    117117source = ["lib/gauss76.c", "hollow_rectangular_prism.c"] 
    118118 
    119 def ER(a_side, b2a_ratio, c2a_ratio, thickness): 
     119def ER(length_a, b2a_ratio, c2a_ratio, thickness): 
    120120    """ 
    121121    Return equivalent radius (ER) 
    122122    thickness parameter not used 
    123123    """ 
    124     b_side = a_side * b2a_ratio 
    125     c_side = a_side * c2a_ratio 
     124    b_side = length_a * b2a_ratio 
     125    c_side = length_a * c2a_ratio 
    126126 
    127127    # surface average radius (rough approximation) 
    128     surf_rad = sqrt(a_side * b_side / pi) 
     128    surf_rad = sqrt(length_a * b_side / pi) 
    129129 
    130130    ddd = 0.75 * surf_rad * (2 * surf_rad * c_side + (c_side + surf_rad) * (c_side + pi * surf_rad)) 
    131131    return 0.5 * (ddd) ** (1. / 3.) 
    132132 
    133 def VR(a_side, b2a_ratio, c2a_ratio, thickness): 
     133def VR(length_a, b2a_ratio, c2a_ratio, thickness): 
    134134    """ 
    135135    Return shell volume and total volume 
    136136    """ 
    137     b_side = a_side * b2a_ratio 
    138     c_side = a_side * c2a_ratio 
    139     a_core = a_side - 2.0*thickness 
     137    b_side = length_a * b2a_ratio 
     138    c_side = length_a * c2a_ratio 
     139    a_core = length_a - 2.0*thickness 
    140140    b_core = b_side - 2.0*thickness 
    141141    c_core = c_side - 2.0*thickness 
    142142    vol_core = a_core * b_core * c_core 
    143     vol_total = a_side * b_side * c_side 
     143    vol_total = length_a * b_side * c_side 
    144144    vol_shell = vol_total - vol_core 
    145145    return vol_total, vol_shell 
     
    149149demo = dict(scale=1, background=0, 
    150150            sld=6.3e-6, sld_solvent=1.0e-6, 
    151             a_side=35, b2a_ratio=1, c2a_ratio=1, thickness=1, 
    152             a_side_pd=0.1, a_side_pd_n=10, 
     151            length_a=35, b2a_ratio=1, c2a_ratio=1, thickness=1, 
     152            length_a_pd=0.1, length_a_pd_n=10, 
    153153            b2a_ratio_pd=0.1, b2a_ratio_pd_n=1, 
    154154            c2a_ratio_pd=0.1, c2a_ratio_pd_n=1) 
  • sasmodels/models/hollow_rectangular_prism_thin_walls.c

    r3d8283b ra807206  
    1 double form_volume(double a_side, double b2a_ratio, double c2a_ratio); 
    2 double Iq(double q, double sld, double solvent_sld, double a_side,  
     1double form_volume(double length_a, double b2a_ratio, double c2a_ratio); 
     2double Iq(double q, double sld, double solvent_sld, double length_a,  
    33          double b2a_ratio, double c2a_ratio); 
    44double Iqxy(double qx, double qy, double sld, double solvent_sld,  
    5             double a_side, double b2a_ratio, double c2a_ratio); 
     5            double length_a, double b2a_ratio, double c2a_ratio); 
    66 
    7 double form_volume(double a_side, double b2a_ratio, double c2a_ratio) 
     7double form_volume(double length_a, double b2a_ratio, double c2a_ratio) 
    88{ 
    9     double b_side = a_side * b2a_ratio; 
    10     double c_side = a_side * c2a_ratio; 
    11     double vol_shell = 2.0 * (a_side*b_side + a_side*c_side + b_side*c_side); 
     9    double b_side = length_a * b2a_ratio; 
     10    double c_side = length_a * c2a_ratio; 
     11    double vol_shell = 2.0 * (length_a*b_side + length_a*c_side + b_side*c_side); 
    1212    return vol_shell; 
    1313} 
     
    1616    double sld, 
    1717    double solvent_sld, 
    18     double a_side, 
     18    double length_a, 
    1919    double b2a_ratio, 
    2020    double c2a_ratio) 
    2121{ 
    22     double b_side = a_side * b2a_ratio; 
    23     double c_side = a_side * c2a_ratio; 
    24     double a_half = 0.5 * a_side; 
     22    double b_side = length_a * b2a_ratio; 
     23    double c_side = length_a * c2a_ratio; 
     24    double a_half = 0.5 * length_a; 
    2525    double b_half = 0.5 * b_side; 
    2626    double c_half = 0.5 * c_side; 
     
    8888    double sld, 
    8989    double solvent_sld, 
    90     double a_side, 
     90    double length_a, 
    9191    double b2a_ratio, 
    9292    double c2a_ratio) 
    9393{ 
    9494    double q = sqrt(qx*qx + qy*qy); 
    95     double intensity = Iq(q, sld, solvent_sld, a_side, b2a_ratio, c2a_ratio);  
     95    double intensity = Iq(q, sld, solvent_sld, length_a, b2a_ratio, c2a_ratio);  
    9696    return intensity;     
    9797} 
  • sasmodels/models/hollow_rectangular_prism_thin_walls.py

    r42356c8 ra807206  
    9191              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", 
    9292               "Solvent scattering length density"], 
    93               ["a_side", "Ang", 35, [0, inf], "volume", 
     93              ["length_a", "Ang", 35, [0, inf], "volume", 
    9494               "Shorter side of the parallelepiped"], 
    9595              ["b2a_ratio", "Ang", 1, [0, inf], "volume", 
     
    101101source = ["lib/gauss76.c", "hollow_rectangular_prism_thin_walls.c"] 
    102102 
    103 def ER(a_side, b2a_ratio, c2a_ratio): 
     103def ER(length_a, b2a_ratio, c2a_ratio): 
    104104    """ 
    105105        Return equivalent radius (ER) 
    106106    """ 
    107     b_side = a_side * b2a_ratio 
    108     c_side = a_side * c2a_ratio 
     107    b_side = length_a * b2a_ratio 
     108    c_side = length_a * c2a_ratio 
    109109 
    110110    # surface average radius (rough approximation) 
    111     surf_rad = sqrt(a_side * b_side / pi) 
     111    surf_rad = sqrt(length_a * b_side / pi) 
    112112 
    113113    ddd = 0.75 * surf_rad * (2 * surf_rad * c_side + (c_side + surf_rad) * (c_side + pi * surf_rad)) 
    114114    return 0.5 * (ddd) ** (1. / 3.) 
    115115 
    116 def VR(a_side, b2a_ratio, c2a_ratio): 
     116def VR(length_a, b2a_ratio, c2a_ratio): 
    117117    """ 
    118118        Return shell volume and total volume 
    119119    """ 
    120     b_side = a_side * b2a_ratio 
    121     c_side = a_side * c2a_ratio 
    122     vol_total = a_side * b_side * c_side 
    123     vol_shell = 2.0 * (a_side*b_side + a_side*c_side + b_side*c_side) 
     120    b_side = length_a * b2a_ratio 
     121    c_side = length_a * c2a_ratio 
     122    vol_total = length_a * b_side * c_side 
     123    vol_shell = 2.0 * (length_a*b_side + length_a*c_side + b_side*c_side) 
    124124    return vol_shell, vol_total 
    125125 
     
    128128demo = dict(scale=1, background=0, 
    129129            sld=6.3e-6, sld_solvent=1.0e-6, 
    130             a_side=35, b2a_ratio=1, c2a_ratio=1, 
    131             a_side_pd=0.1, a_side_pd_n=10, 
     130            length_a=35, b2a_ratio=1, c2a_ratio=1, 
     131            length_a_pd=0.1, length_a_pd_n=10, 
    132132            b2a_ratio_pd=0.1, b2a_ratio_pd_n=1, 
    133133            c2a_ratio_pd=0.1, c2a_ratio_pd_n=1) 
  • sasmodels/models/lamellar_hg.py

    r40a87fa ra807206  
    2525        \right\rbrace^2 
    2626 
    27 where $\delta_T$ is *tail_length*, $\delta_H$ is *head_length*, 
     27where $\delta_T$ is *length_tail*, $\delta_H$ is *length_head*, 
    2828$\Delta\rho_H$ is the head contrast (*sld_head* $-$ *sld_solvent*), 
    2929and $\Delta\rho_T$ is tail contrast (*sld* $-$ *sld_solvent*). 
     
    6767# pylint: disable=bad-whitespace, line-too-long 
    6868#             ["name", "units", default, [lower, upper], "type","description"], 
    69 parameters = [["tail_length", "Ang",       15,   [0, inf],  "volume",  "Tail thickness ( total = H+T+T+H)"], 
    70               ["head_length", "Ang",       10,   [0, inf],  "volume",  "Head thickness"], 
     69parameters = [["length_tail", "Ang",       15,   [0, inf],  "volume",  "Tail thickness ( total = H+T+T+H)"], 
     70              ["length_head", "Ang",       10,   [0, inf],  "volume",  "Head thickness"], 
    7171              ["sld",         "1e-6/Ang^2", 0.4, [-inf,inf], "sld",    "Tail scattering length density"], 
    7272              ["sld_head",    "1e-6/Ang^2", 3.0, [-inf,inf], "sld",    "Head scattering length density"], 
     
    8484    const double drh = sld_head - sld_solvent; 
    8585    const double drt = sld - sld_solvent;    //correction 13FEB06 by L.Porcar 
    86     const double qT = q*tail_length; 
     86    const double qT = q*length_tail; 
    8787    double Pq, inten; 
    88     Pq = drh*(sin(q*(head_length+tail_length))-sin(qT)) + drt*sin(qT); 
     88    Pq = drh*(sin(q*(length_head+length_tail))-sin(qT)) + drt*sin(qT); 
    8989    Pq *= Pq; 
    9090    Pq *= 4.0/(qsq); 
     
    9393 
    9494    // normalize by the bilayer thickness 
    95     inten /= 2.0*(head_length+tail_length); 
     95    inten /= 2.0*(length_head+length_tail); 
    9696 
    9797    return inten; 
     
    102102 
    103103demo = dict(scale=1, background=0, 
    104             tail_length=15, head_length=10, 
     104            length_tail=15, length_head=10, 
    105105            sld=0.4, sld_head=3.0, sld_solvent=6.0, 
    106             tail_length_pd=0.2, tail_length_pd_n=40, 
    107             head_length_pd=0.01, head_length_pd_n=40) 
     106            length_tail_pd=0.2, length_tail_pd_n=40, 
     107            length_head_pd=0.01, length_head_pd_n=40) 
    108108 
    109109# 
    110110tests = [ 
    111     [{'scale': 1.0, 'background': 0.0, 'tail_length': 15.0, 'head_length': 10.0, 
     111    [{'scale': 1.0, 'background': 0.0, 'length_tail': 15.0, 'length_head': 10.0, 
    112112      'sld': 0.4, 'sld_head': 3.0, 'sld_solvent': 6.0}, 
    113113     [0.001], [653143.9209]], 
  • sasmodels/models/lamellar_hg_stack_caille.c

    r0bef47b ra807206  
    44 
    55double Iq(double qval, 
    6       double tail_length, 
    7       double head_length, 
     6      double length_tail, 
     7      double length_head, 
    88      double Nlayers,  
    99      double dd, 
     
    1414 
    1515double Iq(double qval, 
    16       double tail_length, 
    17       double head_length, 
     16      double length_tail, 
     17      double length_head, 
    1818      double Nlayers,  
    1919      double dd, 
     
    3434  NN = trunc(Nlayers);    //be sure that NN is an integer 
    3535   
    36   Pq = (head_sld-solvent_sld)*(sin(qval*(head_length+tail_length))-sin(qval*tail_length)) + 
    37               (tail_sld-solvent_sld)*sin(qval*tail_length); 
     36  Pq = (head_sld-solvent_sld)*(sin(qval*(length_head+length_tail))-sin(qval*length_tail)) + 
     37              (tail_sld-solvent_sld)*sin(qval*length_tail); 
    3838  Pq *= Pq; 
    3939  Pq *= 4.0/(qval*qval); 
  • sasmodels/models/lamellar_hg_stack_caille.py

    r0bef47b ra807206  
    4242 
    4343 
    44 $\delta_T$ is the tail length (or *tail_length*), $\delta_H$ is the head 
    45 thickness (or *head_length*), $\Delta\rho_H$ is SLD(headgroup) - SLD(solvent), 
     44$\delta_T$ is the tail length (or *length_tail*), $\delta_H$ is the head 
     45thickness (or *length_head*), $\Delta\rho_H$ is SLD(headgroup) - SLD(solvent), 
    4646and $\Delta\rho_T$ is SLD(tail) - SLD(headgroup). Here $d$ is (repeat) spacing, 
    4747$K$ is smectic bending elasticity, $B$ is compression modulus, and $N$ is the 
     
    9494    #   [ "name", "units", default, [lower, upper], "type", 
    9595    #     "description" ], 
    96     ["tail_length", "Ang", 10, [0, inf], "volume", 
     96    ["length_tail", "Ang", 10, [0, inf], "volume", 
    9797     "Tail thickness"], 
    98     ["head_length", "Ang", 2, [0, inf], "volume", 
     98    ["length_head", "Ang", 2, [0, inf], "volume", 
    9999     "head thickness"], 
    100100    ["Nlayers", "", 30, [0, inf], "", 
     
    126126    scale=1, background=0, 
    127127    Nlayers=20, spacing=200., Caille_parameter=0.05, 
    128     tail_length=15, head_length=10, 
     128    length_tail=15, length_head=10, 
    129129    #sld=-1, sld_head=4.0, sld_solvent=6.0, 
    130130    sld=-1, sld_head=4.1, sld_solvent=6.0, 
    131     tail_length_pd=0.1, tail_length_pd_n=20, 
    132     head_length_pd=0.05, head_length_pd_n=30, 
     131    length_tail_pd=0.1, length_tail_pd_n=20, 
     132    length_head_pd=0.05, length_head_pd_n=30, 
    133133    spacing_pd=0.2, spacing_pd_n=40, 
    134134    ) 
    135135 
    136136# 
    137 tests = [[{'scale': 1.0, 'background': 0.0, 'tail_length': 10.0, 'head_length': 2.0, 
     137tests = [[{'scale': 1.0, 'background': 0.0, 'length_tail': 10.0, 'length_head': 2.0, 
    138138           'Nlayers': 30.0, 'spacing': 40., 'Caille_parameter': 0.001, 'sld': 0.4, 
    139            'sld_head': 2.0, 'sld_solvent': 6.0, 'tail_length_pd': 0.0, 
    140            'head_length_pd': 0.0, 'spacing_pd': 0.0}, [0.001], [6838238.571488]]] 
     139           'sld_head': 2.0, 'sld_solvent': 6.0, 'length_tail_pd': 0.0, 
     140           'length_head_pd': 0.0, 'spacing_pd': 0.0}, [0.001], [6838238.571488]]] 
    141141# ADDED by: RKH  ON: 18Mar2016  converted from sasview previously, now renaming everything & sorting the docs 
  • sasmodels/models/mass_fractal.c

    r2c74c11 ra807206  
    33double Iq(double q, 
    44          double radius, 
    5           double mass_dim, 
     5          double fractal_dim_mass, 
    66          double cutoff_length); 
    77 
    88static double _mass_fractal_kernel(double q, 
    99          double radius, 
    10           double mass_dim, 
     10          double fractal_dim_mass, 
    1111          double cutoff_length) 
    1212{ 
    1313    // Actively check the argument. 
    14     if (mass_dim <= 1.0){ 
     14    if (fractal_dim_mass <= 1.0){ 
    1515       return 0.0; 
    1616    } 
     
    2121 
    2222    //calculate S(q) 
    23     double mmo = mass_dim-1.0; 
     23    double mmo = fractal_dim_mass-1.0; 
    2424    double sq = sas_gamma(mmo)*sin((mmo)*atan(q*cutoff_length)); 
    2525    sq *= pow(cutoff_length, mmo); 
     
    3939double Iq(double q, 
    4040          double radius, 
    41           double mass_dim, 
     41          double fractal_dim_mass, 
    4242          double cutoff_length) 
    4343{ 
    4444    return _mass_fractal_kernel(q, 
    4545           radius, 
    46            mass_dim, 
     46           fractal_dim_mass, 
    4747           cutoff_length); 
    4848} 
  • sasmodels/models/mass_fractal.py

    rec45c4f ra807206  
    6868        where delta = sldParticle -sldSolv. 
    6969        radius       =  Particle radius 
    70         mass_dim  =  Mass fractal dimension 
     70        fractal_dim_mass  =  Mass fractal dimension 
    7171        cutoff_length  =  Cut-off length 
    7272        background   =  background 
    7373        Ref.:Mildner, Hall,J Phys D Appl Phys(1986), 9, 1535-1545 
    74         Note I: This model is valid for 1<mass_dim<6. 
     74        Note I: This model is valid for 1<fractal_dim_mass<6. 
    7575        Note II: This model is not in absolute scale. 
    7676        """ 
     
    8080#             ["name", "units", default, [lower, upper], "type","description"], 
    8181parameters = [["radius",        "Ang",  10.0, [0.0, inf], "", "Particle radius"], 
    82               ["mass_dim",      "",      1.9, [1.0, 6.0], "", "Mass fractal dimension"], 
     82              ["fractal_dim_mass",      "",      1.9, [1.0, 6.0], "", "Mass fractal dimension"], 
    8383              ["cutoff_length", "Ang", 100.0, [0.0, inf], "", "Cut-off length"], 
    8484             ] 
     
    8989demo = dict(scale=1, background=0, 
    9090            radius=10.0, 
    91             mass_dim=1.9, 
     91            fractal_dim_mass=1.9, 
    9292            cutoff_length=100.0) 
    9393 
     
    9696    # Accuracy tests based on content in test/utest_other_models.py 
    9797    [{'radius':         10.0, 
    98       'mass_dim':        1.9, 
     98      'fractal_dim_mass':        1.9, 
    9999      'cutoff_length': 100.0, 
    100100     }, 0.05, 279.59422], 
     
    102102    # Additional tests with larger range of parameters 
    103103    [{'radius':        2.0, 
    104       'mass_dim':      3.3, 
     104      'fractal_dim_mass':      3.3, 
    105105      'cutoff_length': 1.0, 
    106106     }, 0.5, 1.29116774904], 
    107107 
    108108    [{'radius':        1.0, 
    109       'mass_dim':      1.3, 
     109      'fractal_dim_mass':      1.3, 
    110110      'cutoff_length': 1.0, 
    111111      'background':    0.8, 
     
    113113 
    114114    [{'radius':        1.0, 
    115       'mass_dim':      2.3, 
     115      'fractal_dim_mass':      2.3, 
    116116      'cutoff_length': 1.0, 
    117117      'scale':        10.0, 
  • sasmodels/models/mass_surface_fractal.c

    r2c74c11 ra807206  
    22 
    33double Iq(double q, 
    4           double mass_dim, 
    5           double surface_dim, 
    6           double cluster_rg, 
     4          double fractal_dim_mass, 
     5          double fractal_dim_surf, 
     6          double rg_cluster, 
    77          double primary_rg); 
    88 
    99static double _mass_surface_fractal_kernel(double q, 
    10           double mass_dim, 
    11           double surface_dim, 
    12           double cluster_rg, 
     10          double fractal_dim_mass, 
     11          double fractal_dim_surf, 
     12          double rg_cluster, 
    1313          double primary_rg) 
    1414{ 
    1515     //computation 
    16     double tot_dim = 6.0 - surface_dim - mass_dim; 
    17     mass_dim /= 2.0; 
     16    double tot_dim = 6.0 - fractal_dim_surf - fractal_dim_mass; 
     17    fractal_dim_mass /= 2.0; 
    1818    tot_dim /= 2.0; 
    1919 
    20     double rc_norm = cluster_rg * cluster_rg / (3.0 * mass_dim); 
     20    double rc_norm = rg_cluster * rg_cluster / (3.0 * fractal_dim_mass); 
    2121    double rp_norm = primary_rg * primary_rg / (3.0 * tot_dim); 
    2222 
     
    2525    double x_val2 = 1.0 +  q * q * rp_norm; 
    2626 
    27     double inv_form = pow(x_val1, mass_dim) * pow(x_val2, tot_dim); 
     27    double inv_form = pow(x_val1, fractal_dim_mass) * pow(x_val2, tot_dim); 
    2828 
    2929    //another singular 
     
    4141 
    4242double Iq(double q, 
    43           double mass_dim, 
    44           double surface_dim, 
    45           double cluster_rg, 
     43          double fractal_dim_mass, 
     44          double fractal_dim_surf, 
     45          double rg_cluster, 
    4646          double primary_rg) 
    4747{ 
    4848    return _mass_surface_fractal_kernel(q, 
    49             mass_dim, 
    50             surface_dim, 
    51             cluster_rg, 
     49            fractal_dim_mass, 
     50            fractal_dim_surf, 
     51            rg_cluster, 
    5252            primary_rg); 
    5353} 
  • sasmodels/models/mass_surface_fractal.py

    rec45c4f ra807206  
    6666        b = rg^2/(3*(6-Ds-Dm)/2) 
    6767        scale        =  scale factor * N*Volume^2*contrast^2 
    68         mass_dim       =  Dm (mass fractal dimension) 
    69         surface_dim  =  Ds 
    70         cluster_rg  =  Rg 
     68        fractal_dim_mass       =  Dm (mass fractal dimension) 
     69        fractal_dim_surf  =  Ds 
     70        rg_cluster  =  Rg 
    7171        primary_rg    =  rg 
    7272        background   =  background 
     
    7979# pylint: disable=bad-whitespace, line-too-long 
    8080#             ["name", "units", default, [lower, upper], "type","description"], 
    81 parameters = [["mass_dim",      "",    1.8, [1e-16, 6.0], "", 
     81parameters = [["fractal_dim_mass",      "",    1.8, [1e-16, 6.0], "", 
    8282               "Mass fractal dimension"], 
    83               ["surface_dim",   "",    2.3, [1e-16, 6.0], "", 
     83              ["fractal_dim_surf",   "",    2.3, [1e-16, 6.0], "", 
    8484               "Surface fractal dimension"], 
    85               ["cluster_rg", "Ang",   86.7, [0.0, inf], "", 
     85              ["rg_cluster", "Ang",   86.7, [0.0, inf], "", 
    8686               "Cluster radius of gyration"], 
    8787              ["primary_rg", "Ang", 4000.,  [0.0, inf], "", 
     
    9393 
    9494demo = dict(scale=1, background=0, 
    95             mass_dim=1.8, 
    96             surface_dim=2.3, 
    97             cluster_rg=86.7, 
     95            fractal_dim_mass=1.8, 
     96            fractal_dim_surf=2.3, 
     97            rg_cluster=86.7, 
    9898            primary_rg=4000.0) 
    9999 
     
    101101 
    102102    # Accuracy tests based on content in test/utest_other_models.py 
    103     [{'mass_dim':      1.8, 
    104       'surface_dim':   2.3, 
    105       'cluster_rg':   86.7, 
     103    [{'fractal_dim_mass':      1.8, 
     104      'fractal_dim_surf':   2.3, 
     105      'rg_cluster':   86.7, 
    106106      'primary_rg': 4000.0, 
    107107      'background':    0.0, 
     
    109109 
    110110    # Additional tests with larger range of parameters 
    111     [{'mass_dim':      3.3, 
    112       'surface_dim':   1.0, 
    113       'cluster_rg':   90.0, 
     111    [{'fractal_dim_mass':      3.3, 
     112      'fractal_dim_surf':   1.0, 
     113      'rg_cluster':   90.0, 
    114114      'primary_rg': 4000.0, 
    115115     }, 0.001, 0.18562699016], 
    116116 
    117     [{'mass_dim':      1.3, 
    118       'surface_dim':   1.0, 
    119       'cluster_rg':   90.0, 
     117    [{'fractal_dim_mass':      1.3, 
     118      'fractal_dim_surf':   1.0, 
     119      'rg_cluster':   90.0, 
    120120      'primary_rg': 2000.0, 
    121121      'background':    0.8, 
    122122     }, 0.001, 1.16539753641], 
    123123 
    124     [{'mass_dim':      2.3, 
    125       'surface_dim':   1.0, 
    126       'cluster_rg':   90.0, 
     124    [{'fractal_dim_mass':      2.3, 
     125      'fractal_dim_surf':   1.0, 
     126      'rg_cluster':   90.0, 
    127127      'primary_rg': 1000.0, 
    128128      'scale':        10.0, 
  • sasmodels/models/mono_gauss_coil.py

    r40a87fa ra807206  
    7171parameters = [ 
    7272    ["i_zero", "1/cm", 70.0, [0.0, inf], "", "Intensity at q=0"], 
    73     ["radius_gyration", "Ang", 75.0, [0.0, inf], "", "Radius of gyration"], 
     73    ["rg", "Ang", 75.0, [0.0, inf], "", "Radius of gyration"], 
    7474    ] 
    7575# pylint: enable=bad-whitespace, line-too-long 
    7676 
    7777# NB: Scale and Background are implicit parameters on every model 
    78 def Iq(q, i_zero, radius_gyration): 
     78def Iq(q, i_zero, rg): 
    7979    # pylint: disable = missing-docstring 
    80     z = (q * radius_gyration)**2 
     80    z = (q * rg)**2 
    8181 
    8282    with errstate(invalid='ignore'): 
     
    8686Iq.vectorized = True # Iq accepts an array of q values 
    8787 
    88 demo = dict(scale=1.0, i_zero=70.0, radius_gyration=75.0, background=0.0) 
     88demo = dict(scale=1.0, i_zero=70.0, rg=75.0, background=0.0) 
    8989 
    9090# these unit test values taken from SasView 3.1.2 
    9191tests = [ 
    92     [{'scale': 1.0, 'i_zero': 70.0, 'radius_gyration': 75.0, 'background': 0.0}, 
     92    [{'scale': 1.0, 'i_zero': 70.0, 'rg': 75.0, 'background': 0.0}, 
    9393     [0.0106939, 0.469418], [57.1241, 0.112859]], 
    9494    ] 
  • sasmodels/models/parallelepiped.c

    rdeb7ee0 ra807206  
    1 double form_volume(double a_side, double b_side, double c_side); 
    2 double Iq(double q, double sld, double solvent_sld, double a_side, double b_side, double c_side); 
     1double form_volume(double length_a, double length_b, double length_c); 
     2double Iq(double q, double sld, double solvent_sld, double length_a, double length_b, double length_c); 
    33double Iqxy(double qx, double qy, double sld, double solvent_sld, 
    4     double a_side, double b_side, double c_side, double theta, double phi, double psi); 
     4    double length_a, double length_b, double length_c, double theta, double phi, double psi); 
    55 
    66// From Igor library 
     
    3232 
    3333 
    34 double form_volume(double a_side, double b_side, double c_side) 
     34double form_volume(double length_a, double length_b, double length_c) 
    3535{ 
    36     return a_side * b_side * c_side; 
     36    return length_a * length_b * length_c; 
    3737} 
    3838 
     
    4141    double sld, 
    4242    double solvent_sld, 
    43     double a_side, 
    44     double b_side, 
    45     double c_side) 
     43    double length_a, 
     44    double length_b, 
     45    double length_c) 
    4646{ 
    4747    double tmp1, tmp2; 
    4848     
    49     double mu = q * b_side; 
     49    double mu = q * length_b; 
    5050     
    5151    // Scale sides by B 
    52     double a_scaled = a_side / b_side; 
    53     double c_scaled = c_side / b_side; 
     52    double a_scaled = length_a / length_b; 
     53    double c_scaled = length_c / length_b; 
    5454         
    5555    //Order of integration 
     
    102102    }    
    103103    
    104     const double vd = (sld-solvent_sld) * form_volume(a_side, b_side, c_side); 
     104    const double vd = (sld-solvent_sld) * form_volume(length_a, length_b, length_c); 
    105105     
    106106    // convert from [1e-12 A-1] to [cm-1] and 0.5 factor for outer integral 
     
    113113    double sld, 
    114114    double solvent_sld, 
    115     double a_side, 
    116     double b_side, 
    117     double c_side, 
     115    double length_a, 
     116    double length_b, 
     117    double length_c, 
    118118    double theta, 
    119119    double phi, 
     
    161161     
    162162    // Call the IGOR library function to get the kernel 
    163     double form = _pkernel( q*a_side, q*b_side, q*c_side, cos_val_a, cos_val_b, cos_val_c); 
     163    double form = _pkernel( q*length_a, q*length_b, q*length_c, cos_val_a, cos_val_b, cos_val_c); 
    164164   
    165165    // Multiply by contrast^2 
    166     const double vd = (sld - solvent_sld) * form_volume(a_side, b_side, c_side); 
     166    const double vd = (sld - solvent_sld) * form_volume(length_a, length_b, length_c); 
    167167    return 1.0e-4 * vd * vd * form; 
    168168} 
  • sasmodels/models/parallelepiped.py

    r9a4811a ra807206  
    190190              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", 
    191191               "Solvent scattering length density"], 
    192               ["a_side", "Ang", 35, [0, inf], "volume", 
     192              ["length_a", "Ang", 35, [0, inf], "volume", 
    193193               "Shorter side of the parallelepiped"], 
    194               ["b_side", "Ang", 75, [0, inf], "volume", 
     194              ["length_b", "Ang", 75, [0, inf], "volume", 
    195195               "Second side of the parallelepiped"], 
    196               ["c_side", "Ang", 400, [0, inf], "volume", 
     196              ["length_c", "Ang", 400, [0, inf], "volume", 
    197197               "Larger side of the parallelepiped"], 
    198198              ["theta", "degrees", 60, [-inf, inf], "orientation", 
     
    206206source = ["lib/gauss76.c", "parallelepiped.c"] 
    207207 
    208 def ER(a_side, b_side, c_side): 
     208def ER(length_a, length_b, length_c): 
    209209    """ 
    210210        Return effective radius (ER) for P(q)*S(q) 
     
    212212 
    213213    # surface average radius (rough approximation) 
    214     surf_rad = sqrt(a_side * b_side / pi) 
    215  
    216     ddd = 0.75 * surf_rad * (2 * surf_rad * c_side + (c_side + surf_rad) * (c_side + pi * surf_rad)) 
     214    surf_rad = sqrt(length_a * length_b / pi) 
     215 
     216    ddd = 0.75 * surf_rad * (2 * surf_rad * length_c + (length_c + surf_rad) * (length_c + pi * surf_rad)) 
    217217    return 0.5 * (ddd) ** (1. / 3.) 
    218218 
     
    222222demo = dict(scale=1, background=0, 
    223223            sld=6.3e-6, sld_solvent=1.0e-6, 
    224             a_side=35, b_side=75, c_side=400, 
     224            length_a=35, length_b=75, length_c=400, 
    225225            theta=45, phi=30, psi=15, 
    226             a_side_pd=0.1, a_side_pd_n=10, 
    227             b_side_pd=0.1, b_side_pd_n=1, 
    228             c_side_pd=0.1, c_side_pd_n=1, 
     226            length_a_pd=0.1, length_a_pd_n=10, 
     227            length_b_pd=0.1, length_b_pd_n=1, 
     228            length_c_pd=0.1, length_c_pd_n=1, 
    229229            theta_pd=10, theta_pd_n=1, 
    230230            phi_pd=10, phi_pd_n=1, 
  • sasmodels/models/pearl_necklace.c

    r2f5c6d4 ra807206  
    1 double _pearl_necklace_kernel(double q, double radius, double edge_separation, 
     1double _pearl_necklace_kernel(double q, double radius, double edge_sep, 
    22        double thick_string, double num_pearls, double sld_pearl, 
    33        double sld_string, double sld_solv); 
    4 double form_volume(double radius, double edge_separation, 
    5         double string_thickness, double number_of_pearls); 
     4double form_volume(double radius, double edge_sep, 
     5        double thick_string, double num_pearls); 
    66 
    7 double Iq(double q, double radius, double edge_separation, 
    8         double string_thickness, double number_of_pearls, double sld,  
     7double Iq(double q, double radius, double edge_sep, 
     8        double thick_string, double num_pearls, double sld,  
    99        double string_sld, double solvent_sld); 
    1010 
    11 #define INVALID(v) (v.string_thickness >= v.radius || v.number_of_pearls <= 0) 
     11#define INVALID(v) (v.thick_string >= v.radius || v.num_pearls <= 0) 
    1212 
    1313// From Igor library 
    14 double _pearl_necklace_kernel(double q, double radius, double edge_separation, double thick_string, 
     14double _pearl_necklace_kernel(double q, double radius, double edge_sep, double thick_string, 
    1515        double num_pearls, double sld_pearl, double sld_string, double sld_solv) 
    1616{ 
     
    2727         
    2828        // center to center distance between the neighboring pearls 
    29         double A_s = edge_separation + 2.0 * radius; 
     29        double A_s = edge_sep + 2.0 * radius; 
    3030         
    3131        // Repeated Calculations 
     
    3333        double oneminussinc = 1 - sincasq; 
    3434        double q_r = q * radius; 
    35         double q_edge = q * edge_separation; 
     35        double q_edge = q * edge_sep; 
    3636         
    3737        // each volume 
    38         double string_vol = edge_separation * pi * thick_string * thick_string / 4.0; 
     38        double string_vol = edge_sep * pi * thick_string * thick_string / 4.0; 
    3939        double pearl_vol = 4.0 / 3.0 * pi * radius * radius * radius; 
    4040 
     
    105105} 
    106106 
    107 double form_volume(double radius, double edge_separation, 
    108         double string_thickness, double number_of_pearls) 
     107double form_volume(double radius, double edge_sep, 
     108        double thick_string, double num_pearls) 
    109109{ 
    110110        double total_vol; 
    111111 
    112112        double pi = 4.0*atan(1.0); 
    113         double number_of_strings = number_of_pearls - 1.0; 
     113        double number_of_strings = num_pearls - 1.0; 
    114114         
    115         double string_vol = edge_separation * pi * string_thickness * string_thickness / 4.0; 
     115        double string_vol = edge_sep * pi * thick_string * thick_string / 4.0; 
    116116        double pearl_vol = 4.0 / 3.0 * pi * radius * radius * radius; 
    117117 
    118118        total_vol = number_of_strings * string_vol; 
    119         total_vol += number_of_pearls * pearl_vol; 
     119        total_vol += num_pearls * pearl_vol; 
    120120 
    121121        return(total_vol); 
    122122} 
    123123 
    124 double Iq(double q, double radius, double edge_separation, 
    125         double string_thickness, double number_of_pearls, double sld,  
     124double Iq(double q, double radius, double edge_sep, 
     125        double thick_string, double num_pearls, double sld,  
    126126        double string_sld, double solvent_sld) 
    127127{ 
    128128        double value, tot_vol; 
    129129         
    130         value = _pearl_necklace_kernel(q, radius, edge_separation, string_thickness, 
    131                 number_of_pearls, sld, string_sld, solvent_sld); 
    132         tot_vol = form_volume(radius, edge_separation, string_thickness, number_of_pearls); 
     130        value = _pearl_necklace_kernel(q, radius, edge_sep, thick_string, 
     131                num_pearls, sld, string_sld, solvent_sld); 
     132        tot_vol = form_volume(radius, edge_sep, thick_string, num_pearls); 
    133133 
    134134        return value*tot_vol; 
  • sasmodels/models/pearl_necklace.py

    r42356c8 ra807206  
    4646pearl_necklace model are the following 
    4747 
    48 NB: *number_of_pearls* must be an integer. 
     48NB: *num_pearls* must be an integer. 
    4949 
    5050References 
     
    6868sld_string: the SLD of the strings 
    6969sld_solvent: the SLD of the solvent 
    70 number_of_pearls: number of the pearls 
     70num_pearls: number of the pearls 
    7171radius: the radius of a pearl 
    72 edge_separation: the length of string segment; surface to surface 
    73 string_thickness: thickness (ie, diameter) of the string 
     72edge_sep: the length of string segment; surface to surface 
     73thick_string: thickness (ie, diameter) of the string 
    7474""" 
    7575category = "shape:cylinder" 
     
    7878parameters = [["radius", "Ang", 80.0, [0, inf], "volume", 
    7979               "Mean radius of the chained spheres"], 
    80               ["edge_separation", "Ang", 350.0, [0, inf], "volume", 
     80              ["edge_sep", "Ang", 350.0, [0, inf], "volume", 
    8181               "Mean separation of chained particles"], 
    82               ["string_thickness", "Ang", 2.5, [0, inf], "volume", 
     82              ["thick_string", "Ang", 2.5, [0, inf], "volume", 
    8383               "Thickness of the chain linkage"], 
    84               ["number_of_pearls", "none", 3, [0, inf], "volume", 
     84              ["num_pearls", "none", 3, [0, inf], "volume", 
    8585               "Number of pearls in the necklace (must be integer)"], 
    8686              ["sld", "1e-6/Ang^2", 1.0, [-inf, inf], "sld", 
     
    9595single = False  # use double precision unless told otherwise 
    9696 
    97 def volume(radius, edge_separation, string_thickness, number_of_pearls): 
     97def volume(radius, edge_sep, thick_string, num_pearls): 
    9898    """ 
    9999    Calculates the total particle volume of the necklace. 
    100100    Redundant with form_volume. 
    101101    """ 
    102     number_of_strings = number_of_pearls - 1.0 
    103     string_vol = edge_separation * pi * pow((string_thickness / 2.0), 2.0) 
     102    number_of_strings = num_pearls - 1.0 
     103    string_vol = edge_sep * pi * pow((thick_string / 2.0), 2.0) 
    104104    pearl_vol = 4.0 /3.0 * pi * pow(radius, 3.0) 
    105105    total_vol = number_of_strings * string_vol 
    106     total_vol += number_of_pearls * pearl_vol 
     106    total_vol += num_pearls * pearl_vol 
    107107    return total_vol 
    108108 
    109 def ER(radius, edge_separation, string_thickness, number_of_pearls): 
     109def ER(radius, edge_sep, thick_string, num_pearls): 
    110110    """ 
    111111    Calculation for effective radius. 
    112112    """ 
    113     tot_vol = volume(radius, edge_separation, string_thickness, number_of_pearls) 
     113    tot_vol = volume(radius, edge_sep, thick_string, num_pearls) 
    114114    rad_out = pow((3.0*tot_vol/4.0/pi), 0.33333) 
    115115    return rad_out 
    116116 
    117117# parameters for demo 
    118 demo = dict(scale=1, background=0, radius=80.0, edge_separation=350.0, 
    119             number_of_pearls=3, sld=1, sld_solvent=6.3, sld_string=1, 
    120             string_thickness=2.5, 
     118demo = dict(scale=1, background=0, radius=80.0, edge_sep=350.0, 
     119            num_pearls=3, sld=1, sld_solvent=6.3, sld_string=1, 
     120            thick_string=2.5, 
    121121            radius_pd=.2, radius_pd_n=5, 
    122             edge_separation_pd=25.0, edge_separation_pd_n=5, 
    123             number_of_pearls_pd=0, number_of_pearls_pd_n=0, 
    124             string_thickness_pd=0.2, string_thickness_pd_n=5, 
     122            edge_sep_pd=25.0, edge_sep_pd_n=5, 
     123            num_pearls_pd=0, num_pearls_pd_n=0, 
     124            thick_string_pd=0.2, thick_string_pd_n=5, 
    125125           ) 
    126126 
  • sasmodels/models/poly_gauss_coil.py

    r40a87fa ra807206  
    7474parameters = [ 
    7575    ["i_zero",          "1/cm", 70.0, [0.0, inf], "", "Intensity at q=0"], 
    76     ["radius_gyration",  "Ang", 75.0, [0.0, inf], "", "Radius of gyration"], 
     76    ["rg",  "Ang", 75.0, [0.0, inf], "", "Radius of gyration"], 
    7777    ["polydispersity",  "None",  2.0, [1.0, inf], "", "Polymer Mw/Mn"], 
    7878    ] 
     
    8080 
    8181# NB: Scale and Background are implicit parameters on every model 
    82 def Iq(q, i_zero, radius_gyration, polydispersity): 
     82def Iq(q, i_zero, rg, polydispersity): 
    8383    # pylint: disable = missing-docstring 
    8484    u = polydispersity - 1.0 
    85     z = (q*radius_gyration)**2 / (1.0 + 2.0*u) 
     85    z = (q*rg)**2 / (1.0 + 2.0*u) 
    8686    # need to trap the case of the polydispersity being 1 (ie, monodisperse!) 
    8787    if polydispersity == 1.0: 
     
    9797demo = dict(scale=1.0, 
    9898            i_zero=70.0, 
    99             radius_gyration=75.0, 
     99            rg=75.0, 
    100100            polydispersity=2.0, 
    101101            background=0.0) 
     
    103103# these unit test values taken from SasView 3.1.2 
    104104tests = [ 
    105     [{'scale': 1.0, 'i_zero': 70.0, 'radius_gyration': 75.0, 
     105    [{'scale': 1.0, 'i_zero': 70.0, 'rg': 75.0, 
    106106      'polydispersity': 2.0, 'background': 0.0}, 
    107107     [0.0106939, 0.469418], [57.6405, 0.169016]], 
  • sasmodels/models/polymer_micelle.c

    r0bef47b ra807206  
    77        double corona_sld, 
    88        double radius_core, 
    9         double radius_gyr, 
     9        double rg, 
    1010        double d_penetration, 
    1111        double n_aggreg); 
     
    1919        double corona_sld, 
    2020        double radius_core, 
    21         double radius_gyr, 
     21        double rg, 
    2222        double d_penetration, 
    2323        double n_aggreg) 
     
    3535 
    3636    // Self-correlation term of the chains 
    37     const double qrg2 = q*radius_gyr*q*radius_gyr; 
     37    const double qrg2 = q*rg*q*rg; 
    3838    const double debye_chain = (qrg2 == 0.0) ? 1.0 : 2.0*(expm1(-qrg2)+qrg2)/(qrg2*qrg2); 
    3939    const double term2 = n_aggreg * beta_corona * beta_corona * debye_chain; 
     
    4141    // Interference cross-term between core and chains 
    4242    const double chain_ampl = (qrg2 == 0.0) ? 1.0 : -expm1(-qrg2)/qrg2; 
    43     const double bes_corona = sinc(q*(radius_core + d_penetration * radius_gyr)); 
     43    const double bes_corona = sinc(q*(radius_core + d_penetration * rg)); 
    4444    const double term3 = 2 * n_aggreg * n_aggreg * beta_core * beta_corona * 
    4545                 bes_core * chain_ampl * bes_corona; 
     
    7070        double corona_sld, 
    7171        double radius_core, 
    72         double radius_gyr, 
     72        double rg, 
    7373        double d_penetration, 
    7474        double n_aggreg) 
     
    8282            corona_sld, 
    8383            radius_core, 
    84             radius_gyr, 
     84            rg, 
    8585            d_penetration, 
    8686            n_aggreg); 
  • sasmodels/models/polymer_micelle.py

    r0bef47b ra807206  
    4545    ["sld_core",      "1e-6/Ang^2", 0.34, [0.0, inf], "sld", "Core scattering length density"], 
    4646    ["sld_corona",    "1e-6/Ang^2", 0.8,  [0.0, inf], "sld", "Corona scattering length density"], 
    47     ["radius_core",   "Ang",       45.0,  [0.0, inf], "", "Radius of core ( must be >> radius_gyr )"], 
    48     ["radius_gyr",    "Ang",       20.0,  [0.0, inf], "", "Radius of gyration of chains in corona"], 
     47    ["radius_core",   "Ang",       45.0,  [0.0, inf], "", "Radius of core ( must be >> rg )"], 
     48    ["rg",    "Ang",       20.0,  [0.0, inf], "", "Radius of gyration of chains in corona"], 
    4949    ["d_penetration", "",           1.0,  [-inf, inf], "", "Factor to mimic non-penetration of Gaussian chains"], 
    5050    ["n_aggreg",      "",           6.0,  [-inf, inf], "", "Aggregation number of the micelle"], 
     
    6464            sld_corona=0.8, 
    6565            radius_core=45.0, 
    66             radius_gyr=20.0, 
     66            rg=20.0, 
    6767            d_penetration=1.0, 
    6868            n_aggreg=6.0) 
  • sasmodels/models/rectangular_prism.c

    rdeb7ee0 ra807206  
    1 double form_volume(double a_side, double b2a_ratio, double c2a_ratio); 
    2 double Iq(double q, double sld, double solvent_sld, double a_side,  
     1double form_volume(double length_a, double b2a_ratio, double c2a_ratio); 
     2double Iq(double q, double sld, double solvent_sld, double length_a,  
    33          double b2a_ratio, double c2a_ratio); 
    44double Iqxy(double qx, double qy, double sld, double solvent_sld,  
    5             double a_side, double b2a_ratio, double c2a_ratio); 
     5            double length_a, double b2a_ratio, double c2a_ratio); 
    66 
    7 double form_volume(double a_side, double b2a_ratio, double c2a_ratio) 
     7double form_volume(double length_a, double b2a_ratio, double c2a_ratio) 
    88{ 
    9     return a_side * (a_side*b2a_ratio) * (a_side*c2a_ratio); 
     9    return length_a * (length_a*b2a_ratio) * (length_a*c2a_ratio); 
    1010} 
    1111 
     
    1313    double sld, 
    1414    double solvent_sld, 
    15     double a_side, 
     15    double length_a, 
    1616    double b2a_ratio, 
    1717    double c2a_ratio) 
     
    1919    double termA, termB, termC; 
    2020     
    21     double b_side = a_side * b2a_ratio; 
    22     double c_side = a_side * c2a_ratio; 
    23     double volume = a_side * b_side * c_side; 
    24     double a_half = 0.5 * a_side; 
     21    double b_side = length_a * b2a_ratio; 
     22    double c_side = length_a * c2a_ratio; 
     23    double volume = length_a * b_side * c_side; 
     24    double a_half = 0.5 * length_a; 
    2525    double b_half = 0.5 * b_side; 
    2626    double c_half = 0.5 * c_side; 
     
    9292    double sld, 
    9393    double solvent_sld, 
    94     double a_side, 
     94    double length_a, 
    9595    double b2a_ratio, 
    9696    double c2a_ratio) 
    9797{ 
    9898    double q = sqrt(qx*qx + qy*qy); 
    99     double intensity = Iq(q, sld, solvent_sld, a_side, b2a_ratio, c2a_ratio);  
     99    double intensity = Iq(q, sld, solvent_sld, length_a, b2a_ratio, c2a_ratio);  
    100100    return intensity;     
    101101} 
  • sasmodels/models/rectangular_prism.py

    r42356c8 ra807206  
    9999              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", 
    100100               "Solvent scattering length density"], 
    101               ["a_side", "Ang", 35, [0, inf], "volume", 
     101              ["length_a", "Ang", 35, [0, inf], "volume", 
    102102               "Shorter side of the parallelepiped"], 
    103103              ["b2a_ratio", "Ang", 1, [0, inf], "volume", 
     
    109109source = ["lib/gauss76.c", "rectangular_prism.c"] 
    110110 
    111 def ER(a_side, b2a_ratio, c2a_ratio): 
     111def ER(length_a, b2a_ratio, c2a_ratio): 
    112112    """ 
    113113        Return equivalent radius (ER) 
    114114    """ 
    115     b_side = a_side * b2a_ratio 
    116     c_side = a_side * c2a_ratio 
     115    b_side = length_a * b2a_ratio 
     116    c_side = length_a * c2a_ratio 
    117117 
    118118    # surface average radius (rough approximation) 
    119     surf_rad = sqrt(a_side * b_side / pi) 
     119    surf_rad = sqrt(length_a * b_side / pi) 
    120120 
    121121    ddd = 0.75 * surf_rad * (2 * surf_rad * c_side + (c_side + surf_rad) * (c_side + pi * surf_rad)) 
     
    126126demo = dict(scale=1, background=0, 
    127127            sld=6.3e-6, sld_solvent=1.0e-6, 
    128             a_side=35, b2a_ratio=1, c2a_ratio=1, 
    129             a_side_pd=0.1, a_side_pd_n=10, 
     128            length_a=35, b2a_ratio=1, c2a_ratio=1, 
     129            length_a_pd=0.1, length_a_pd_n=10, 
    130130            b2a_ratio_pd=0.1, b2a_ratio_pd_n=1, 
    131131            c2a_ratio_pd=0.1, c2a_ratio_pd_n=1) 
  • sasmodels/models/stacked_disks.c

    r2c74c11 ra807206  
    1 double form_volume(double core_thick, 
    2                    double layer_thick, 
     1double form_volume(double thick_core, 
     2                   double thick_layer, 
    33                   double radius, 
    44                   double n_stacking); 
    55 
    66double Iq(double q, 
    7           double core_thick, 
    8           double layer_thick, 
     7          double thick_core, 
     8          double thick_layer, 
    99          double radius, 
    1010          double n_stacking, 
    11           double sigma_d, 
     11          double sigma_dnn, 
    1212          double core_sld, 
    1313          double layer_sld, 
     
    2121               double solvent_sld, 
    2222               double halfheight, 
    23                double layer_thick, 
     23               double thick_layer, 
    2424               double zi, 
    25                double sigma_d, 
     25               double sigma_dnn, 
    2626               double d, 
    2727               double n_stacking) 
     
    3838 
    3939        const double sinarg1 = qq*halfheight*cos(zi); 
    40         const double sinarg2 = qq*(halfheight+layer_thick)*cos(zi); 
     40        const double sinarg2 = qq*(halfheight+thick_layer)*cos(zi); 
    4141 
    4242        const double be1 = sas_J1c(besarg1); 
     
    4848        const double dr2 = (layer_sld-solvent_sld); 
    4949        const double area = M_PI*radius*radius; 
    50         const double totald=2.0*(layer_thick+halfheight); 
     50        const double totald=2.0*(thick_layer+halfheight); 
    5151 
    5252        const double t1 = area*(2.0*halfheight)*dr1*(si1)*(be1); 
     
    5959        double sqq=0.0; 
    6060        for(int kk=1;kk<n_stacking;kk+=1) { 
    61                 double dexpt=qq*cos(zi)*qq*cos(zi)*d*d*sigma_d*sigma_d*kk/2.0; 
     61                double dexpt=qq*cos(zi)*qq*cos(zi)*d*d*sigma_dnn*sigma_dnn*kk/2.0; 
    6262                sqq=sqq+(n_stacking-kk)*cos(qq*cos(zi)*d*kk)*exp(-1.*dexpt); 
    6363        } 
     
    7474static 
    7575double stacked_disks_kernel(double q, 
    76                             double core_thick, 
    77                             double layer_thick, 
     76                            double thick_core, 
     77                            double thick_layer, 
    7878                            double radius, 
    7979                            double n_stacking, 
    80                             double sigma_d, 
     80                            double sigma_dnn, 
    8181                            double core_sld, 
    8282                            double layer_sld, 
     
    8888        double summ = 0.0;      //initialize integral 
    8989 
    90         double d=2.0*layer_thick+core_thick; 
    91         double halfheight = core_thick/2.0; 
     90        double d=2.0*thick_layer+thick_core; 
     91        double halfheight = thick_core/2.0; 
    9292 
    9393        for(int i=0;i<N_POINTS_76;i++) { 
     
    100100                                   solvent_sld, 
    101101                                   halfheight, 
    102                                    layer_thick, 
     102                                   thick_layer, 
    103103                                   zi, 
    104                                    sigma_d, 
     104                                   sigma_dnn, 
    105105                                   d, 
    106106                                   n_stacking); 
     
    117117 
    118118static double stacked_disks_kernel_2d(double q, double q_x, double q_y, 
    119                             double core_thick, 
    120                             double layer_thick, 
     119                            double thick_core, 
     120                            double thick_layer, 
    121121                            double radius, 
    122122                            double n_stacking, 
    123                             double sigma_d, 
     123                            double sigma_dnn, 
    124124                            double core_sld, 
    125125                            double layer_sld, 
     
    154154 
    155155    // Call the IGOR library function to get the kernel 
    156     double d = 2 * layer_thick + core_thick; 
    157     double halfheight = core_thick/2.0; 
     156    double d = 2 * thick_layer + thick_core; 
     157    double halfheight = thick_core/2.0; 
    158158    double answer = _kernel(q, 
    159159                     radius, 
     
    162162                     solvent_sld, 
    163163                     halfheight, 
    164                      layer_thick, 
     164                     thick_layer, 
    165165                     alpha, 
    166                      sigma_d, 
     166                     sigma_dnn, 
    167167                     d, 
    168168                     n_stacking); 
     
    175175} 
    176176 
    177 double form_volume(double core_thick, 
    178                    double layer_thick, 
     177double form_volume(double thick_core, 
     178                   double thick_layer, 
    179179                   double radius, 
    180180                   double n_stacking){ 
    181     double d = 2 * layer_thick + core_thick; 
     181    double d = 2 * thick_layer + thick_core; 
    182182    return acos(-1.0) * radius * radius * d * n_stacking; 
    183183} 
    184184 
    185185double Iq(double q, 
    186           double core_thick, 
    187           double layer_thick, 
     186          double thick_core, 
     187          double thick_layer, 
    188188          double radius, 
    189189          double n_stacking, 
    190           double sigma_d, 
     190          double sigma_dnn, 
    191191          double core_sld, 
    192192          double layer_sld, 
     
    194194{ 
    195195    return stacked_disks_kernel(q, 
    196                     core_thick, 
    197                     layer_thick, 
     196                    thick_core, 
     197                    thick_layer, 
    198198                    radius, 
    199199                    n_stacking, 
    200                     sigma_d, 
     200                    sigma_dnn, 
    201201                    core_sld, 
    202202                    layer_sld, 
  • sasmodels/models/stacked_disks.py

    r40a87fa ra807206  
    5454    \right]^2 \sin{\alpha}\ d\alpha 
    5555 
    56 where $d$ = thickness of the layer (*layer_thick*), 
    57 $2h$ = core thickness (*core_thick*), and $R$ = radius of the disc (*radius*). 
     56where $d$ = thickness of the layer (*thick_layer*), 
     57$2h$ = core thickness (*thick_core*), and $R$ = radius of the disc (*radius*). 
    5858 
    5959.. math:: 
    6060 
    6161    S(q) = 1 + \frac{1}{2}\sum_{k=1}^n(n-k)\cos{(kDq\cos{\alpha})} 
    62     \exp\left[ -k(q\cos{\alpha})^2\sigma_D/2\right] 
     62    \exp\left[ -k(q\cos{\alpha})^2\sigma_Dnn/2\right] 
    6363 
    6464where $n$ is the total number of the disc stacked (*n_stacking*), 
    6565$D = 2(d+h)$ is the next neighbor center-to-center distance (d-spacing), 
    66 and $\sigma_D$ = the Gaussian standard deviation of the d-spacing (*sigma_d*). 
     66and $\sigma_Dnn$ = the Gaussian standard deviation of the d-spacing (*sigma_dnn*). 
    6767 
    6868.. note:: 
    69     Each assmebly in the stack is layer/core/layer, so the spacing of the 
     69    Each assembly in the stack is layer/core/layer, so the spacing of the 
    7070    cores is core plus two layers. The 2nd virial coefficient of the cylinder 
    7171    is calculated based on the *radius* and *length* 
    72     = *n_stacking* * (*core_thick* + 2 * *layer_thick*) 
     72    = *n_stacking* * (*thick_core* + 2 * *thick_layer*) 
    7373    values, and used as the effective radius for $S(Q)$ when $P(Q) * S(Q)$ 
    7474    is applied. 
     
    114114    One layer of disk consists of a core, a top layer, and a bottom layer. 
    115115    radius =  the radius of the disk 
    116     core_thick = thickness of the core 
    117     layer_thick = thickness of a layer 
     116    thick_core = thickness of the core 
     117    thick_layer = thickness of a layer 
    118118    sld_core = the SLD of the core 
    119119    sld_layer = the SLD of the layers 
    120120    n_stacking = the number of the disks 
    121     sigma_d =  Gaussian STD of d-spacing 
     121    sigma_dnn =  Gaussian STD of d-spacing 
    122122    sld_solvent = the SLD of the solvent 
    123123    """ 
     
    127127#   ["name", "units", default, [lower, upper], "type","description"], 
    128128parameters = [ 
    129     ["core_thick",  "Ang",        10.0, [0, inf],    "volume",      "Thickness of the core disk"], 
    130     ["layer_thick", "Ang",        10.0, [0, inf],    "volume",      "Thickness of layer each side of core"], 
     129    ["thick_core",  "Ang",        10.0, [0, inf],    "volume",      "Thickness of the core disk"], 
     130    ["thick_layer", "Ang",        10.0, [0, inf],    "volume",      "Thickness of layer each side of core"], 
    131131    ["radius",      "Ang",        15.0, [0, inf],    "volume",      "Radius of the stacked disk"], 
    132132    ["n_stacking",  "",            1.0, [0, inf],    "volume",      "Number of stacked layer/core/layer disks"], 
    133     ["sigma_d",     "Ang",         0,   [0, inf],    "",            "GSD of disks sigma_d"], 
     133    ["sigma_dnn",   "Ang",         0,   [0, inf],    "",            "Sigma of nearest neighbor spacing"], 
    134134    ["sld_core",    "1e-6/Ang^2",  4,   [-inf, inf], "sld",         "Core scattering length density"], 
    135135    ["sld_layer",   "1e-6/Ang^2",  0.0, [-inf, inf], "sld",         "Layer scattering length density"], 
     
    144144demo = dict(background=0.001, 
    145145            scale=0.01, 
    146             core_thick=10.0, 
    147             layer_thick=10.0, 
     146            thick_core=10.0, 
     147            thick_layer=10.0, 
    148148            radius=15.0, 
    149149            n_stacking=1, 
    150             sigma_d=0, 
     150            sigma_dnn=0, 
    151151            sld_core=4, 
    152152            sld_layer=0.0, 
     
    158158    # Accuracy tests based on content in test/utest_extra_models.py. 
    159159    # Added 2 tests with n_stacked = 5 using SasView 3.1.2 - PDB 
    160     [{'core_thick': 10.0, 
    161       'layer_thick': 15.0, 
    162       'radius': 3000.0, 
    163       'n_stacking': 1.0, 
    164       'sigma_d': 0.0, 
     160    [{'thick_core': 10.0, 
     161      'thick_layer': 15.0, 
     162      'radius': 3000.0, 
     163      'n_stacking': 1.0, 
     164      'sigma_dnn': 0.0, 
    165165      'sld_core': 4.0, 
    166166      'sld_layer': -0.4, 
     
    172172     }, 0.001, 5075.12], 
    173173 
    174     [{'core_thick': 10.0, 
    175       'layer_thick': 15.0, 
     174    [{'thick_core': 10.0, 
     175      'thick_layer': 15.0, 
    176176      'radius': 3000.0, 
    177177      'n_stacking': 5.0, 
    178       'sigma_d': 0.0, 
     178      'sigma_dnn': 0.0, 
    179179      'sld_core': 4.0, 
    180180      'sld_layer': -0.4, 
     
    186186     }, 0.001, 5065.12793824], 
    187187 
    188     [{'core_thick': 10.0, 
    189       'layer_thick': 15.0, 
     188    [{'thick_core': 10.0, 
     189      'thick_layer': 15.0, 
    190190      'radius': 3000.0, 
    191191      'n_stacking': 5.0, 
    192       'sigma_d': 0.0, 
     192      'sigma_dnn': 0.0, 
    193193      'sld_core': 4.0, 
    194194      'sld_layer': -0.4, 
     
    200200     }, 0.164, 0.0127673597265], 
    201201 
    202     [{'core_thick': 10.0, 
    203       'layer_thick': 15.0, 
    204       'radius': 3000.0, 
    205       'n_stacking': 1.0, 
    206       'sigma_d': 0.0, 
     202    [{'thick_core': 10.0, 
     203      'thick_layer': 15.0, 
     204      'radius': 3000.0, 
     205      'n_stacking': 1.0, 
     206      'sigma_dnn': 0.0, 
    207207      'sld_core': 4.0, 
    208208      'sld_layer': -0.4, 
     
    214214     }, [0.001, 90.0], [5075.12, 0.001]], 
    215215 
    216     [{'core_thick': 10.0, 
    217       'layer_thick': 15.0, 
    218       'radius': 3000.0, 
    219       'n_stacking': 1.0, 
    220       'sigma_d': 0.0, 
     216    [{'thick_core': 10.0, 
     217      'thick_layer': 15.0, 
     218      'radius': 3000.0, 
     219      'n_stacking': 1.0, 
     220      'sigma_dnn': 0.0, 
    221221      'sld_core': 4.0, 
    222222      'sld_layer': -0.4, 
     
    228228     }, ([0.4, 0.5]), [0.00105074, 0.00121761]], 
    229229 
    230     [{'core_thick': 10.0, 
    231       'layer_thick': 15.0, 
    232       'radius': 3000.0, 
    233       'n_stacking': 1.0, 
    234       'sigma_d': 0.0, 
     230    [{'thick_core': 10.0, 
     231      'thick_layer': 15.0, 
     232      'radius': 3000.0, 
     233      'n_stacking': 1.0, 
     234      'sigma_dnn': 0.0, 
    235235      'sld_core': 4.0, 
    236236      'sld_layer': -0.4, 
  • sasmodels/models/surface_fractal.c

    r2c74c11 ra807206  
    33double Iq(double q, 
    44          double radius, 
    5           double surface_dim, 
     5          double fractal_dim_surf, 
    66          double cutoff_length); 
    77 
    88static double _surface_fractal_kernel(double q, 
    99    double radius, 
    10     double surface_dim, 
     10    double fractal_dim_surf, 
    1111    double cutoff_length) 
    1212{ 
     
    2020 
    2121    //calculate S(q) 
    22     mmo = 5.0 - surface_dim; 
     22    mmo = 5.0 - fractal_dim_surf; 
    2323    sq  = sas_gamma(mmo)*sin(-(mmo)*atan(q*cutoff_length)); 
    2424    sq *= pow(cutoff_length, mmo); 
     
    3838double Iq(double q, 
    3939    double radius, 
    40     double surface_dim, 
     40    double fractal_dim_surf, 
    4141    double cutoff_length 
    4242    ) 
    4343{ 
    44     return _surface_fractal_kernel(q, radius, surface_dim, cutoff_length); 
     44    return _surface_fractal_kernel(q, radius, fractal_dim_surf, cutoff_length); 
    4545} 
  • sasmodels/models/surface_fractal.py

    r33875e3 ra807206  
    6666        delta        =  sldParticle -sldSolv. 
    6767        radius       =  Particle radius 
    68         surface_dim  =  Surface fractal dimension (Ds) 
     68        fractal_dim_surf  =  Surface fractal dimension (Ds) 
    6969        co_length    =  Cut-off length 
    7070        background   =  background 
    7171 
    7272        Ref.   :Mildner, Hall,J Phys D Appl Phys(1986), 19, 1535-1545 
    73         Note I : This model is valid for 1<surface_dim<3 with limited q range. 
     73        Note I : This model is valid for 1<fractal_dim_surf<3 with limited q range. 
    7474        Note II: This model is not in absolute scale. 
    7575""" 
     
    8080parameters = [["radius",        "Ang", 10.0, [0, inf],   "", 
    8181               "Particle radius"], 
    82               ["surface_dim",   "",    2.0,  [1, 3],   "", 
     82              ["fractal_dim_surf",   "",    2.0,  [1, 3],   "", 
    8383               "Surface fractal dimension"], 
    8484              ["cutoff_length", "Ang", 500., [0.0, inf], "", 
     
    9090 
    9191demo = dict(scale=1, background=0, 
    92             radius=10, surface_dim=2.0, cutoff_length=500) 
     92            radius=10, fractal_dim_surf=2.0, cutoff_length=500) 
    9393 
    9494tests = [ 
    9595    # Accuracy tests based on content in test/utest_other_models.py 
    9696    [{'radius': 10.0, 
    97       'surface_dim': 2.0, 
     97      'fractal_dim_surf': 2.0, 
    9898      'cutoff_length': 500.0, 
    9999     }, 0.05, 301428.66016], 
     
    101101    # Additional tests with larger range of parameters 
    102102    [{'radius': 1.0, 
    103       'surface_dim': 1.0, 
     103      'fractal_dim_surf': 1.0, 
    104104      'cutoff_length': 10.0, 
    105105     }, 0.332070182643, 1125.00421004], 
    106106 
    107107    [{'radius': 3.5, 
    108       'surface_dim': 0.1, 
     108      'fractal_dim_surf': 0.1, 
    109109      'cutoff_length': 30.0, 
    110110      'background': 0.01, 
     
    112112 
    113113    [{'radius': 3.0, 
    114       'surface_dim': 1.0, 
     114      'fractal_dim_surf': 1.0, 
    115115      'cutoff_length': 33.0, 
    116116      'scale': 0.1, 
  • sasmodels/models/triaxial_ellipsoid.c

    r2f5c6d4 ra807206  
    1 double form_volume(double req_minor, double req_major, double rpolar); 
    2 double Iq(double q, double sld, double solvent_sld, 
    3     double req_minor, double req_major, double rpolar); 
    4 double Iqxy(double qx, double qy, double sld, double solvent_sld, 
    5     double req_minor, double req_major, double rpolar, double theta, double phi, double psi); 
     1double form_volume(double radius_equat_minor, double radius_equat_major, double radius_polar); 
     2double Iq(double q, double sld, double sld_solvent, 
     3    double radius_equat_minor, double radius_equat_major, double radius_polar); 
     4double Iqxy(double qx, double qy, double sld, double sld_solvent, 
     5    double radius_equat_minor, double radius_equat_major, double radius_polar, double theta, double phi, double psi); 
    66 
    7 //#define INVALID(v) (v.req_minor > v.req_major || v.req_major > v.rpolar) 
     7//#define INVALID(v) (v.radius_equat_minor > v.radius_equat_major || v.radius_equat_major > v.radius_polar) 
    88 
    99 
    10 double form_volume(double req_minor, double req_major, double rpolar) 
     10double form_volume(double radius_equat_minor, double radius_equat_major, double radius_polar) 
    1111{ 
    12     return 1.333333333333333*M_PI*req_minor*req_major*rpolar; 
     12    return 1.333333333333333*M_PI*radius_equat_minor*radius_equat_major*radius_polar; 
    1313} 
    1414 
    1515double Iq(double q, 
    1616    double sld, 
    17     double solvent_sld, 
    18     double req_minor, 
    19     double req_major, 
    20     double rpolar) 
     17    double sld_solvent, 
     18    double radius_equat_minor, 
     19    double radius_equat_major, 
     20    double radius_polar) 
    2121{ 
    2222    double sn, cn; 
     
    2929        const double x = 0.5*(Gauss76Z[i] + 1.0); 
    3030        SINCOS(M_PI_2*x, sn, cn); 
    31         const double acosx2 = req_minor*req_minor*cn*cn; 
    32         const double bsinx2 = req_major*req_major*sn*sn; 
    33         const double c2 = rpolar*rpolar; 
     31        const double acosx2 = radius_equat_minor*radius_equat_minor*cn*cn; 
     32        const double bsinx2 = radius_equat_major*radius_equat_major*sn*sn; 
     33        const double c2 = radius_polar*radius_polar; 
    3434 
    3535        double inner = 0.0; 
     
    4444    // translate dx in [-1,1] to dx in [lower,upper] 
    4545    const double fqsq = outer*zm; 
    46     const double s = (sld - solvent_sld) * form_volume(req_minor, req_major, rpolar); 
     46    const double s = (sld - sld_solvent) * form_volume(radius_equat_minor, radius_equat_major, radius_polar); 
    4747    return 1.0e-4 * s * s * fqsq; 
    4848} 
     
    5050double Iqxy(double qx, double qy, 
    5151    double sld, 
    52     double solvent_sld, 
    53     double req_minor, 
    54     double req_major, 
    55     double rpolar, 
     52    double sld_solvent, 
     53    double radius_equat_minor, 
     54    double radius_equat_major, 
     55    double radius_polar, 
    5656    double theta, 
    5757    double phi, 
     
    7171    const double cnu = (-cphi*spsi*stheta + sphi*cpsi)*qxhat + spsi*ctheta*qyhat; 
    7272    const double cmu = (-stheta*cpsi*cphi - spsi*sphi)*qxhat + ctheta*cpsi*qyhat; 
    73     const double t = q*sqrt(req_minor*req_minor*cnu*cnu 
    74                           + req_major*req_major*cmu*cmu 
    75                           + rpolar*rpolar*calpha*calpha); 
     73    const double t = q*sqrt(radius_equat_minor*radius_equat_minor*cnu*cnu 
     74                          + radius_equat_major*radius_equat_major*cmu*cmu 
     75                          + radius_polar*radius_polar*calpha*calpha); 
    7676    const double fq = sph_j1c(t); 
    77     const double s = (sld - solvent_sld) * form_volume(req_minor, req_major, rpolar); 
     77    const double s = (sld - sld_solvent) * form_volume(radius_equat_minor, radius_equat_major, radius_polar); 
    7878 
    7979    return 1.0e-4 * square(s * fq); 
  • sasmodels/models/triaxial_ellipsoid.py

    r42356c8 ra807206  
    8888parameters = [["sld", "1e-6/Ang^2", 4, [-inf, inf], "sld", 
    8989               "Ellipsoid scattering length density"], 
    90               ["solvent_sld", "1e-6/Ang^2", 1, [-inf, inf], "sld", 
     90              ["sld_solvent", "1e-6/Ang^2", 1, [-inf, inf], "sld", 
    9191               "Solvent scattering length density"], 
    92               ["req_minor", "Ang", 20, [0, inf], "volume", 
     92              ["radius_equat_minor", "Ang", 20, [0, inf], "volume", 
    9393               "Minor equatorial radius"], 
    94               ["req_major", "Ang", 400, [0, inf], "volume", 
     94              ["radius_equat_major", "Ang", 400, [0, inf], "volume", 
    9595               "Major equatorial radius"], 
    96               ["rpolar", "Ang", 10, [0, inf], "volume", 
     96              ["radius_polar", "Ang", 10, [0, inf], "volume", 
    9797               "Polar radius"], 
    9898              ["theta", "degrees", 60, [-inf, inf], "orientation", 
     
    106106source = ["lib/sph_j1c.c", "lib/gauss76.c", "triaxial_ellipsoid.c"] 
    107107 
    108 def ER(req_minor, req_major, rpolar): 
     108def ER(radius_equat_minor, radius_equat_major, radius_polar): 
    109109    """ 
    110110        Returns the effective radius used in the S*P calculation 
     
    112112    import numpy as np 
    113113    from .ellipsoid import ER as ellipsoid_ER 
    114     return ellipsoid_ER(rpolar, np.sqrt(req_minor * req_major)) 
     114    return ellipsoid_ER(radius_polar, np.sqrt(radius_equat_minor * radius_equat_major)) 
    115115 
    116116demo = dict(scale=1, background=0, 
    117             sld=6, solvent_sld=1, 
     117            sld=6, sld_solvent=1, 
    118118            theta=30, phi=15, psi=5, 
    119             req_minor=25, req_major=36, rpolar=50, 
    120             req_minor_pd=0, req_minor_pd_n=1, 
    121             req_major_pd=0, req_major_pd_n=1, 
    122             rpolar_pd=.2, rpolar_pd_n=30, 
     119            radius_equat_minor=25, radius_equat_major=36, radius_polar=50, 
     120            radius_equat_minor_pd=0, radius_equat_minor_pd_n=1, 
     121            radius_equat_major_pd=0, radius_equat_major_pd_n=1, 
     122            radius_polar_pd=.2, radius_polar_pd_n=30, 
    123123            theta_pd=15, theta_pd_n=45, 
    124124            phi_pd=15, phi_pd_n=1, 
Note: See TracChangeset for help on using the changeset viewer.