Changeset 3a66cf7 in sasmodels


Ignore:
Timestamp:
Mar 20, 2016 10:11:50 AM (8 years ago)
Author:
ajj
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:
a2d8a67
Parents:
bb02a35 (diff), 8b935d1 (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 branch 'master' of https://github.com/SasView/sasmodels

Location:
sasmodels
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/convert.py

    rbad8b12 r062db5a  
    154154        elif name == 'fractal': 
    155155            del oldpars['volfraction'] 
     156        elif name == 'vesicle': 
     157            del oldpars['volfraction'] 
    156158 
    157159    return oldpars 
     
    191193        elif name == 'fractal': 
    192194            pars['volfraction'] = 1 
     195        elif name == 'vesicle': 
     196            pars['volfraction'] = 1 
    193197             
  • sasmodels/models/binary_hard_sphere.py

    re481a39 rd189429  
    6767S R Kline, *J Appl. Cryst.*, 39 (2006) 895 
    6868 
    69 **Author:** N/A **on:** 
     69**Author:** NIST IGOR/DANSE **on:** pre 2010 
    7070 
    7171**Last Modified by:** Paul Butler **on:** March 20, 2016 
  • sasmodels/models/correlation_length.py

    raa2edb2 r326281f  
    1515and therefore the thermodynamics. The two multiplicative factors A and C, the 
    1616incoherent background B and the two exponents n and m are used as fitting 
    17 parameters. The final parameter ξ is a correlation length for the polymer 
    18 chains. Note that when m=2 this functional form becomes the familiar Lorentzian 
    19 function. 
     17parameters. (Respectively $porod\_scale$, $lorentz\_scale$, $background$, $exponent\_p$ and  
     18$exponent\_l$ in the parameter list.) The remaining parameter \xi is a correlation  
     19length for the polymer chains. Note that when m=2 this functional form becomes the  
     20familiar Lorentzian function. Some interpretation of the values of A and C may be  
     21possible depending on the values of m and n. 
    2022 
    2123For 2D data: The 2D scattering intensity is calculated in the same way as 1D, 
     
    4547              ["lorentz_scale", "", 10.0, [0, inf], "", "Lorentzian Scaling Factor"], 
    4648              ["porod_scale", "", 1e-06, [0, inf], "", "Porod Scaling Factor"], 
    47               ["cor_length", "Ang", 50.0, [0, inf], "", "Correlation length"], 
    48               ["exponent_p", "", 3.0, [0, inf], "", "Porod Exponent"], 
    49               ["exponent_l", "1/Ang^2", 2.0, [0, inf], "", "Lorentzian Exponent"], 
     49              ["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)"], 
    5052             ] 
    5153# pylint: enable=bad-continuation, line-too-long 
  • sasmodels/models/fractal.py

    rdff1088 r5e29b9d  
    4646J Teixeira, *J. Appl. Cryst.*, 21 (1988) 781-785 
    4747 
    48 **Author:** N/A **on:** 
     48**Author:** NIST IGOR/DANSE **on:** pre 2010 
    4949 
    5050**Last Modified by:** Paul Butler **on:** March 20, 2016 
  • sasmodels/models/vesicle.c

    r321736f r062db5a  
    22 
    33double Iq(double q,  
    4           double sld, double solvent_sld, 
     4          double sld, double sld_solvent, double volfraction, 
    55          double radius, double thickness); 
    66 
    77double Iqxy(double qx, double qy, 
    8           double sld, double solvent_sld, 
     8          double sld, double sld_solvent, double volfraction, 
    99          double radius, double thickness); 
    1010 
     
    2020double Iq(double q, 
    2121    double sld, 
    22     double solvent_sld, 
     22    double sld_solvent, 
     23    double volfraction, 
    2324    double radius, 
    2425    double thickness) 
     
    3031*/ 
    3132 
    32 /* 
    33    note that the sph_j1c we are using has been optimized for precision over 
    34    SasView's original implementation. HOWEVER at q==0 that implementation 
    35    set bes=1.0 rather than 0.0 (correct value) on the grounds I believe that  
    36    bes=0.00 causes Iq to have a divide by 0 error (mostly encountered when 
    37    doing a theory curve in 2D?  We should verify this and if necessary fix 
    38      -PDB Feb 7, 2016  
    39 */ 
    4033{ 
    41     double bes,vol,contrast,f,f2; 
     34    double vol,contrast,f,f2; 
    4235 
    4336    // core first, then add in shell 
    44     contrast = solvent_sld-sld; 
    45     bes = sph_j1c(q*radius); 
     37    contrast = sld_solvent-sld; 
    4638    vol = 4.0*M_PI/3.0*radius*radius*radius; 
    47     f = vol*bes*contrast; 
     39    f = vol*sph_j1c(q*radius)*contrast; 
    4840  
    49     //now the shell 
    50     contrast = sld-solvent_sld; 
    51     bes = sph_j1c(q*(radius+thickness)); 
     41    //now the shell. No volume normalization as this is done by the caller 
     42    contrast = sld-sld_solvent; 
    5243    vol = 4.0*M_PI/3.0*(radius+thickness)*(radius+thickness)*(radius+thickness); 
    53     f += vol*bes*contrast; 
     44    f += vol*sph_j1c(q*(radius+thickness))*contrast; 
    5445 
    55     //rescale to [cm-1]. No volume normalization as this is done by the caller 
    56     f2 = f*f*1.0e-4; 
     46    //rescale to [cm-1].  
     47    f2 = volfraction*f*f*1.0e-4; 
    5748     
    5849    return(f2); 
     
    6152 
    6253double Iqxy(double qx, double qy, 
    63           double sld, double solvent_sld, 
     54          double sld, double sld_solvent, double volfraction, 
    6455          double radius, double thickness) 
    6556           
     
    6758    double q = sqrt(qx*qx + qy*qy); 
    6859    return Iq(q, 
    69         sld, solvent_sld, 
     60        sld, sld_solvent, volfraction, 
    7061        radius,thickness); 
    7162 
  • sasmodels/models/vesicle.py

    raa2edb2 r062db5a  
    77.. math:: 
    88 
    9     P(q) = \frac{\text{scale}}{V_\text{shell}} \left[ 
     9    P(q) = \frac{\phi}{V_\text{shell}} \left[ 
    1010           \frac{3V_{\text{core}}({\rho_{\text{solvent}} 
    1111           - \rho_{\text{shell}})j_1(qR_{\text{core}})}}{qR_{\text{core}}} 
     
    1515 
    1616 
    17 where scale is a scale factor equivalent to the volume fraction of shell 
    18 material if the data is on an absolute scale, $V_{shell}$ is the volume of the 
    19 shell, $V_{\text{cor}}$ is the volume of the core, $V_{\text{tot}}$ is the 
    20 total volume, $R_{\text{core}}$ is the radius of the core, $R_{\text{tot}}$ is 
    21 the outer radius of the shell, $\rho_{\text{solvent}}$ is the scattering length 
    22 density of the solvent (which is the same as for the core in this case), 
     17where $\phi$ is the volume fraction of shell material, $V_{shell}$ is the volume 
     18of the shell, $V_{\text{cor}}$ is the volume of the core, $V_{\text{tot}}$ is 
     19the total volume, $R_{\text{core}}$ is the radius of the core, $R_{\text{tot}}$ 
     20is the outer radius of the shell, $\rho_{\text{solvent}}$ is the scattering 
     21length density of the solvent (which is the same as for the core in this case), 
    2322$\rho_{\text{scale}}$ is the scattering length density of the shell, background 
    2423is a flat background level (due for example to incoherent scattering in the 
     
    5655A Guinier and G. Fournet, *Small-Angle Scattering of X-Rays*, John Wiley and 
    5756Sons, New York, (1955) 
     57 
     58**Author:** NIST IGOR/DANSE **on:** pre 2010 
     59 
     60**Last Modified by:** Paul Butler **on:** March 20, 2016 
     61 
     62**Last Reviewed by:** Paul Butler **on:** March 20, 2016 
    5863""" 
    5964 
     
    7075        thickness: the shell thickness 
    7176        sld: the shell SLD 
    72         solvent_sld: the solvent (and core) SLD 
     77        sld_slovent: the solvent (and core) SLD 
    7378        background: incoherent background 
    74         scale : scale factor = shell volume fraction if on absolute scale""" 
     79        volfraction: shell volume fraction 
     80        scale : scale factor = 1 if on absolute scale""" 
    7581category = "shape:sphere" 
    7682 
     
    7884parameters = [["sld", "1e-6/Ang^2", 0.5, [-inf, inf], "", 
    7985               "vesicle shell scattering length density"], 
    80               ["solvent_sld", "1e-6/Ang^2", 6.36, [-inf, inf], "", 
     86              ["sld_solvent", "1e-6/Ang^2", 6.36, [-inf, inf], "", 
    8187               "solvent scattering length density"], 
     88              ["volfraction", "", 0.05, [0, 1.0], "", 
     89               "volume fraction of shell"], 
    8290              ["radius", "Ang", 100, [0, inf], "volume", 
    8391               "vesicle core radius"], 
     
    114122 
    115123# parameters for demo 
    116 demo = dict(scale=1, background=0, 
    117             sld=0.5, solvent_sld=6.36, 
     124demo = dict(sld=0.5, sld_solvent=6.36, 
     125            volfraction=0.05, 
    118126            radius=100, thickness=30, 
    119127            radius_pd=.2, radius_pd_n=10, 
     
    123131# names and the target sasview model name. 
    124132oldname = 'VesicleModel' 
    125 oldpars = dict(sld='shell_sld', solvent_sld='solv_sld') 
     133oldpars = dict(sld='shell_sld', sld_solvent='solv_sld') 
    126134 
    127135 
    128136# NOTE: test results taken from values returned by SasView 3.1.2, with 
    129137# 0.001 added for a non-zero default background. 
    130 tests = [[{}, 0.0010005303255, 17139.8278799], 
    131          [{}, 0.200027832249, 0.131387268704], 
     138tests = [[{}, 0.0005, 859.916526646], 
     139         [{}, 0.100600200401, 1.77063682331], 
     140         [{}, 0.5, 0.00355351388906], 
    132141         [{}, 'ER', 130.], 
    133142         [{}, 'VR', 0.54483386436], 
  • sasmodels/resolution.py

    r2f63032 r8b935d1  
    689689        self.pars = TEST_PARS_PINHOLE_SPHERE 
    690690        from sasmodels import core 
    691         from sasmodels.models import sphere 
    692         self.model = core.load_model(sphere, dtype='double') 
     691        self.model = core.load_model("sphere", dtype='double') 
    693692 
    694693    def _eval_sphere(self, pars, resolution): 
  • sasmodels/models/raspberry.c

    rbad8b12 r0433203  
    2121double Iq(double q, 
    2222          double sld_lg, double sld_sm, double sld_solvent, 
    23           double volfraction_lg, double volfraction_sm, double surf_fraction, 
     23          double volfraction_lg, double volfraction_sm, double surface_fraction, 
    2424          double radius_lg, double radius_sm, double penetration) 
    2525{ 
     
    3737    sldL = sld_lg; 
    3838    vfS = volfraction_sm; 
     39    fSs = surface_fraction; 
    3940    rS = radius_sm; 
    40     aSs = surf_fraction; 
    4141    sldS = sld_sm; 
    4242    deltaS = penetration; 
     
    4848    VL = M_4PI_3*rL*rL*rL; 
    4949    VS = M_4PI_3*rS*rS*rS; 
    50     Np = aSs*4.0*pow(((rL+deltaS)/rS), 2.0); 
    51     fSs = Np*vfL*VS/vfS/VL; 
    52      
    53     Np2 = aSs*4.0*(rS/(rL+deltaS))*VL/VS;  
    54     fSs2 = Np2*vfL*VS/vfS/VL; 
     50 
     51    Np = vfS*fSs*VL/vfL/VS; 
     52 
    5553    slT = delrhoL*VL + Np*delrhoS*VS; 
    5654 
     
    5957         
    6058    f2 = delrhoL*delrhoL*VL*VL*sph_j1c(q*rL)*sph_j1c(q*rL);  
    61     f2 += Np2*delrhoS*delrhoS*VS*VS*sph_j1c(q*rS)*sph_j1c(q*rS);  
    62     f2 += Np2*(Np2-1)*delrhoS*delrhoS*VS*VS*sfSS;  
    63     f2 += 2*Np2*delrhoL*delrhoS*VL*VS*sfLS; 
     59    f2 += Np*delrhoS*delrhoS*VS*VS*sph_j1c(q*rS)*sph_j1c(q*rS); 
     60    f2 += Np*(Np-1)*delrhoS*delrhoS*VS*VS*sfSS; 
     61    f2 += 2*Np*delrhoL*delrhoS*VL*VS*sfLS; 
    6462    if (f2 != 0.0){ 
    6563        f2 = f2/slT/slT; 
    6664        } 
    6765 
    68     f2 = f2*(vfL*delrhoL*delrhoL*VL + vfS*fSs2*Np2*delrhoS*delrhoS*VS); 
     66    f2 = f2*(vfL*delrhoL*delrhoL*VL + vfS*fSs*Np*delrhoS*delrhoS*VS); 
    6967 
    7068    f2+= vfS*(1.0-fSs)*pow(delrhoS, 2)*VS*sph_j1c(q*rS)*sph_j1c(q*rS); 
  • sasmodels/models/raspberry.py

    rbad8b12 r0433203  
    4444from numpy import pi, inf 
    4545 
    46 name = "raspberry" 
     46name = "raspberry_surface_fraction" 
    4747title = "Calculates the form factor, *P(q)*, for a 'Raspberry-like' structure \ 
    4848where there are smaller spheres at the surface of a larger sphere, such as the \ 
     
    5050description = """ 
    5151                RaspBerryModel: 
    52                 volf_Lsph = volume fraction large spheres 
    53                 radius_Lsph = radius large sphere (A) 
    54                 sld_Lsph = sld large sphere (A-2) 
    55                 volf_Ssph = volume fraction small spheres 
    56                 radius_Ssph = radius small sphere (A) 
    57                 surfrac_Ssph = fraction of small spheres at surface 
    58                 sld_Ssph = sld small sphere 
    59                 delta_Ssph = small sphere penetration (A)  
    60                 sld_solv   = sld solvent 
     52                volfraction_lg = volume fraction large spheres 
     53                radius_lg = radius large sphere (A) 
     54                sld_lg = sld large sphere (A-2) 
     55                volfraction_sm = volume fraction small spheres 
     56                radius_sm = radius small sphere (A) 
     57                surface_fraction = fraction of small spheres at surface 
     58                sld_sm = sld small sphere 
     59                penetration = small sphere penetration (A) 
     60                sld_solvent   = sld solvent 
    6161                background = background (cm-1) 
    6262            Ref: J. coll. inter. sci. (2010) vol. 343 (1) pp. 36-41.""" 
     
    7474              ["volfraction_sm", "", 0.005, [-inf, inf], "", 
    7575               "volume fraction of small spheres"], 
    76               ["surf_fraction", "", 0.4, [-inf, inf], "", 
     76              ["surface_fraction", "", 0.4, [-inf, inf], "", 
    7777               "fraction of small spheres at surface"], 
    7878              ["radius_lg", "Ang", 5000, [0, inf], "volume", 
     
    8989demo = dict(scale=1, background=0.001, 
    9090            sld_lg=-0.4, sld_sm=3.5, sld_solvent=6.36, 
    91             volfraction_lg=0.05, volfraction_sm=0.005, surf_fraction=0.4, 
     91            volfraction_lg=0.05, volfraction_sm=0.005, surface_fraction=0.4, 
    9292            radius_lg=5000, radius_sm=100, penetration=0.0, 
    9393            radius_lg_pd=.2, radius_lg_pd_n=10) 
     
    9595# For testing against the old sasview models, include the converted parameter 
    9696# names and the target sasview model name. 
    97 oldname = 'RaspBerryModel' 
    98 oldpars = dict(sld_lg='sld_Lsph', sld_sm='sld_Ssph', sld_solvent='sld_solv', 
    99                volfraction_lg='volf_Lsph', volfraction_sm='volf_Ssph', 
    100                surf_fraction='surfrac_Ssph', 
    101                radius_lg='radius_Lsph', radius_sm='radius_Ssph', 
    102                penetration='delta_Ssph') 
    103  
    10497 
    10598# NOTE: test results taken from values returned by SasView 3.1.2, with 
Note: See TracChangeset for help on using the changeset viewer.