Changeset 168052c in sasmodels for sasmodels/models/flexible_cylinder.py


Ignore:
Timestamp:
Jan 29, 2016 6:02:35 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:
ed82794
Parents:
bf6631a
Message:

pylint prettification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/flexible_cylinder.py

    rf94d8a2 r168052c  
    11r""" 
    2 This model provides the form factor, $P(q)$, for a flexible cylinder where the form factor 
    3 is normalized by the volume of the cylinder. 
     2This model provides the form factor, $P(q)$, for a flexible cylinder 
     3where the form factor is normalized by the volume of the cylinder. 
    44**Inter-cylinder interactions are NOT provided for.** 
    55 
     
    88    P(q) = \text{scale} \left<F^2\right>/V + \text{background} 
    99 
    10 where the averaging $\left<\ldots\right>$ is applied only for the 1D calculation 
     10where the averaging $\left<\ldots\right>$ is applied only for the 1D 
     11calculation 
    1112 
    12 The 2D scattering intensity is the same as 1D, regardless of the orientation of the q vector which is defined as 
     13The 2D scattering intensity is the same as 1D, regardless of the orientation of 
     14the q vector which is defined as 
    1315 
    1416.. math:: 
     
    2224 
    2325 
    24 The chain of contour length, $L$, (the total length) can be described as a chain of some number of 
    25 locally stiff segments of length $l_p$, the persistence length (the length along the cylinder over 
    26 which the flexible cylinder can be considered a rigid rod). 
     26The chain of contour length, $L$, (the total length) can be described as a 
     27chain of some number of locally stiff segments of length $l_p$, the persistence 
     28length (the length along the cylinder over which the flexible cylinder can be 
     29considered a rigid rod). 
    2730The Kuhn length $(b = 2*l_p)$ is also used to describe the stiffness of a chain. 
    2831 
    2932The returned value is in units of $cm^-1$, on absolute scale. 
    3033 
    31 In the parameters, the sldCyl and sldSolv represent the SLD of the chain/cylinder and solvent respectively. 
     34In the parameters, the sldCyl and sldSolv represent the SLD of the chain/cylinder 
     35and solvent respectively. 
    3236 
    3337 
     
    3741 
    3842 
    39 Our model uses the form factor calculations implemented in a c-library provided by the NIST Center 
    40 for Neutron Research (Kline, 2006). 
     43Our model uses the form factor calculations implemented in a c-library provided 
     44by the NIST Center for Neutron Research (Kline, 2006). 
    4145 
    4246 
     
    4549    'Method 3 With Excluded Volume' is used. 
    4650    The model is a parametrization of simulations of a discrete representation 
    47     of the worm-like chain model of Kratky and Porod applied in the pseudocontinuous limit. 
     51    of the worm-like chain model of Kratky and Porod applied in the 
     52    pseudocontinuous limit. 
    4853    See equations (13,26-27) in the original reference for the details. 
    4954 
     
    5156---------- 
    5257 
    53 J S Pedersen and P Schurtenberger. *Scattering functions of semiflexible polymers with and 
    54 without excluded volume effects.* Macromolecules, 29 (1996) 7602-7612 
     58J S Pedersen and P Schurtenberger. *Scattering functions of semiflexible 
     59polymers with and without excluded volume effects.* Macromolecules, 
     6029 (1996) 7602-7612 
    5561 
    5662Correction of the formula can be found in 
    5763 
    58 W R Chen, P D Butler and L J Magid, *Incorporating Intermicellar Interactions in the Fitting of 
    59 SANS Data from Cationic Wormlike Micelles.* Langmuir, 22(15) 2006 6539-6548 
     64W R Chen, P D Butler and L J Magid, *Incorporating Intermicellar Interactions 
     65in the Fitting of SANS Data from Cationic Wormlike Micelles.* Langmuir, 
     6622(15) 2006 6539-6548 
    6067""" 
    6168from numpy import inf 
    6269 
    6370name = "flexible_cylinder" 
    64 title = "Flexible cylinder where the form factor is normalized by the volume of the cylinder." 
    65 description = """Note : scale and contrast=sld-solvent_sld are both multiplicative factors in the 
    66                 model and are perfectly correlated. One or 
    67                 both of these parameters must be held fixed 
     71title = "Flexible cylinder where the form factor is normalized by the volume" \ 
     72        "of the cylinder." 
     73description = """Note : scale and contrast=sld-solvent_sld are both 
     74                multiplicative factors in the model and are perfectly 
     75                correlated. One or both of these parameters must be held fixed 
    6876                during model fitting. 
    6977              """ 
     
    7179category = "shape:cylinder" 
    7280 
     81# pylint: disable=bad-whitespace, line-too-long 
    7382#             ["name", "units", default, [lower, upper], "type", "description"], 
    7483parameters = [ 
    75               ["length",      "Ang",       1000.0, [0, inf],    "volume", "Length of the flexible cylinder"], 
    76               ["kuhn_length", "Ang",        100.0, [0, inf],    "volume", "Kuhn length of the flexible cylinder"], 
    77               ["radius",      "Ang",         20.0, [0, inf],    "volume", "Radius of the flexible cylinder"], 
    78               ["sld",         "1e-6/Ang^2",   1.0, [-inf, inf], "",       "Cylinder scattering length density"], 
    79               ["solvent_sld", "1e-6/Ang^2",   6.3, [-inf, inf], "",       "Solvent scattering length density"], 
    80              ] 
    81  
     84    ["length",      "Ang",       1000.0, [0, inf],    "volume", "Length of the flexible cylinder"], 
     85    ["kuhn_length", "Ang",        100.0, [0, inf],    "volume", "Kuhn length of the flexible cylinder"], 
     86    ["radius",      "Ang",         20.0, [0, inf],    "volume", "Radius of the flexible cylinder"], 
     87    ["sld",         "1e-6/Ang^2",   1.0, [-inf, inf], "",       "Cylinder scattering length density"], 
     88    ["solvent_sld", "1e-6/Ang^2",   6.3, [-inf, inf], "",       "Solvent scattering length density"], 
     89    ] 
     90# pylint: enable=bad-whitespace, line-too-long 
    8291source = ["lib/J1.c", "lib/wrc_cyl.c", "flexible_cylinder.c"] 
    8392 
     
    94103 
    95104tests = [ 
    96          # Accuracy tests based on content in test/utest_other_models.py 
    97          # Currently fails in OCL 
    98          # [{'length':     1000.0, 
    99          #  'kuhn_length': 100.0, 
    100          #  'radius':       20.0, 
    101          #  'sld':           1.0, 
    102          #  'solvent_sld':   6.3, 
    103          #  'background':    0.0001, 
    104          #  }, 0.001, 3509.2187], 
     105    # Accuracy tests based on content in test/utest_other_models.py 
     106    # Currently fails in OCL 
     107    # [{'length':     1000.0, 
     108    #  'kuhn_length': 100.0, 
     109    #  'radius':       20.0, 
     110    #  'sld':           1.0, 
     111    #  'solvent_sld':   6.3, 
     112    #  'background':    0.0001, 
     113    #  }, 0.001, 3509.2187], 
    105114 
    106          # Additional tests with larger range of parameters 
    107          [{'length':     1000.0, 
    108            'kuhn_length': 100.0, 
    109            'radius':       20.0, 
    110            'sld':           1.0, 
    111            'solvent_sld':   6.3, 
    112            'background':    0.0001, 
    113            }, 1.0, 0.000595345], 
    114         [{'length':        10.0, 
    115            'kuhn_length': 800.0, 
    116            'radius':        2.0, 
    117            'sld':           6.0, 
    118            'solvent_sld':  12.3, 
    119            'background':    0.001, 
    120            }, 0.1, 1.55228], 
    121        [{'length':        100.0, 
    122            'kuhn_length': 800.0, 
    123            'radius':       50.0, 
    124            'sld':           0.1, 
    125            'solvent_sld':   5.1, 
    126            'background':    0.0, 
    127            }, 1.0, 0.000938456] 
    128          ] 
     115    # Additional tests with larger range of parameters 
     116    [{'length':    1000.0, 
     117      'kuhn_length': 100.0, 
     118      'radius':       20.0, 
     119      'sld':           1.0, 
     120      'solvent_sld':   6.3, 
     121      'background':    0.0001, 
     122     }, 1.0, 0.000595345], 
     123    [{'length':        10.0, 
     124      'kuhn_length': 800.0, 
     125      'radius':        2.0, 
     126      'sld':           6.0, 
     127      'solvent_sld':  12.3, 
     128      'background':    0.001, 
     129     }, 0.1, 1.55228], 
     130    [{'length':        100.0, 
     131      'kuhn_length': 800.0, 
     132      'radius':       50.0, 
     133      'sld':           0.1, 
     134      'solvent_sld':   5.1, 
     135      'background':    0.0, 
     136     }, 1.0, 0.000938456] 
     137    ] 
    129138 
Note: See TracChangeset for help on using the changeset viewer.