Changeset 168052c in sasmodels for sasmodels/models/gauss_lorentz_gel.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/gauss_lorentz_gel.py

    r07a6700 r168052c  
    4242---------- 
    4343 
    44 G Evmenenko, E Theunissen, K Mortensen, H Reynaers, *Polymer*, 42 (2001) 2907-2913 
     44G Evmenenko, E Theunissen, K Mortensen, H Reynaers, *Polymer*, 
     4542 (2001) 2907-2913 
    4546 
    4647""" 
    4748 
    48 from numpy import inf, pi, sqrt, exp 
     49from numpy import inf, sqrt, exp 
    4950 
    5051name = "gauss_lorentz_gel" 
     
    6364            """ 
    6465category = "shape-independent" 
    65  
     66# pylint: disable=bad-whitespace, line-too-long 
    6667#            ["name", "units", default, [lower, upper], "type", "description"], 
    6768parameters = [["gauss_scale_factor",   "",    100.0,  [-inf, inf], "", "Gauss scale factor"], 
     
    6970              ["lorentz_scale_factor", "",     50.0,  [-inf, inf], "", "Lorentzian scale factor"], 
    7071              ["dynamic_cor_length",   "Ang",  20.0,  [0, inf],    "", "Dynamic correlation length"], 
    71               ] 
    72  
     72             ] 
     73# pylint: enable=bad-whitespace, line-too-long 
    7374 
    7475def Iq(q, 
    75        gauss_scale_factor, 
    76        static_cor_length, 
    77        lorentz_scale_factor, 
    78        dynamic_cor_length): 
     76       gauss_scale_factor=100.0, 
     77       static_cor_length=100.0, 
     78       lorentz_scale_factor=50.0, 
     79       dynamic_cor_length=20.0): 
     80    """ 
    7981 
    80         term1 = gauss_scale_factor *\ 
    81                 exp(-1.0*q*q*static_cor_length*static_cor_length/2.0) 
    82         term2 = lorentz_scale_factor /\ 
    83                 (1.0+(q*dynamic_cor_length)*(q*dynamic_cor_length)) 
     82    :param q:                    Input q-value 
     83    :param gauss_scale_factor:   Gauss scale factor 
     84    :param static_cor_length:    Static correlation length 
     85    :param lorentz_scale_factor: Lorentzian scale factor 
     86    :param dynamic_cor_length:   Dynamic correlation length 
     87    :return:                     1-D intensity 
     88    """ 
    8489 
    85         return term1 + term2 
     90    term1 = gauss_scale_factor *\ 
     91            exp(-1.0*q*q*static_cor_length*static_cor_length/2.0) 
     92    term2 = lorentz_scale_factor /\ 
     93            (1.0+(q*dynamic_cor_length)*(q*dynamic_cor_length)) 
     94 
     95    return term1 + term2 
    8696 
    8797Iq.vectorized = True  # Iq accepts an array of q values 
     
    8999 
    90100def Iqxy(qx, qy, *args): 
    91         iq = Iq(sqrt(qx**2 + qy**2), *args) 
     101    """ 
     102    :param qx:   Input q_x-value 
     103    :param qy:   Input q_y-value 
     104    :param args: Remaining aruments 
     105    :return:     2-D intensity 
     106    """ 
    92107 
    93         return iq 
     108    return Iq(sqrt(qx**2 + qy**2), *args) 
    94109 
    95110Iqxy.vectorized = True  # Iqxy accepts an array of qx, qy values 
     
    111126 
    112127tests = [ 
    113          # Accuracy tests based on content in test/utest_extra_models.py 
    114          [{'gauss_scale_factor':  100.0, 
    115            'static_cor_length':   100.0, 
    116            'lorentz_scale_factor': 50.0, 
    117            'dynamic_cor_length':   20.0, 
    118            }, 0.001, 149.481], 
    119128 
    120          [{'gauss_scale_factor':  100.0, 
    121            'static_cor_length':   100.0, 
    122            'lorentz_scale_factor': 50.0, 
    123            'dynamic_cor_length':   20.0, 
    124            }, 0.105363, 9.1903], 
     129    # Accuracy tests based on content in test/utest_extra_models.py 
     130    [{'gauss_scale_factor':  100.0, 
     131      'static_cor_length':   100.0, 
     132      'lorentz_scale_factor': 50.0, 
     133      'dynamic_cor_length':   20.0, 
     134     }, 0.001, 149.481], 
    125135 
    126          [{'gauss_scale_factor':  100.0, 
    127            'static_cor_length':   100.0, 
    128            'lorentz_scale_factor': 50.0, 
    129            'dynamic_cor_length':   20.0, 
    130            }, 0.441623, 0.632811], 
     136    [{'gauss_scale_factor':  100.0, 
     137      'static_cor_length':   100.0, 
     138      'lorentz_scale_factor': 50.0, 
     139      'dynamic_cor_length':   20.0, 
     140     }, 0.105363, 9.1903], 
    131141 
    132          # Additional tests with larger range of parameters 
    133          [{'gauss_scale_factor':  10.0, 
    134            'static_cor_length':  100.0, 
    135            'lorentz_scale_factor': 3.0, 
    136            'dynamic_cor_length':   1.0, 
    137            }, 0.1, 2.9702970297], 
     142    [{'gauss_scale_factor':  100.0, 
     143      'static_cor_length':   100.0, 
     144      'lorentz_scale_factor': 50.0, 
     145      'dynamic_cor_length':   20.0, 
     146     }, 0.441623, 0.632811], 
    138147 
    139          [{'gauss_scale_factor':  10.0, 
    140            'static_cor_length':  100.0, 
    141            'lorentz_scale_factor': 3.0, 
    142            'dynamic_cor_length':   1.0, 
    143            'background':         100.0 
    144            }, 5.0, 100.115384615], 
     148    # Additional tests with larger range of parameters 
     149    [{'gauss_scale_factor':  10.0, 
     150      'static_cor_length':  100.0, 
     151      'lorentz_scale_factor': 3.0, 
     152      'dynamic_cor_length':   1.0, 
     153     }, 0.1, 2.9702970297], 
    145154 
    146          [{'gauss_scale_factor':  10.0, 
    147            'static_cor_length':  100.0, 
    148            'lorentz_scale_factor': 3.0, 
    149            'dynamic_cor_length':   1.0, 
    150            }, 200., 7.49981250469e-05], 
    151          ] 
     155    [{'gauss_scale_factor':  10.0, 
     156      'static_cor_length':  100.0, 
     157      'lorentz_scale_factor': 3.0, 
     158      'dynamic_cor_length':   1.0, 
     159      'background':         100.0 
     160     }, 5.0, 100.115384615], 
     161 
     162    [{'gauss_scale_factor':  10.0, 
     163      'static_cor_length':  100.0, 
     164      'lorentz_scale_factor': 3.0, 
     165      'dynamic_cor_length':   1.0, 
     166     }, 200., 7.49981250469e-05], 
     167    ] 
Note: See TracChangeset for help on using the changeset viewer.