Changeset 6824af5 in sasmodels


Ignore:
Timestamp:
Mar 17, 2016 10:48:04 AM (8 years ago)
Author:
krzywon
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:
8898d0f, bdb653c
Parents:
84db7a5 (diff), 54954e1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge remote-tracking branch 'origin/master'

Files:
1 added
2 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • example/sesansfit.sh

    • Property mode changed from 100644 to 100755
    r5be92e8 r15bd6e7  
    88set -x 
    99 
    10 python -m bumps.cli $* 
     10pythonw -m bumps.cli $* 
  • sasmodels/models/adsorbed_layer.py

    rcb97bff r54954e1  
    1717     I(q) = \text{scale} \cdot(\rho_\text{poly}-\rho_\text{solvent})^2    \left[\frac{6\pi\phi_\text{core}}{Q^2}\frac{\Gamma^2}{\delta_\text{poly}^2R_\text{core}} \exp(-Q^2\sigma^2)\right] + \text{background} 
    1818 
    19 where *scale* is a scale factor, |rho|\ :sub:`poly` is the sld of the polymer (or surfactant) layer, |rho|\ :sub:`solv` is the sld of the solvent/medium and cores, |phi|\ :sub:`core` is the volume fraction of the core paraticles, |delta|\ :sub:`poly` is the bulk density of the polymer, |biggamma| is the adsorbed amount, and |sigma| is the second moment of the thickness distribution. 
     19where *scale* is a scale factor, |rho|\ :sub:`poly` is the sld of the polymer (or surfactant) layer, |rho|\ :sub:`solv` is the sld of the solvent/medium and cores, |phi|\ :sub:`core` is the volume fraction of the core particles, |delta|\ :sub:`poly` is the bulk density of the polymer, |biggamma| is the adsorbed amount, and |sigma| is the second moment of the thickness distribution. 
    2020 
    2121Note that all parameters except the |sigma| are correlated so fitting more than one of these parameters will generally fail. Also note that unlike other shape models, no volume normalization is applied to this model (the calculation is exact). 
     
    4646              ["density_poly", "g/cm3", 0.7, [0.0, inf], "", "Polymer density"], 
    4747              ["radius", "Ang", 500.0, [0.0, inf], "", "Particle radius"], 
    48               ["vol_frac", "None", 0.14, [0.0, inf], "", "Particle vol fraction"], 
     48              ["volfraction", "None", 0.14, [0.0, inf], "", "Particle vol fraction"], 
    4949              ["polymer_sld", "1/Ang^2", 1.5e-06, [-inf, inf], "", "Polymer SLD"], 
    5050              ["solvent_sld", "1/Ang^2", 6.3e-06, [-inf, inf], "", "Solvent SLD"]] 
     
    5252# NB: Scale and Background are implicit parameters on every model 
    5353def Iq(q, second_moment, adsorbed_amount, density_poly, radius,  
    54         vol_frac, polymer_sld, solvent_sld): 
     54        volfraction, polymer_sld, solvent_sld): 
    5555    # pylint: disable = missing-docstring 
    5656    deltarhosqrd =  (polymer_sld - solvent_sld) * (polymer_sld - solvent_sld) 
    57     numerator =  6.0 * pi * vol_frac * (adsorbed_amount * adsorbed_amount) 
     57    numerator =  6.0 * pi * volfraction * (adsorbed_amount * adsorbed_amount) 
    5858    denominator =  (q * q) * (density_poly * density_poly) * radius 
    5959    eterm =  exp(-1.0 * (q * q) * (second_moment * second_moment)) 
     
    7373            density_poly = 0.7, 
    7474            radius = 500.0, 
    75             vol_frac = 0.14, 
     75            volfraction = 0.14, 
    7676            polymer_sld = 1.5e-06, 
    7777            solvent_sld = 6.3e-06, 
     
    8484               density_poly = 'density_poly', 
    8585               radius = 'radius_core', 
    86                vol_frac = 'volf_cores', 
     86               volfraction = 'volf_cores', 
    8787               polymer_sld = 'sld_poly', 
    8888               solvent_sld = 'sld_solv', 
     
    9191tests =  [ 
    9292    [{'scale': 1.0, 'second_moment': 23.0, 'adsorbed_amount': 1.9,  
    93      'density_poly': 0.7, 'radius': 500.0, 'vol_frac': 0.14,  
     93     'density_poly': 0.7, 'radius': 500.0, 'volfraction': 0.14,  
    9494     'polymer_sld': 1.5e-06, 'solvent_sld': 6.3e-06, 'background': 0.0}, 
    9595     [0.0106939, 0.469418], [73.741, 9.65391e-53]], 
  • sasmodels/models/hayter_msa.py

    rd529d93 r54954e1  
    5151#  dp[2] = volfraction(); 
    5252#  dp[3] = temperature(); 
    53 #  dp[4] = saltconc(); 
     53#  dp[4] = salt_concentration(); 
    5454#  dp[5] = dielectconst(); 
    5555 
     
    7676    ["volfraction",   "None",     0.0192, [0, 0.74],   "", "volume fraction of spheres"], 
    7777    ["temperature",   "K",  318.16,   [0, inf],    "", "temperature, in Kelvin, for Debye length calculation"], 
    78     ["saltconc",      "M",    0.0,    [-inf, inf], "", "conc of salt, moles/litre, 1:1 electolyte, for Debye length"], 
     78    ["salt_concentration",      "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    ] 
     
    9696oldname = 'HayterMSAStructure' 
    9797#oldpars = dict(effect_radius="radius_effective",effect_radius_pd="radius_effective_pd",effect_radius_pd_n="radius_effective_pd_n") 
    98 oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n") 
     98oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n",salt_concentration="saltconc") 
    9999#oldpars = dict( ) 
    100100# default parameter set,  use  compare.sh -midQ -linear 
    101101# note the calculation varies in different limiting cases so a wide range of 
    102102# parameters will be required for a thorough test! 
    103 # odd that the default st has saltconc zero 
     103# odd that the default st has salt_concentration zero 
    104104demo = dict(radius_effective=20.75, 
    105105            charge=19.0, 
    106106            volfraction=0.0192, 
    107107            temperature=318.16, 
    108             saltconc=0.05, 
     108            salt_concentration=0.05, 
    109109            dielectconst=71.08, 
    110110            radius_effective_pd=0.1, 
     
    120120      'volfraction': 0.0192, 
    121121      'temperature': 298.0, 
    122       'saltconc': 0, 
     122      'salt_concentration': 0, 
    123123      'dielectconst': 78.0, 
    124124      'radius_effective_pd': 0}, 
     
    130130      'volfraction': 0.0192, 
    131131      'temperature': 298.0, 
    132       'saltconc': 0.05, 
     132      'salt_concentration': 0.05, 
    133133      'dielectconst': 78.0, 
    134134      'radius_effective_pd': 0.1, 
  • sasmodels/models/mono_gauss_coil.py

    raa2edb2 r15bd6e7  
    1414 
    1515     *I(q)* = *scale* |cdot| *I* \ :sub:`0` |cdot| *P(q)* + *background* 
    16           
     16 
    1717where 
    1818 
     
    2020 
    2121     *P(q)* = 2 [exp(-Z) + Z - 1] / Z \ :sup:`2` 
    22           
    23         *Z* = (*q R* \ :sub:`g`)\ :sup:`2` 
     22 
     23    *Z* = (*q R* \ :sub:`g`)\ :sup:`2` 
    2424 
    2525and 
    2626 
    27         *V* = *M* / (*N*\ :sub:`A` |delta|) 
    28           
     27    *V* = *M* / (*N*\ :sub:`A` |delta|) 
     28 
    2929Here, |phi|\ :sub:`poly` is the volume fraction of polymer, *V* is the volume of a polymer coil, *M* is the molecular weight of the polymer, *N*\ :sub:`A` is Avogadro's Number, |delta| is the bulk density of the polymer, |rho|\ :sub:`poly` is the sld of the polymer, |rho|\ :sub:`solv` is the sld of the solvent, and *R*\ :sub:`g` is the radius of gyration of the polymer coil. 
    3030 
     
    5252description =  """ 
    5353    Evaluates the scattering from  
    54         monodisperse polymer chains. 
     54    monodisperse polymer chains. 
    5555    """ 
    5656category =  "shape-independent" 
    5757 
    5858#             ["name", "units", default, [lower, upper], "type", "description"], 
    59 parameters =  [["i_zero", "1/cm", 1.0, [-inf, inf], "", "Intensity at q=0"], 
    60                ["radius_gyration", "Ang", 50.0, [0.0, inf], "", "Radius of gyration"]] 
     59parameters =  [["i_zero", "1/cm", 70.0, [0.0, inf], "", "Intensity at q=0"], 
     60               ["radius_gyration", "Ang", 75.0, [0.0, inf], "", "Radius of gyration"]] 
    6161 
    6262# NB: Scale and Background are implicit parameters on every model 
    6363def Iq(q, i_zero, radius_gyration): 
    6464    # pylint: disable = missing-docstring 
    65     z = (q * radius_gyration) ** 2 
    66     if q == 0: 
    67        inten = 1.0 
     65    z = (q * radius_gyration) * (q * radius_gyration) 
     66    if (q == 0).any(): 
     67       inten = i_zero 
    6868    else: 
    6969       inten = i_zero * 2.0 * (exp(-z) + z - 1.0 ) / (z * z) 
     
    7777 
    7878demo =  dict(scale = 1.0, 
    79             i_zero = 1.0, 
    80             radius_gyration = 50.0, 
     79            i_zero = 70.0, 
     80            radius_gyration = 75.0, 
    8181            background = 0.0) 
    8282 
     
    8787 
    8888tests =  [ 
    89     [{'scale': 1.0, 'radius_gyration': 50.0, 'background': 0.0}, 
    90      [0.0106939, 0.469418], [0.911141, 0.00362394]], 
     89    [{'scale': 70.0, 'radius_gyration': 75.0, 'background': 0.0}, 
     90     [0.0106939, 0.469418], [57.1241, 0.112859]], 
    9191    ] 
  • sasmodels/models/poly_gauss_coil.py

    raa2edb2 r15bd6e7  
    1414 
    1515     *I(q)* = *scale* |cdot| *I* \ :sub:`0` |cdot| *P(q)* + *background* 
    16           
     16 
    1717where 
    1818 
     
    2020 
    2121     *P(q)* = 2 [(1 + UZ)\ :sup:`-1/U` + Z - 1] / [(1 + U) Z\ :sup:`2`] 
    22           
    23         *Z* = [(*q R*\ :sub:`g`)\ :sup:`2`] / (1 + 2U) 
    24           
    25         *U* = (Mw / Mn) - 1 = (*polydispersity ratio*) - 1 
     22 
     23    *Z* = [(*q R*\ :sub:`g`)\ :sup:`2`] / (1 + 2U) 
     24 
     25    *U* = (Mw / Mn) - 1 = (*polydispersity ratio*) - 1 
    2626 
    2727and 
    2828 
    29         *V* = *M* / (*N*\ :sub:`A` |delta|) 
    30           
     29    *V* = *M* / (*N*\ :sub:`A` |delta|) 
     30 
    3131Here, |phi|\ :sub:`poly`, is the volume fraction of polymer, *V* is the volume of a polymer coil, *M* is the molecular weight of the polymer, *N*\ :sub:`A` is Avogadro's Number, |delta| is the bulk density of the polymer, |rho|\ :sub:`poly` is the sld of the polymer, |rho|\ :sub:`solv` is the sld of the solvent, and *R*\ :sub:`g` is the radius of gyration of the polymer coil. 
    3232 
     
    5757description =  """ 
    5858    Evaluates the scattering from  
    59         polydisperse polymer chains. 
     59    polydisperse polymer chains. 
    6060    """ 
    6161category =  "shape-independent" 
    6262 
    6363#             ["name", "units", default, [lower, upper], "type", "description"], 
    64 parameters =  [["i_zero", "1/cm", 1.0, [-inf, inf], "", "Intensity at q=0"], 
    65                ["radius_gyration", "Ang", 50.0, [0.0, inf], "", "Radius of gyration"], 
     64parameters =  [["i_zero", "1/cm", 70.0, [0.0, inf], "", "Intensity at q=0"], 
     65               ["radius_gyration", "Ang", 75.0, [0.0, inf], "", "Radius of gyration"], 
    6666               ["polydispersity", "None", 2.0, [1.0, inf], "", "Polymer Mw/Mn"]] 
    6767 
     
    6969def Iq(q, i_zero, radius_gyration, polydispersity): 
    7070    # pylint: disable = missing-docstring 
     71    # need to trap the case of the polydispersity being 1 (ie, monodispersity) 
    7172    u = polydispersity - 1.0 
    72     # TO DO 
    73     # should trap the case of polydispersity = 1 by switching to a taylor expansion 
    74     minusoneonu = -1.0 / u 
    75     z = (q * radius_gyration) ** 2 / (1.0 + 2.0 * u) 
    76     if q == 0: 
    77         inten = i_zero * 1.0 
     73    if polydispersity == 1: 
     74       minusoneonu = -1.0 / u 
    7875    else: 
    79         inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 
     76       minusoneonu = -1.0 / u 
     77    z = ((q * radius_gyration) * (q * radius_gyration)) / (1.0 + 2.0 * u) 
     78    if (q == 0).any(): 
     79       inten = i_zero 
     80    else: 
     81       inten = i_zero * 2.0 * (power((1.0 + u * z),minusoneonu) + z - 1.0 ) / ((1.0 + u) * (z * z)) 
    8082    return inten 
    81 #Iq.vectorized = True # Iq accepts an array of q values 
     83Iq.vectorized =  True # Iq accepts an array of q values 
    8284 
    8385def Iqxy(qx, qy, *args): 
     
    8789 
    8890demo =  dict(scale = 1.0, 
    89             i_zero = 1.0, 
    90             radius_gyration = 50.0, 
     91            i_zero = 70.0, 
     92            radius_gyration = 75.0, 
    9193            polydispersity = 2.0, 
    9294            background = 0.0) 
     
    99101 
    100102tests =  [ 
    101     [{'scale': 1.0, 'radius_gyration': 50.0, 'polydispersity': 2.0, 'background': 0.0}, 
    102      [0.0106939, 0.469418], [0.912993, 0.0054163]], 
     103    [{'scale': 70.0, 'radius_gyration': 75.0, 'polydispersity': 2.0, 'background': 0.0}, 
     104     [0.0106939, 0.469418], [57.6405, 0.169016]], 
    103105    ] 
  • sasmodels/models/stickyhardsphere.py

    r0784c18 r54954e1  
    8888    #   [ "name", "units", default, [lower, upper], "type", 
    8989    #     "description" ], 
    90     ["effect_radius", "Ang", 50.0, [0, inf], "volume", 
     90    ["radius_effective", "Ang", 50.0, [0, inf], "volume", 
    9191     "effective radius of hard sphere"], 
    9292    ["volfraction", "", 0.2, [0, 0.74], "", 
     
    113113    eta = volfraction/onemineps/onemineps/onemineps; 
    114114 
    115     sig = 2.0 * effect_radius; 
     115    sig = 2.0 * radius_effective; 
    116116    aa = sig/onemineps; 
    117117    etam1 = 1.0 - eta; 
     
    179179 
    180180oldname = 'StickyHSStructure' 
    181 oldpars = dict() 
    182 demo = dict(effect_radius=200, volfraction=0.2, perturb=0.05, 
    183             stickiness=0.2, effect_radius_pd=0.1, effect_radius_pd_n=40) 
     181oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n") 
     182demo = dict(radius_effective=200, volfraction=0.2, perturb=0.05, 
     183            stickiness=0.2, radius_effective_pd=0.1, radius_effective_pd_n=40) 
    184184# 
    185185tests = [ 
    186         [ {'scale': 1.0, 'background' : 0.0, 'effect_radius' : 50.0, 'perturb' : 0.05, 'stickiness' : 0.2, 'volfraction' : 0.1, 
    187            'effect_radius_pd' : 0}, [0.001, 0.003], [1.09718, 1.087830]] 
     186        [ {'scale': 1.0, 'background' : 0.0, 'radius_effective' : 50.0, 'perturb' : 0.05, 'stickiness' : 0.2, 'volfraction' : 0.1, 
     187           'radius_effective_pd' : 0}, [0.001, 0.003], [1.09718, 1.087830]] 
    188188        ] 
    189189 
  • example/sesans_parameters_css-hs.py

    ra98958b r84db7a5  
    88# Enter the model name to use 
    99model_name = "core_shell_sphere*hardsphere" 
     10 
     11# DO NOT MODIFY THIS LINE 
     12model = sesansfit.get_bumps_model(model_name) 
    1013 
    1114# Enter any custom parameters 
     
    1922# Initial parameter values (if other than defaults) 
    2023initial_vals = { 
    21     "scale" : 0.09, 
    2224    "core_sld" : 1.0592, 
    2325    "solvent_sld" : 2.88, 
    24     "shell_sld" : 2.88, 
    2526    "radius" : 890, 
    26     "thickness" : 130, 
    27     "volfraction" : 0.45 
     27    "thickness" : 130 
    2828} 
    2929 
     
    3636} 
    3737 
     38# Constraints 
     39# model.param_name = f(other params) 
     40# EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius and scale are model functions and phi is 
     41# a custom parameter 
     42model.scale = phi*(1-phi) 
     43model.volfraction = phi 
     44model.shell_sld = pen*2.88 
     45 
    3846# Send to the fitting engine 
    3947problem = sesansfit.sesans_fit(sesans_file, model_name, initial_vals, custom_params, param_range) 
  • example/sesans_parameters_sphere.py

    ra98958b r84db7a5  
    99model_name = "sphere" 
    1010 
     11# DO NOT MODIFY THIS LINE 
     12model = sesansfit.get_bumps_model(model_name) 
     13 
    1114# Enter any custom parameters 
     15# name = Parameter(initial_value, name='name') 
    1216phi = Parameter(0.10, name='phi') 
     17# Add the parameters to this list that should be displayed in the fitting window 
    1318custom_params = {"phi" : phi} 
    1419 
    15 # SESANS data file 
     20# SESANS data file name 
    1621sesans_file = "sphere.ses" 
    1722 
    1823# Initial parameter values (if other than defaults) 
     24# "model_parameter_name" : value 
    1925initial_vals = { 
    20     "scale" : phi*(1 - phi), 
    2126    "sld" : 7.0, 
     27    "radius" : 1000, 
    2228    "solvent_sld" : 1.0, 
    23     "radius" : 1000, 
    2429} 
    2530 
    2631# Ranges for parameters if other than default 
     32# "model_parameter_name" : [min, max] 
    2733param_range = { 
    2834    "phi" : [0.001, 0.5], 
     
    3036} 
    3137 
     38# Constraints 
     39# model.param_name = f(other params) 
     40# EXAMPLE: model.scale = model.radius*model.radius*(1 - phi) - where radius and scale are model functions and phi is 
     41# a custom parameter 
     42model.scale = phi*(1-phi) 
     43 
    3244# Send to the fitting engine 
    33 problem = sesansfit.sesans_fit(sesans_file, model_name, initial_vals, custom_params, param_range) 
     45# DO NOT MODIFY THIS LINE 
     46problem = sesansfit.sesans_fit(sesans_file, model, initial_vals, custom_params, param_range) 
     47 
  • example/sesansfit.py

    ra98958b r84db7a5  
    1 #TODO: Convert units properly (nm -> A) 
    2 #TODO: Implement constraints 
    3  
    41from bumps.names import * 
    5 from sasmodels import core, bumps_model 
     2from sasmodels import core, bumps_model, sesans 
    63 
    74HAS_CONVERTER = True 
     
    118    HAS_CONVERTER = False 
    129 
    13 def sesans_fit(file, model_name, initial_vals={}, custom_params={}, param_range=[]): 
     10def get_bumps_model(model_name): 
     11    kernel = core.load_model(model_name) 
     12    model = bumps_model.Model(kernel) 
     13    return model 
     14 
     15def sesans_fit(file, model, initial_vals={}, custom_params={}, param_range=[]): 
    1416    """ 
    15  
    1617    @param file: SESANS file location 
    17     @param model_name: model name string - can be model, model_1 * model_2, and/or model_1 + model_2 
     18    @param model: Bumps model object or model name - can be model, model_1 * model_2, and/or model_1 + model_2 
    1819    @param initial_vals: dictionary of {param_name : initial_value} 
    1920    @param custom_params: dictionary of {custom_parameter_name : Parameter() object} 
    2021    @param param_range: dictionary of {parameter_name : [minimum, maximum]} 
     22    @param constraints: dictionary of {parameter_name : constraint} 
    2123    @return: FitProblem for Bumps usage 
    2224    """ 
     
    2931            default_unit = "A" 
    3032            data_conv_q = Converter(data._xunit) 
     33            for x in data.x: 
     34                print x 
    3135            data.x = data_conv_q(data.x, units=default_unit) 
     36            for x in data.x: 
     37                print x 
    3238            data._xunit = default_unit 
    3339 
     
    5157        data = SESANSData1D() 
    5258 
    53     radius = 1000 
     59    if "radius" in initial_vals: 
     60        radius = initial_vals.get("radius") 
     61    else: 
     62        radius = 1000 
    5463    data.Rmax = 3*radius # [A] 
    5564 
    56     kernel = core.load_model(model_name) 
    57     model = bumps_model.Model(kernel) 
     65    if isinstance(model, basestring): 
     66        model = get_bumps_model(model) 
    5867 
    59     # Load custom parameters, initial values and parameter constraints 
     68    # Load custom parameters, initial values and parameter ranges 
    6069    for k, v in custom_params.items(): 
    6170        setattr(model, k, v) 
     
    6978            setattr(param.bounds, "limits", v) 
    7079 
    71     if False: # have sans data 
     80    if False: # for future implementation 
    7281        M_sesans = bumps_model.Experiment(data=data, model=model) 
    7382        M_sans = bumps_model.Experiment(data=sans_data, model=model) 
  • sasmodels/data.py

    r7824276 r84db7a5  
    440440 
    441441    if use_data or use_theory: 
     442        is_tof = np.any(data.lam!=data.lam[0]) 
    442443        if num_plots > 1: 
    443444            plt.subplot(1, num_plots, 1) 
    444445        if use_data: 
    445             plt.errorbar(data.x, data.y, yerr=data.dy) 
     446            if is_tof: 
     447                plt.errorbar(data.x, np.log(data.y)/(data.lam*data.lam), yerr=data.dy/data.y/(data.lam*data.lam)) 
     448            else: 
     449                plt.errorbar(data.x, data.y, yerr=data.dy) 
    446450        if theory is not None: 
    447             plt.plot(data.x, theory, '-', hold=True) 
     451            if is_tof: 
     452                plt.plot(data.x, np.log(theory)/(data.lam*data.lam), '-', hold=True) 
     453            else: 
     454                plt.plot(data.x, theory, '-', hold=True) 
    448455        if limits is not None: 
    449456            plt.ylim(*limits) 
    450         plt.xlabel('spin echo length (nm)') 
    451         plt.ylabel('polarization (P/P0)') 
     457 
     458        plt.xlabel('spin echo length ({})'.format(data._xunit)) 
     459        if is_tof: 
     460            plt.ylabel('(Log (P/P$_0$))/$\lambda^2$') 
     461        else: 
     462            plt.ylabel('polarization (P/P0)') 
     463 
    452464 
    453465    if resid is not None: 
     
    455467            plt.subplot(1, num_plots, (use_data or use_theory) + 1) 
    456468        plt.plot(data.x, resid, 'x') 
    457         plt.xlabel('spin echo length (nm)') 
     469        plt.xlabel('spin echo length ({})'.format(data._xunit)) 
    458470        plt.ylabel('residuals (P/P0)') 
    459471 
  • sasmodels/models/hardsphere.py

    raa2edb2 r84db7a5  
    77the maths needs to be modified (no \Beta(Q) correction yet in sasview). 
    88 
    9 radius_effective is the effective hard sphere radius. 
     9effect_radius is the effective hard sphere radius. 
    1010volfraction is the volume fraction occupied by the spheres. 
    1111 
     
    5353        systems. Though strictly the maths needs to be modified - 
    5454    which sasview does not do yet. 
    55     radius_effective is the hard sphere radius 
     55    effect_radius is the hard sphere radius 
    5656    volfraction is the volume fraction occupied by the spheres. 
    5757""" 
     
    6060 
    6161#             ["name", "units", default, [lower, upper], "type","description"], 
    62 parameters = [["radius_effective", "Ang", 50.0, [0, inf], "volume", 
     62parameters = [["effect_radius", "Ang", 50.0, [0, inf], "volume", 
    6363               "effective radius of hard sphere"], 
    6464              ["volfraction", "", 0.2, [0, 0.74], "", 
     
    7575      double D,A,B,G,X,X2,X4,S,C,FF,HARDSPH; 
    7676 
    77       if(fabs(radius_effective) < 1.E-12) { 
     77      if(fabs(effect_radius) < 1.E-12) { 
    7878               HARDSPH=1.0; 
    7979               return(HARDSPH); 
     
    8484      A= (1.+2.*volfraction)*D; 
    8585      A *=A; 
    86       X=fabs(q*radius_effective*2.0); 
     86      X=fabs(q*effect_radius*2.0); 
    8787 
    8888      if(X < 5.E-06) { 
     
    147147# VR defaults to 1.0 
    148148 
    149 demo = dict(radius_effective=200, volfraction=0.2, radius_effective_pd=0.1, radius_effective_pd_n=40) 
     149demo = dict(effect_radius=200, volfraction=0.2, effect_radius_pd=0.1, effect_radius_pd_n=40) 
    150150oldname = 'HardsphereStructure' 
    151 oldpars = dict(radius_effective="effect_radius",radius_effective_pd="effect_radius_pd",radius_effective_pd_n="effect_radius_pd_n") 
     151oldpars = dict(effect_radius="effect_radius",effect_radius_pd="effect_radius_pd",effect_radius_pd_n="effect_radius_pd_n") 
    152152# Q=0.001 is in the Taylor series, low Q part, so add Q=0.1, assuming double precision sasview is correct 
    153153tests = [ 
    154         [ {'scale': 1.0, 'background' : 0.0, 'radius_effective' : 50.0, 'volfraction' : 0.2, 
    155            'radius_effective_pd' : 0}, [0.001,0.1], [0.209128,0.930587]] 
     154        [ {'scale': 1.0, 'background' : 0.0, 'effect_radius' : 50.0, 'volfraction' : 0.2, 
     155           'effect_radius_pd' : 0}, [0.001,0.1], [0.209128,0.930587]] 
    156156        ] 
    157157# ADDED by: RKH  ON: 16Mar2016  using equations from FISH as better than orig sasview, see notes above. Added Taylor expansions at small Q,  
Note: See TracChangeset for help on using the changeset viewer.