Changeset b39bf3b in sasmodels
- Timestamp:
- Mar 28, 2019 11:46:52 AM (6 years ago)
- Branches:
- master, ticket-1257-vesicle-product, ticket_1156, ticket_822_more_unit_tests
- Children:
- d8e81f7
- Parents:
- f942f4d
- Location:
- sasmodels
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/direct_model.py
ra7db39fa rb39bf3b 61 61 #print("in call_kernel: pars:", list(zip(*mesh))[0]) 62 62 call_details, values, is_magnetic = make_kernel_args(calculator, mesh) 63 #print("in call_kernel: values:", values)63 print("in call_kernel: values:", values) 64 64 return calculator(call_details, values, cutoff, is_magnetic) 65 65 -
sasmodels/model_test.py
rf942f4d rb39bf3b 247 247 platform=self.platform) 248 248 # run the tests 249 self.info = ps_model.info249 #self.info = ps_model.info 250 250 #print("SELF.INFO PARAMS!!!",[p.id for p in self.info.parameters.call_parameters]) 251 251 #print("PS MODEL PARAMETERS:",[p.id for p in ps_model.info.parameters.call_parameters]) … … 307 307 """Run a single test case.""" 308 308 user_pars, x, y = test[:3] 309 pars = expand_pars(self.info.parameters, user_pars) 310 invalid = invalid_pars(self.info.parameters, pars) 309 print("PS MODEL PARAMETERS:",[p.id for p in model.info.parameters.call_parameters]) 310 pars = expand_pars(model.info.parameters, user_pars) 311 invalid = invalid_pars(model.info.parameters, pars) 311 312 if invalid: 312 313 raise ValueError("Unknown parameters in test: " + ", ".join(invalid)) -
sasmodels/models/sphere.py
ra430f5f rb39bf3b 49 49 ---------------------------- 50 50 51 * **Author:** 52 * **Last Modified by:** 51 * **Author:** 52 * **Last Modified by:** 53 53 * **Last Reviewed by:** S King and P Parker **Date:** 2013/09/09 and 2014/01/06 54 54 * **Source added by :** Steve King **Date:** March 25, 2019 … … 75 75 ["sld_solvent", "1e-6/Ang^2", 6, [-inf, inf], "sld", 76 76 "Solvent scattering length density"], 77 ["radius", "Ang", 50, [0, inf], "volume",77 ["radius", "Ang", 45, [0, inf], "volume", 78 78 "Sphere radius"], 79 79 ] … … 92 92 93 93 tests = [ 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 [{"radius": 120., "radius_pd": 0.2, "radius_pd_n":45}, 103 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) 104 [{"@S": "hardsphere"}, 105 0.01, 55.881884232102124], # this is current value, not verified elsewhere yet 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", # hard sphere structure factor 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 111 114 "structure_factor_mode": 1, # decoupling approximation 112 "effective_radius_type": 1, "radius_effective":27.0 # equivalent sphere Currently have hardwired model_test to accept radius_effective115 #"effective_radius_type": 1 # equivalent sphere Currently have hardwired model_test to accept radius_effective 113 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) ? 114 117 # effective_radius_type does NOT appear in the list, has it been stripped out??? 115 }, 0.1, 0.7940350343881906],116 #[{"@S": "hardsphere", # hard sphere structure factor117 # "structure_factor_mode": 3, # - WHY same result?118 # "effective_radius_type": 3, "radius_effective":23.0 # 119 #}, 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] 120 123 ] 121 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 -
sasmodels/product.py
r0b8a1fc rb39bf3b 284 284 # unless the model doesn't support beta mode, in which case it is first 285 285 have_radius_type = p_info.effective_radius_type is not None 286 #print(p_npars,s_npars) 286 287 radius_type_offset = 2+p_npars+s_npars + (1 if have_beta_mode else 0) 288 print(values[radius_type_offset]) 287 289 radius_type = int(values[radius_type_offset]) if have_radius_type else 0 288 290 … … 342 344 # polydispersity distribution slot in the values array due to 343 345 # implementation details in kernel_iq.c. 344 #print("R_eff=%d:%g, volfrac=%g, volume ratio=%g"345 #% (radius_type, effective_radius, volfrac, volume_ratio))346 print("R_eff=%d:%g, volfrac=%g, volume ratio=%g" 347 % (radius_type, effective_radius, volfrac, volume_ratio)) 346 348 if radius_type > 0: 347 349 # set the value to the model R_eff and set the weight to 1 … … 358 360 359 361 # Combine form factor and structure factor 360 #print("beta", beta_mode, F1, F2, S)362 print("beta", beta_mode, F1, F2, S) 361 363 PS = F2 + F1**2*(S-1) if beta_mode else F2*S 362 364 final_result = combined_scale*PS + background
Note: See TracChangeset
for help on using the changeset viewer.