Changeset ec2ca99 in sasmodels


Ignore:
Timestamp:
Feb 8, 2016 6:01:18 AM (8 years ago)
Author:
piotr
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:
f0fb9fe, 66d119f
Parents:
98f3053
Message:

more fun with pylint

Location:
sasmodels/models
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/HayterMSAsq.py

    r13ed84c rec2ca99  
    5252    [Hayter-Penfold MSA charged sphere interparticle S(Q) structure factor] 
    5353        Interparticle structure factor S(Q)for a charged hard spheres. 
    54         Routine takes absolute value of charge, use HardSphere if charge goes to zero. 
     54        Routine takes absolute value of charge, use HardSphere if charge 
     55        goes to zero. 
    5556        In sasview the effective radius will be calculated from the 
    5657        parameters used in P(Q). 
    5758""" 
    5859single = False  # double precision only for now 
     60 
     61# pylint: disable=bad-whitespace, line-too-long 
    5962#             [ "name", "units", default, [lower, upper], "type", "description" ], 
    60 parameters = [["effect_radius", "Ang", 20.75, [0, inf], "volume", 
    61                "effective radius of hard sphere"], 
    62               ["charge", "e", 19.0, [0, inf], "", 
    63                "charge on sphere (in electrons)"], 
    64               ["volfraction", "", 0.0192, [0, 0.74], "", 
    65                "volume fraction of spheres"], 
    66               ["temperature", "K", 318.16, [0, inf], "", 
    67                "temperature, in Kelvin, for Debye length calculation"], 
    68               ["saltconc", "M", 0.0, [-inf, inf], "", 
    69                "conc of salt, 1:1 electolyte, for Debye length"], 
    70               ["dielectconst", "", 71.08, [-inf, inf], "", 
    71                "dielectric constant of solvent (default water), for Debye length"], 
    72              ] 
     63parameters = [ 
     64    ["effect_radius", "Ang", 20.75,   [0, inf],    "volume", "effective radius of hard sphere"], 
     65    ["charge",        "e",   19.0,    [0, inf],    "", "charge on sphere (in electrons)"], 
     66    ["volfraction",   "",     0.0192, [0, 0.74],   "", "volume fraction of spheres"], 
     67    ["temperature",   "K",  318.16,   [0, inf],    "", "temperature, in Kelvin, for Debye length calculation"], 
     68    ["saltconc",      "M",    0.0,    [-inf, inf], "", "conc of salt, 1:1 electolyte, for Debye length"], 
     69    ["dielectconst",  "",    71.08,   [-inf, inf], "", "dielectric constant of solvent (default water), for Debye length"], 
     70    ] 
     71# pylint: enable=bad-whitespace, line-too-long 
    7372category = "structure-factor" 
    7473 
     
    8887oldpars = dict() 
    8988# default parameter set,  use  compare.sh -midQ -linear 
    90 # note the calculation varies in different limiting cases so a wide range of parameters will be required for a thorough test! 
     89# note the calculation varies in different limiting cases so a wide range of 
     90# parameters will be required for a thorough test! 
    9191# odd that the default st has saltconc zero 
    92 demo = dict(effect_radius = 20.75,charge=19.0,volfraction = 0.0192,temperature=318.16,saltconc=0.05,dielectconst=71.08,effect_radius_pd = 0.1,effect_radius_pd_n = 40) 
     92demo = dict(effect_radius=20.75, 
     93            charge=19.0, 
     94            volfraction=0.0192, 
     95            temperature=318.16, 
     96            saltconc=0.05, 
     97            dielectconst=71.08, 
     98            effect_radius_pd=0.1, 
     99            effect_radius_pd_n=40) 
    93100# 
    94101# attempt to use same values as old sasview unit test 
    95102tests = [ 
    96         [ {'scale': 1.0, 'background' : 0.0, 'effect_radius' : 20.75, 'charge' : 19.0, 'volfraction' : 0.0192, 'temperature' : 298.0, 
    97           'saltconc' : 0,'dielectconst' : 78.0, 'effect_radius_pd' : 0}, [0.0010], [0.0712928]] 
    98         ] 
     103    [{'scale': 1.0, 
     104      'background': 0.0, 
     105      'effect_radius': 20.75, 
     106      'charge': 19.0, 
     107      'volfraction': 0.0192, 
     108      'temperature': 298.0, 
     109      'saltconc': 0, 
     110      'dielectconst': 78.0, 
     111      'effect_radius_pd': 0}, 
     112     [0.0010], [0.0712928]] 
     113    ] 
    99114 
  • sasmodels/models/hollow_cylinder.py

    r0420af7 rec2ca99  
    7878""" 
    7979category = "shape:cylinder" 
    80  
    81 #             ["name", "units", default, [lower, upper], "type","description"], 
     80# pylint: disable=bad-whitespace, line-too-long 
     81#   ["name", "units", default, [lower, upper], "type","description"], 
    8282parameters = [ 
    83               ["radius", "Ang", 30.0, [0, inf], "volume", "Cylinder radius"], 
    84               ["core_radius", "Ang", 20.0, [0, inf], "volume", "Hollow core radius"], 
    85               ["length", "Ang", 400.0, [0, inf], "volume", "Cylinder length"], 
    86               ["sld", "1/Ang^2", 6.3, [-inf, inf], "", "Cylinder sld"], 
    87               ["solvent_sld", "1/Ang^2", 1, [-inf, inf], "", "Solvent sld"], 
    88               ["theta", "degrees", 90, [-360, 360], "orientation", "Theta angle"], 
    89               ["phi", "degrees", 0, [-360, 360], "orientation", "Phi angle"], 
    90               ] 
     83    ["radius",      "Ang",     30.0, [0, inf],    "volume",      "Cylinder radius"], 
     84    ["core_radius", "Ang",     20.0, [0, inf],    "volume",      "Hollow core radius"], 
     85    ["length",      "Ang",    400.0, [0, inf],    "volume",      "Cylinder length"], 
     86    ["sld",         "1/Ang^2",  6.3, [-inf, inf], "",            "Cylinder sld"], 
     87    ["solvent_sld", "1/Ang^2",  1,   [-inf, inf], "",            "Solvent sld"], 
     88    ["theta",       "degrees", 90,   [-360, 360], "orientation", "Theta angle"], 
     89    ["phi",         "degrees",  0,   [-360, 360], "orientation", "Phi angle"], 
     90    ] 
     91# pylint: enable=bad-whitespace, line-too-long 
    9192 
    9293source = ["lib/J1.c", "lib/gauss76.c", "hollow_cylinder.c"] 
    9394 
    9495def ER(radius, core_radius, length): 
     96    """ 
     97    :param radius:      Cylinder radius 
     98    :param core_radius: Hollow core radius, UNUSED 
     99    :param length:      Cylinder length 
     100    :return:            Effective radius 
     101    """ 
    95102    if radius == 0 or length == 0: 
    96103        return 0.0 
     
    104111 
    105112def VR(radius, core_radius, length): 
     113    """ 
     114    :param radius:      Cylinder radius 
     115    :param core_radius: Hollow core radius 
     116    :param length:      Cylinder length 
     117    :return:            Volf ratio for P(q)*S(q) 
     118    """ 
    106119    vol_core = pi*core_radius*core_radius*length 
    107120    vol_total = pi*radius*radius*length 
     
    110123 
    111124# parameters for demo 
    112 demo = dict(scale=1.0,background=0.0,length=400.0,radius=30.0,core_radius=20.0, 
    113             sld=6.3,solvent_sld=1,theta=90,phi=0, 
     125demo = dict(scale=1.0, background=0.0, length=400.0, radius=30.0, 
     126            core_radius=20.0, sld=6.3, solvent_sld=1, theta=90, phi=0, 
    114127            radius_pd=.2, radius_pd_n=9, 
    115128            length_pd=.2, length_pd_n=10, 
    116129            core_radius_pd=.2, core_radius_pd_n=9, 
    117130            theta_pd=10, theta_pd_n=5, 
    118             ) 
     131           ) 
    119132 
    120133# For testing against the old sasview models, include the converted parameter 
    121134# names and the target sasview model name. 
    122135oldname = 'HollowCylinderModel' 
    123 oldpars = dict(scale='scale',background='background',radius='radius', 
    124                core_radius='core_radius',sld='sldCyl',length='length', 
    125                solvent_sld='sldSolv',phi='axis_phi',theta='axis_theta') 
     136oldpars = dict(scale='scale', background='background', radius='radius', 
     137               core_radius='core_radius', sld='sldCyl', length='length', 
     138               solvent_sld='sldSolv', phi='axis_phi', theta='axis_theta') 
    126139 
    127140# Parameters for unit tests 
    128141tests = [ 
    129          [{"radius" : 30.0},0.00005,1764.926], 
    130          [{},'VR',1.8], 
    131          [{},0.001,1756.76] 
    132          ] 
     142    [{"radius": 30.0}, 0.00005, 1764.926], 
     143    [{}, 'VR', 1.8], 
     144    [{}, 0.001, 1756.76] 
     145    ] 
  • sasmodels/models/lamellarCaille.py

    r13ed84c rec2ca99  
    1 # Note: model title and parameter table are inserted automatically 
    21r""" 
    32This model provides the scattering intensity, $I(q) = P(q) S(q)$, for a 
     
    7776title = "Random lamellar sheet with Caille structure factor" 
    7877description = """\ 
    79         [Random lamellar phase with Caille  structure factor] 
    80         randomly oriented stacks of infinite sheets 
    81                 with Caille S(Q), having polydisperse spacing. 
    82         sld = sheet scattering length density 
    83                 sld_solvent = solvent scattering length density 
    84                 background = incoherent background 
    85                 scale = scale factor 
     78    [Random lamellar phase with Caille  structure factor] 
     79    randomly oriented stacks of infinite sheets 
     80    with Caille S(Q), having polydisperse spacing. 
     81    sld = sheet scattering length density 
     82    sld_solvent = solvent scattering length density 
     83    background = incoherent background 
     84    scale = scale factor 
    8685""" 
    8786category = "shape:lamellae" 
    8887 
    8988single = False 
    90  
     89# pylint: disable=bad-whitespace, line-too-long 
    9190#             ["name", "units", default, [lower, upper], "type","description"], 
    92 parameters = [["thickness", "Ang",  30.0, [0, inf], "volume", "sheet thickness"], 
    93               ["Nlayers", "",  20, [0, inf], "", "Number of layers"], 
    94               ["spacing", "Ang", 400., [0.0,inf], "volume", "d-spacing of Caille S(Q)"], 
    95               ["Caille_parameter", "1/Ang^2", 0.1, [0.0,0.8], "", "Caille parameter"], 
    96               ["sld", "1e-6/Ang^2", 6.3, [-inf,inf], "", 
    97                "layer scattering length density"], 
    98               ["solvent_sld", "1e-6/Ang^2", 1.0, [-inf,inf], "", 
    99                "Solvent scattering length density"], 
    100              ] 
     91parameters = [ 
     92    ["thickness",        "Ang",      30.0,  [0, inf],   "volume", "sheet thickness"], 
     93    ["Nlayers",          "",          20,   [0, inf],   "",       "Number of layers"], 
     94    ["spacing",          "Ang",      400.,  [0.0,inf],  "volume", "d-spacing of Caille S(Q)"], 
     95    ["Caille_parameter", "1/Ang^2",    0.1, [0.0,0.8],  "",       "Caille parameter"], 
     96    ["sld",              "1e-6/Ang^2", 6.3, [-inf,inf], "",       "layer scattering length density"], 
     97    ["solvent_sld",      "1e-6/Ang^2", 1.0, [-inf,inf], "",       "Solvent scattering length density"], 
     98    ] 
     99# pylint: enable=bad-whitespace, line-too-long 
    101100 
    102101source = ["lamellarCaille_kernel.c"] 
     
    116115 
    117116demo = dict(scale=1, background=0, 
    118             thickness=67.,Nlayers=3.75,spacing=200., 
    119             Caille_parameter=0.268,sld=1.0, solvent_sld=6.34, 
    120             thickness_pd= 0.1, thickness_pd_n=100, 
    121             spacing_pd= 0.05, spacing_pd_n=40) 
     117            thickness=67., Nlayers=3.75, spacing=200., 
     118            Caille_parameter=0.268, sld=1.0, solvent_sld=6.34, 
     119            thickness_pd=0.1, thickness_pd_n=100, 
     120            spacing_pd=0.05, spacing_pd_n=40) 
    122121 
    123122oldname = 'LamellarPSModel' 
    124 oldpars = dict(thickness='delta', Nlayers='N_plates', Caille_parameter='caille', 
    125                sld='sld_bi',solvent_sld='sld_sol') 
     123oldpars = dict(thickness='delta', Nlayers='N_plates', 
     124               Caille_parameter='caille', 
     125               sld='sld_bi', solvent_sld='sld_sol') 
    126126# 
    127127tests = [ 
    128         [ {'scale': 1.0, 'background' : 0.0, 'thickness' : 30.,'Nlayers' : 20.0, 'spacing' : 400., 
    129             'Caille_parameter' : 0.1, 'sld' : 6.3, 'solvent_sld' : 1.0, 
    130             'thickness_pd' : 0.0, 'spacing_pd' : 0.0 }, [0.001], [28895.13397]] 
    131         ] 
     128    [{'scale': 1.0, 'background': 0.0, 'thickness': 30., 'Nlayers': 20.0, 
     129      'spacing': 400., 'Caille_parameter': 0.1, 'sld': 6.3, 
     130      'solvent_sld': 1.0, 'thickness_pd': 0.0, 'spacing_pd': 0.0}, 
     131     [0.001], [28895.13397]] 
     132    ] 
Note: See TracChangeset for help on using the changeset viewer.