Changeset 0b56f38 in sasmodels


Ignore:
Timestamp:
Apr 6, 2017 6:01:42 AM (8 years ago)
Author:
richardh
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
e2d6e3b
Parents:
b6e0636
Message:

unit tests added, needs opencl testing

Location:
sasmodels/models
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/barbell.py

    rfcb33e4 r0b56f38  
    8787* **Last Reviewed by:** Richard Heenan **Date:** January 4, 2017 
    8888""" 
    89 from numpy import inf 
     89from numpy import inf, sin, cos, pi 
    9090 
    9191name = "barbell" 
     
    125125            phi_pd=15, phi_pd_n=0, 
    126126           ) 
     127q = 0.1 
     128# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
     129qx = q*cos(pi/6.0) 
     130qy = q*sin(pi/6.0) 
     131tests = [[{}, 0.075, 25.5691260532], 
     132        [{'theta':80., 'phi':10.}, (qx, qy), 3.04233067789], 
     133        ] 
     134del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/bcc_paracrystal.py

    r925ad6e r0b56f38  
    9999""" 
    100100 
    101 from numpy import inf 
     101from numpy import inf, pi 
    102102 
    103103name = "bcc_paracrystal" 
     
    141141    psi_pd=15, psi_pd_n=0, 
    142142    ) 
     143# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
     144q =4.*pi/220. 
     145tests = [ 
     146    [{ }, 
     147     [0.001, q, 0.215268], [1.46601394721, 2.85851284174, 0.00866710287078]], 
     148] 
  • sasmodels/models/capped_cylinder.py

    rfcb33e4 r0b56f38  
    9191 
    9292""" 
    93 from numpy import inf 
     93from numpy import inf, sin, cos, pi 
    9494 
    9595name = "capped_cylinder" 
     
    145145            theta_pd=15, theta_pd_n=45, 
    146146            phi_pd=15, phi_pd_n=1) 
     147q = 0.1 
     148# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
     149qx = q*cos(pi/6.0) 
     150qy = q*sin(pi/6.0) 
     151tests = [[{}, 0.075, 26.0698570695], 
     152        [{'theta':80., 'phi':10.}, (qx, qy), 0.561811990502], 
     153        ] 
     154del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/core_shell_bicelle.py

    r3b9a526 r0b56f38  
    8888""" 
    8989 
    90 from numpy import inf, sin, cos 
     90from numpy import inf, sin, cos, pi 
    9191 
    9292name = "core_shell_bicelle" 
     
    155155            theta=90, 
    156156            phi=0) 
     157q = 0.1 
     158# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
     159qx = q*cos(pi/6.0) 
     160qy = q*sin(pi/6.0) 
     161tests = [[{}, 0.05, 7.4883545957], 
     162        [{'theta':80., 'phi':10.}, (qx, qy), 2.81048892474 ], 
     163        ] 
     164del qx, qy  # not necessary to delete, but cleaner 
    157165 
    158 #qx, qy = 0.4 * cos(pi/2.0), 0.5 * sin(0) 
  • sasmodels/models/core_shell_bicelle_elliptical.py

    r3b9a526 r0b56f38  
    9999""" 
    100100 
    101 from numpy import inf, sin, cos 
     101from numpy import inf, sin, cos, pi 
    102102 
    103103name = "core_shell_bicelle_elliptical" 
     
    150150            psi=0) 
    151151 
    152 #qx, qy = 0.4 * cos(pi/2.0), 0.5 * sin(0) 
     152q = 0.1 
     153# april 6 2017, rkh added a 2d unit test, NOT READY YET pull #890 branch assume correct! 
     154qx = q*cos(pi/6.0) 
     155qy = q*sin(pi/6.0) 
    153156 
    154157tests = [ 
     
    159162    'sld_core':4.0, 'sld_face':7.0, 'sld_rim':1.0, 'sld_solvent':6.0, 'background':0.0}, 
    160163    0.015, 286.540286], 
    161 ] 
     164#    [{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ], 
     165        ] 
     166 
     167del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/core_shell_cylinder.py

    rfcb33e4 r0b56f38  
    7373""" 
    7474 
    75 from numpy import pi, inf 
     75from numpy import pi, inf, sin, cos 
    7676 
    7777name = "core_shell_cylinder" 
     
    151151            theta_pd=15, theta_pd_n=45, 
    152152            phi_pd=15, phi_pd_n=1) 
    153  
     153q = 0.1 
     154# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
     155qx = q*cos(pi/6.0) 
     156qy = q*sin(pi/6.0) 
     157tests = [[{}, 0.075, 10.8552692237], 
     158        [{}, (qx, qy), 0.444618752741 ], 
     159        ] 
     160del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/ellipsoid.py

    r4b0a294 r0b56f38  
    120120""" 
    121121 
    122 from numpy import inf 
     122from numpy import inf, sin, cos, pi 
    123123 
    124124name = "ellipsoid" 
     
    190190            theta_pd=15, theta_pd_n=45, 
    191191            phi_pd=15, phi_pd_n=1) 
     192q = 0.1 
     193# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
     194qx = q*cos(pi/6.0) 
     195qy = q*sin(pi/6.0) 
     196tests = [[{}, 0.05, 54.8525847025], 
     197        [{'theta':80., 'phi':10.}, (qx, qy), 1.74134670026 ], 
     198        ] 
     199del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/elliptical_cylinder.py

    rfcb33e4 r0b56f38  
    108108""" 
    109109 
    110 from numpy import pi, inf, sqrt 
     110from numpy import pi, inf, sqrt, sin, cos 
    111111 
    112112name = "elliptical_cylinder" 
     
    149149                           + (length + radius) * (length + pi * radius)) 
    150150    return 0.5 * (ddd) ** (1. / 3.) 
     151q = 0.1 
     152# april 6 2017, rkh added a 2d unit test, NOT READY YET pull #890 branch assume correct! 
     153qx = q*cos(pi/6.0) 
     154qy = q*sin(pi/6.0) 
    151155 
    152156tests = [ 
     
    158162      'sld_solvent':1.0, 'background':0.0}, 
    159163     0.001, 675.504402], 
     164#    [{'theta':80., 'phi':10.}, (qx, qy), 7.88866563001 ], 
    160165] 
  • sasmodels/models/hollow_cylinder.py

    raea2e2a r0b56f38  
    6060""" 
    6161 
    62 from numpy import pi, inf 
     62from numpy import pi, inf, sin, cos 
    6363 
    6464name = "hollow_cylinder" 
     
    129129            theta_pd=10, theta_pd_n=5, 
    130130           ) 
    131  
     131q = 0.1 
     132# april 6 2017, rkh added a 2d unit test, assume correct! 
     133qx = q*cos(pi/6.0) 
     134qy = q*sin(pi/6.0) 
    132135# Parameters for unit tests 
    133136tests = [ 
    134137    [{}, 0.00005, 1764.926], 
    135138    [{}, 'VR', 1.8], 
    136     [{}, 0.001, 1756.76] 
    137     ] 
     139    [{}, 0.001, 1756.76], 
     140    [{}, (qx, qy), 2.36885476192  ], 
     141        ] 
     142del qx, qy  # not necessary to delete, but cleaner 
  • sasmodels/models/stacked_disks.py

    rc3ccaec r0b56f38  
    103103""" 
    104104 
    105 from numpy import inf 
     105from numpy import inf, sin, cos, pi 
    106106 
    107107name = "stacked_disks" 
     
    152152# After redefinition of spherical coordinates - 
    153153# tests had in old coords theta=0, phi=0; new coords theta=90, phi=0 
    154 # but should not matter here as so far all the tests are 1D not 2D 
     154q = 0.1 
     155# april 6 2017, rkh added a 2d unit test, assume correct! 
     156qx = q*cos(pi/6.0) 
     157qy = q*sin(pi/6.0) 
    155158tests = [ 
    156159# Accuracy tests based on content in test/utest_extra_models.py. 
     
    186189    [{'thick_core': 10.0, 
    187190      'thick_layer': 15.0, 
     191      'radius': 100.0, 
     192      'n_stacking': 5, 
     193      'sigma_d': 0.0, 
     194      'sld_core': 4.0, 
     195      'sld_layer': -0.4, 
     196      'solvent_sd': 5.0, 
     197      'theta': 90.0, 
     198      'phi': 20.0, 
     199      'scale': 0.01, 
     200      'background': 0.001}, 
     201      (qx, qy), 0.0491167089952  ], 
     202    [{'thick_core': 10.0, 
     203      'thick_layer': 15.0, 
    188204      'radius': 3000.0, 
    189205      'n_stacking': 5, 
     
    228244      'background': 0.001, 
    229245     }, ([0.4, 0.5]), [0.00105074, 0.00121761]], 
     246    [{'thick_core': 10.0, 
     247      'thick_layer': 15.0, 
     248      'radius': 3000.0, 
     249      'n_stacking': 1.0, 
     250      'sigma_d': 0.0, 
     251      'sld_core': 4.0, 
     252      'sld_layer': -0.4, 
     253      'solvent_sd': 5.0, 
     254      'theta': 90.0, 
     255      'phi': 20.0, 
     256      'scale': 0.01, 
     257      'background': 0.001, 
     258     }, (qx, qy), 0.0341738733124 ], 
    230259 
    231260    [{'thick_core': 10.0, 
  • sasmodels/models/triaxial_ellipsoid.py

    r4b0a294 r0b56f38  
    112112""" 
    113113 
    114 from numpy import inf 
     114from numpy import inf, sin, cos, pi 
    115115 
    116116name = "triaxial_ellipsoid" 
     
    166166            phi_pd=15, phi_pd_n=1, 
    167167            psi_pd=15, psi_pd_n=1) 
     168q = 0.1 
     169# april 6 2017, rkh add unit tests, NOT compared with any other calc method, assume correct! 
     170# add 2d test after pull #890 
     171qx = q*cos(pi/6.0) 
     172qy = q*sin(pi/6.0) 
     173tests = [[{}, 0.05, 24.8839548033], 
     174#        [{'theta':80., 'phi':10.}, (qx, qy), 9999. ], 
     175        ] 
     176del qx, qy  # not necessary to delete, but cleaner 
Note: See TracChangeset for help on using the changeset viewer.