Changeset 823e620 in sasmodels for sasmodels/model_test.py


Ignore:
Timestamp:
Jan 29, 2016 8:46:54 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
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:
eafc9fa
Parents:
803f835
Message:

delint

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/model_test.py

    r9404dd3 r823e620  
    99    if model1 is 'all', then all except the remaining models will be tested 
    1010 
    11 Each model is tested using the default parameters at q=0.1, (qx,qy)=(0.1,0.1), 
     11Each model is tested using the default parameters at q=0.1, (qx, qy)=(0.1, 0.1), 
    1212and the ER and VR are computed.  The return values at these points are not 
    1313considered.  The test is only to verify that the models run to completion, 
     
    3030        [ {parameters}, (qx, qy), I(qx, Iqy)], 
    3131        [ {parameters}, [(qx1, qy1), (qx2, qy2), ...], 
    32                         [I(qx1,qy1), I(qx2,qy2), ...]], 
     32                        [I(qx1, qy1), I(qx2, qy2), ...]], 
    3333 
    3434        [ {parameters}, 'ER', ER(pars) ], 
     
    7575        # don't try to call cl kernel since it will not be 
    7676        # available in some environmentes. 
    77         is_py = callable(getattr(model_definition,'Iq', None)) 
     77        is_py = callable(getattr(model_definition, 'Iq', None)) 
    7878 
    7979        if is_py:  # kernel implemented in python 
     
    123123        def _runTest(self): 
    124124            smoke_tests = [ 
    125                 [{},0.1,None], 
    126                 [{},(0.1,0.1),None], 
    127                 [{},'ER',None], 
    128                 [{},'VR',None], 
     125                [{}, 0.1, None], 
     126                [{}, (0.1, 0.1), None], 
     127                [{}, 'ER', None], 
     128                [{}, 'VR', None], 
    129129                ] 
    130130 
     
    163163                actual = [call_VR(model.info, pars)] 
    164164            elif isinstance(x[0], tuple): 
    165                 Qx,Qy = zip(*x) 
     165                Qx, Qy = zip(*x) 
    166166                q_vectors = [np.array(Qx), np.array(Qy)] 
    167167                kernel = make_kernel(model, q_vectors) 
     
    179179                    # smoke test --- make sure it runs and produces a value 
    180180                    self.assertTrue(np.isfinite(actual_yi), 
    181                         'invalid f(%s): %s' % (xi, actual_yi)) 
     181                                    'invalid f(%s): %s' % (xi, actual_yi)) 
    182182                else: 
    183183                    err = abs(yi - actual_yi) 
    184184                    nrm = abs(yi) 
    185185                    self.assertLess(err * 10**5, nrm, 
    186                         'f(%s); expected:%s; actual:%s' % (xi, yi, actual_yi)) 
     186                                    'f(%s); expected:%s; actual:%s' 
     187                                    % (xi, yi, actual_yi)) 
    187188 
    188189    return ModelTestCase 
     
    237238    Run "nosetests sasmodels" on the command line to invoke it. 
    238239    """ 
    239     tests = make_suite(['opencl','dll'],['all']) 
     240    tests = make_suite(['opencl', 'dll'], ['all']) 
    240241    for test_i in tests: 
    241242        yield test_i._runTest 
Note: See TracChangeset for help on using the changeset viewer.