Changeset d8e81f7 in sasmodels


Ignore:
Timestamp:
Mar 28, 2019 11:49:06 AM (4 months ago)
Author:
ajj
Branches:
master, ticket-1257-vesicle-product, ticket_1156, ticket_822_more_unit_tests
Children:
6140894
Parents:
b39bf3b (diff), 2ed7de0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ticket_822_v5_unit_tests' of https://github.com/SasView/sasmodels into ticket_822_v5_unit_tests

Location:
sasmodels
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/core.py

    r0b8a1fc r9562dd2  
    376376    # type: () -> None 
    377377    """Check that model load works""" 
     378    from .product import RADIUS_ID, VOLFRAC_ID, STRUCTURE_MODE_ID, RADIUS_MODE_ID 
    378379    #Test the the model produces the parameters that we would expect 
    379380    model = load_model("cylinder@hardsphere*sphere") 
    380381    actual = [p.name for p in model.info.parameters.kernel_parameters] 
    381     target = ("sld sld_solvent radius length theta phi" 
    382               " radius_effective volfraction " 
    383               " structure_factor_mode effective_radius_type" 
    384               " A_sld A_sld_solvent A_radius").split() 
     382    target = ["sld", "sld_solvent", "radius", "length", "theta", "phi", 
     383              RADIUS_ID, VOLFRAC_ID, STRUCTURE_MODE_ID, RADIUS_MODE_ID, 
     384              "A_sld", "A_sld_solvent", "A_radius"] 
    385385    assert target == actual, "%s != %s"%(target, actual) 
    386386 
  • sasmodels/direct_model.py

    rb39bf3b rd8e81f7  
    7676    R_eff_type = int(pars.pop(RADIUS_MODE_ID, 1.0)) 
    7777    mesh = get_mesh(calculator.info, pars, dim=calculator.dim, mono=mono) 
    78     print("in call_Fq: pars", list(zip(*mesh))[0]) 
     78    #print("in call_Fq: pars", list(zip(*mesh))[0]) 
    7979    call_details, values, is_magnetic = make_kernel_args(calculator, mesh) 
    8080    #print("in call_Fq: values:", values) 
  • sasmodels/model_test.py

    rb39bf3b rd8e81f7  
    247247                                           platform=self.platform) 
    248248                    # run the tests 
     249<<<<<<< HEAD 
    249250                    #self.info = ps_model.info 
    250251                    #print("SELF.INFO PARAMS!!!",[p.id for p in self.info.parameters.call_parameters]) 
    251252                    #print("PS MODEL PARAMETERS:",[p.id for p in ps_model.info.parameters.call_parameters]) 
     253======= 
     254>>>>>>> 2ed7de04217c5103c5fd8d7c14e29e04923269d5 
    252255                    results.append(self.run_one(ps_model, ps_test)) 
    253256 
     
    394397    invalid = [] 
    395398    for par in sorted(pars.keys()): 
    396         # special handling of R_eff mode, which is not a usual parameter 
     399        # Ignore the R_eff mode parameter when checking for valid parameters. 
     400        # It is an allowed parameter for a model even though it does not exist 
     401        # in the parameter table.  The call_Fq() function pops it from the 
     402        # parameter list and sends it directly to kernel.Fq(). 
    397403        if par == product.RADIUS_MODE_ID: 
    398             continue 
    399         if par == product.RADIUS_TYPE_ID: 
    400             continue 
    401         if par == product.STRUCTURE_MODE_ID: 
    402404            continue 
    403405        parts = par.split('_pd') 
  • sasmodels/product.py

    rb39bf3b rd8e81f7  
    3939STRUCTURE_MODE_ID = "structure_factor_mode" 
    4040RADIUS_MODE_ID = "radius_effective_mode" 
    41 # rkh add this to pass to model_test 
    42 RADIUS_TYPE_ID = "effective_radius_type" 
    4341RADIUS_ID = "radius_effective" 
    4442VOLFRAC_ID = "volfraction" 
  • sasmodels/models/sphere.py

    r2ed7de0 rb39bf3b  
    7575              ["sld_solvent", "1e-6/Ang^2", 6, [-inf, inf], "sld", 
    7676               "Solvent scattering length density"], 
    77               ["radius", "Ang", 50, [0, inf], "volume", 
     77              ["radius", "Ang", 45, [0, inf], "volume", 
    7878               "Sphere radius"], 
    7979             ] 
     
    9292 
    9393tests = [ 
    94     [{}, 0.2, 0.726362], 
    95     [{"scale": 1., "background": 0., "sld": 6., "sld_solvent": 1., 
    96       "radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 
    97      0.2, 0.2288431], 
    98     [{"radius": 120., "radius_pd": 0.02, "radius_pd_n":45}, 0.2, 
    99      # F1, F2, R_eff, volume, volume_ratio = call_Fq(kernel, pars) at q=0.2 
    100      792.0646662454202, 1166737.0473152, 120.0, 7246723.820358589, 1.0], 
    101     #  But note P(Q) = F2/volume+background,  F1 and F2 are vectors 
    102     #  BUT what is scaling of F1 ???  At low Pd F2 ~ F1^2 ? 
    103    [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 0.2, 
    104      # F1, F2, R_eff, volume, volume_ratio = call_Fq(kernel, pars) at q=0.2 
    105      1.233304061, 1850806.119736, 120.0, 8087664.1226, 1.0], 
    106     [{"@S": "hardsphere"}, 
    107        0.01, 55.881884232102124], # current value, not verified elsewhere yet 
    108     [{"@S": "hardsphere"}, 
    109        0.2, 0.14730859242492958], # current value, not verified elsewhere yet 
    110     [{"@S": "hardsphere"}, 
    111        0.1, 0.7940350343811906], # current value, not verified elsewhere yet 
    112     [{"@S": "hardsphere",        # hard sphere structure factor 
    113      "structure_factor_mode": 1, # decoupling approximation 
    114      "radius_effective_mode": 1, 
    115      # Currently have hardwired model_test to accept radius_effective 
    116      "radius_effective": 27.0, # equivalent sphere 
    117      # direct_model has the name & value BUT does it get passed to S(Q)??? 
    118      # What about volfracion, plus the many parameters used by other S(Q) ? 
     94   #  [{}, 0.2, 0.726362], 
     95   #  [{"scale": 1., "background": 0., "sld": 6., "sld_solvent": 1., 
     96   #    "radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 
     97   #   0.2, 0.2288431], 
     98   # [{"radius": 120., "radius_pd": 0.02, "radius_pd_n":45}, 
     99   #   0.2, 792.0646662454202, [1166737.0473152], 120.0, 7246723.820358589, 1.0], # the longer list here checks  F1, F2, R_eff, volume, volume_ratio = call_Fq(kernel, pars) 
     100   #  #          But note P(Q) = F2/volume,  F1 and F2 are vectors, for some reason only F2 needs square brackets 
     101   #  #          BUT what is scaling of F1 ???  At low Pd F2 ~ F1^2 ? 
     102   # [{"@S": "hardsphere"}, 
     103   #    0.01, 55.881884232102124], # this is current value, not verified elsewhere yet 
     104   # [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 
     105   #   0.2, 1.233304061, [1850806.119736], 120.0, 8087664.1226, 1.0], # the longer list here checks  F1, F2, R_eff, volume, volume_ratio = call_Fq(kernel, pars) 
     106   # [{"@S": "hardsphere"}, 
     107   #     0.2, 0.14730859242492958], #  this is current value, not verified elsewhere yet 
     108    # [{"@S": "hardsphere"}, 
     109    #    0.1, 0.7940350343811906], #  this is current value, not verified elsewhere yet 
     110    [{"@S": "hardsphere", 
     111     "radius": 120., "radius_pd": 0.2, "radius_pd_n":45, 
     112     "volfraction":0.2, 
     113     "radius_effective":45.0,        # hard sphere structure factor 
     114     "structure_factor_mode": 1,  # decoupling approximation 
     115     #"effective_radius_type": 1 # equivalent sphere   Currently have hardwired model_test to accept radius_effective 
     116     # direct_model has the name & value BUT does it get passed to S(Q)???  What about volfracion, plus the many parameters used by other S(Q) ? 
    119117     # effective_radius_type does NOT appear in the list, has it been stripped out??? 
    120      }, 0.1, 0.7940350343881906], 
    121 #    [{"@S": "hardsphere",          # hard sphere structure factor 
    122 #     "structure_factor_mode": 3,  #  -  WHY same result? 
    123 #     "effective_radius_type": 3, "radius_effective": 23.0    # 
    124 #     }, 0.1, 0.7940350343881906] 
     118     }, 0.01, 0.7940350343881906], 
     119        # [{"@S": "hardsphere",          # hard sphere structure factor 
     120    # "structure_factor_mode": 2,  #  -  WHY same result? 
     121    # "effective_radius_type": 2, "radius_effective":23.0    # 
     122        #  }, 0.1, 0.7940350343881906] 
    125123] 
    126 # putting None for expected result will pass the test if there are no errors 
    127 # from the routine, but without any check on the value of the result 
     124# putting None for expected result will pass the test if there are no errors from the routine, but without any check on the value of the result 
Note: See TracChangeset for help on using the changeset viewer.