Changeset 7ef3589 in sasmodels


Ignore:
Timestamp:
Feb 17, 2016 5:36:16 AM (8 years ago)
Author:
wojciech
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:
4a82d4d
Parents:
2fb1d88
Message:

Spherical sld 1st compiling version

Location:
sasmodels/models
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/lib/librefl.c

    r9244430 r7ef3589  
    1 //complex cassign(real, imag); 
    2 //complex cplx_add(x,y); 
    3 //complex rcmult(x,y); 
    4 //complex cplx_sub(x,y); 
    5 //complex cplx_mult(x,y); 
    6 //complex cplx_div(x,y); 
    7 //complex cplx_exp(b); 
     1typedef struct { 
     2        double re; 
     3        double im; 
     4} complex; 
     5 
     6complex cassign(real, imag); 
     7complex cplx_add(x,y); 
     8complex rcmult(x,y); 
     9complex cplx_sub(x,y); 
     10complex cplx_mult(x,y); 
     11complex cplx_div(x,y); 
     12complex cplx_exp(b); 
    813 
    914double err_mod_func(double n_sub, double ind, double nu); 
  • sasmodels/models/spherical_sld.py

    r9244430 r7ef3589  
    6767#            ["name", "units", default, [lower, upper], "type", "description"], 
    6868parameters = [["n_shells",       "",         1, [0, 9], "", "number of shells"], 
    69               ["npts_imter",  "",         35, [0, inf], "", "number of points in each sublayer"], 
     69              ["npts_inter",  "",         35, [0, inf], "", "number of points in each sublayer"], 
    7070              ["sld_solv",     "1/Ang^2",    1E-6,[-inf, inf], "","sld function solvent"], 
    71               ["func_inter_0",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     71              ["func_inter_0",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    7272              ["nu_inter_0",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    7373              ["thick_inter_0",       "Ang",         50, [-inf, inf], "", "intern layer thickness"], 
    7474              ["sld_core_0",       "1/Ang^2",         2.07E-6, [-inf, inf],"", "sld function flat"], 
    75               ["thick_flat_0",       "Ang",         100, [-inf, inf], "", "flat layer_thickness"], 
    76               ["func_inter_1",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     75              ["rad_core_0",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
     76              ["func_inter_1",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    7777              ["nu_inter_1",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    7878              ["thick_inter_1",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
    7979              ["sld_flat_1",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"], 
    8080              ["thick_flat_1",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
    81               ["func_inter_2",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     81              ["func_inter_2",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    8282              ["nu_inter_2",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    8383              ["thick_inter_2",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
    8484              ["sld_flat_2",       "1/Ang^2",         3.56E-6, [-inf, inf],"", "sld function flat"], 
    8585              ["thick_flat_2",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
    86               ["func_inter_3",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     86              ["func_inter_3",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    8787              ["nu_inter_3",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    8888              ["thick_inter_3",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
    8989              ["sld_flat_3",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"], 
    9090              ["thick_flat_3",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
    91               ["func_inter_4",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     91              ["func_inter_4",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    9292              ["nu_inter_4",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    9393              ["thick_inter_4",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
    9494              ["sld_flat_4",       "1/Ang^2",         3.5E-6, [-inf, inf],"", "sld function flat"], 
    9595              ["thick_flat_4",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
    96               ["func_inter_5",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     96              ["func_inter_5",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    9797              ["nu_inter_5",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    9898              ["thick_inter_5",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
    9999              ["sld_flat_5",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"], 
    100100              ["thick_flat_5",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
    101               ["func_inter_6",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     101              ["func_inter_6",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    102102              ["nu_inter_6",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    103103              ["thick_inter_6",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
    104104              ["sld_flat_6",       "1/Ang^2",         3.5E-6, [-inf, inf],"", "sld function flat"], 
    105105              ["thick_flat_6",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
    106               ["func_inter_7",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     106              ["func_inter_7",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    107107              ["nu_inter_7",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    108108              ["thick_inter_7",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
    109109              ["sld_flat_7",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"], 
    110110              ["thick_flat_7",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
    111               ["func_inter_8",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     111              ["func_inter_8",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    112112              ["nu_inter_8",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    113113              ["thick_inter_8",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
    114114              ["sld_flat_8",       "1/Ang^2",         3.5E-6, [-inf, inf],"", "sld function flat"], 
    115115              ["thick_flat_8",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
    116               ["func_inter_9",       "",         0, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     116              ["func_inter_9",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
    117117              ["nu_inter_9",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
    118118              ["thick_inter_9",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
    119119              ["sld_flat_9",       "1/Ang^2",         4.06E-6, [-inf, inf],"", "sld function flat"], 
    120120              ["thick_flat_9",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
     121              ["func_inter_10",       "",         3, [0, 4], "", "'Erf(|nu|*z)':0, 'RPower(z^|nu|)':1, 'LPower(z^|nu|)':2, 'RExp(-|nu|*z)':3, 'LExp(-|nu|*z)':4"], 
     122              ["nu_inter_10",       "",         2.5, [-inf, inf], "", "steepness parameter"], 
     123              ["thick_inter_10",       "Ang",         50.0, [-inf, inf], "", "intern layer thickness"], 
     124              ["sld_flat_10",       "1/Ang^2",         3.5E-6, [-inf, inf],"", "sld function flat"], 
     125              ["thick_flat_10",       "Ang",         100.0, [-inf, inf], "", "flat layer_thickness"], 
    121126              ] 
    122127# pylint: enable=bad-whitespace, line-too-long 
     
    155160 
    156161 
    157 demo = dict(scale=1, background=0.1, 
     162demo = dict(scale=1, background=0.0, 
    158163        n_shells=1, 
     164        sld_solv=1E-6, 
    159165        npts_inter=35, 
    160         sld_solv=1E-6, 
    161         func_inter_1=0.0, 
     166        func_inter_0=3, 
     167        nu_inter_0=2.5, 
     168        rad_core_0=50.0, 
     169        sld_core_0=2.07E-6, 
     170        thick_inter_0=50, 
     171        func_inter_1=3, 
    162172        nu_inter_1=2.5, 
    163173        thick_inter_1=50, 
    164174        sld_flat_1=4E-6, 
    165175        thick_flat_1=100, 
    166         func_inter_0=0.0, 
    167         nu_inter_0=2.5, 
    168         rad_core_0=50.0, 
    169         std_core_0=2.07E-6, 
    170         thick_core_0=50 
    171     ) 
     176        func_inter_2=3, 
     177        nu_inter_2=2.5, 
     178        thick_inter_2=50, 
     179        sld_flat_2=3.5E-6, 
     180        thick_flat_2=100, 
     181        func_inter_3=3, 
     182        nu_inter_3=2.5, 
     183        thick_inter_3=50, 
     184        sld_flat_3=4E-6, 
     185        thick_flat_3=100, 
     186        func_inter_4=3, 
     187        nu_inter_4=2.5, 
     188        thick_inter_4=50, 
     189        sld_flat_4=3.5E-6, 
     190        thick_flat_4=100, 
     191        func_inter_5=3, 
     192        nu_inter_5=2.5, 
     193        thick_inter_5=50, 
     194        sld_flat_5=3.5E-6, 
     195        thick_flat_5=100, 
     196        func_inter_6=3, 
     197        nu_inter_6=2.5, 
     198        thick_inter_6=50, 
     199        sld_flat_6=3.5E-6, 
     200        thick_flat_6=100, 
     201        func_inter_7=3, 
     202        nu_inter_7=2.5, 
     203        thick_inter_7=50, 
     204        sld_flat_7=4E-6, 
     205        thick_flat_7=100, 
     206        func_inter_8=3, 
     207        nu_inter_8=2.5, 
     208        thick_inter_8=50, 
     209        sld_flat_8=3.5E-6, 
     210        thick_flat_8=100, 
     211        func_inter_9=3, 
     212        nu_inter_9=2.5, 
     213        thick_inter_9=50, 
     214        sld_flat_9=4E-6, 
     215        thick_flat_9=100, 
     216        func_inter_10=3, 
     217        nu_inter_10=2.5, 
     218        thick_inter_10=50, 
     219        sld_flat_10=3.5E-6, 
     220        thick_flat_10=100 
     221        ) 
    172222 
    173223oldname = "SphericalSLDModel" 
    174224oldpars = dict( 
    175         npts_inter='npts_imter', 
    176         sld_solv='sld_solv', 
    177         func_inter_1='func_inter_1', 
    178         nu_inter_1='nu_inter', 
    179         thick_inter_1='thick_inter1', 
    180         sld_flat_1='sld_flat1', 
    181         thick_flat_1='thick_flat1', 
    182         func_inter_0='nu_inter0', 
    183         nu_inter_0='nu_inter0', 
    184         rad_core_0='rad_core0', 
    185         std_core_0='std_core0', 
    186         thick_core_0='thick_core0', 
    187         background='background') 
     225        scale="scale", 
     226        background="background", 
     227        rad_core_0 ="rad_core0", 
     228        thick_inter_0 = "thick_inter0", 
     229        nu_inter_0 = "nu_inter0", 
     230        func_inter_0 = "func_inter0", 
     231        thick_inter_1 = "thick_inter1", 
     232        nu_inter_1 = "nu_inter1", 
     233        func_inter_1 = "func_inter1") 
     234 
     235        # n_shells="n_shells", 
     236        # npts_inter='npts_inter', 
     237        # sld_solv='sld_solv', 
     238        # func_inter_0='func_inter0', 
     239        # nu_inter_0='nu_inter0', 
     240        # rad_core_0='rad_core0', 
     241        # sld_core_0='sld_core0', 
     242        # thick_inter_0='thick_inter0', 
     243        # func_inter_1='func_inter1', 
     244        # nu_inter_1='nu_inter1', 
     245        # thick_inter_1='thick_inter1', 
     246        # sld_flat_1='sld_flat1', 
     247        # thick_flat_1='thick_flat1', 
     248        # func_inter_2='func_inter2', 
     249        # nu_inter_2='nu_inter2', 
     250        # thick_inter_2='thick_inter2', 
     251        # sld_flat_2='sld_flat2', 
     252        # thick_flat_2='thick_flat2', 
     253        # func_inter_3='func_inter3', 
     254        # nu_inter_3='nu_inter3', 
     255        # thick_inter_3='thick_inter3', 
     256        # sld_flat_3='sld_flat3', 
     257        # thick_flat_3='thick_flat3', 
     258        # func_inter_4='func_inter4', 
     259        # nu_inter_4='nu_inter4', 
     260        # thick_inter_4='thick_inter4', 
     261        # sld_flat_4='sld_flat4', 
     262        # thick_flat_4='thick_flat4', 
     263        # func_inter_5='func_inter5', 
     264        # nu_inter_5='nu_inter5', 
     265        # thick_inter_5='thick_inter5', 
     266        # sld_flat_5='sld_flat5', 
     267        # thick_flat_5='thick_flat5', 
     268        # func_inter_6='func_inter6', 
     269        # nu_inter_6='nu_inter6', 
     270        # thick_inter_6='thick_inter6', 
     271        # sld_flat_6='sld_flat6', 
     272        # thick_flat_6='thick_flat6', 
     273        # func_inter_7='func_inter7', 
     274        # nu_inter_7='nu_inter7', 
     275        # thick_inter_7='thick_inter7', 
     276        # sld_flat_7='sld_flat7', 
     277        # thick_flat_7='thick_flat7', 
     278        # func_inter_8='func_inter8', 
     279        # nu_inter_8='nu_inter8', 
     280        # thick_inter_8='thick_inter8', 
     281        # sld_flat_8='sld_flat8', 
     282        # thick_flat_8='thick_flat8', 
     283        # func_inter_9='func_inter9', 
     284        # nu_inter_9='nu_inter9', 
     285        # thick_inter_9='thick_inter9', 
     286        # sld_flat_9='sld_flat9', 
     287        # thick_flat_9='thick_flat9', 
     288        # func_inter_10='func_inter10', 
     289        # nu_inter_10='nu_inter10', 
     290        # thick_inter_10='thick_inter10', 
     291        # sld_flat_10='sld_flat10', 
     292        # thick_flat_10='thick_flat10') 
    188293 
    189294tests = [ 
     
    199304        'nu_inter_0':2.5, 
    200305        'rad_core_0':50.0, 
    201         'std_core_0':2.07E-6, 
    202         'thick_core':50, 
     306        'sld_core_0':2.07E-6, 
     307        'thick_inter_0':50, 
    203308        'background': 0.0, 
    204309    }, 0.001, 1000], 
Note: See TracChangeset for help on using the changeset viewer.