Changes in explore/beta/sasfit_compare.py [cdd676e:01c8d9e] in sasmodels
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
explore/beta/sasfit_compare.py
rcdd676e r01c8d9e 1 1 from __future__ import division, print_function 2 2 # Make sasmodels available on the path 3 import sys, 3 import sys,os 4 4 BETA_DIR = os.path.dirname(os.path.realpath(__file__)) 5 SASMODELS_DIR = os.path.dirname(os.path.dirname(BETA_DIR)) 5 #SASMODELS_DIR = os.path.dirname(os.path.dirname(BETA_DIR)) 6 SASMODELS_DIR = r"C:\Source\sasmodels" 6 7 sys.path.insert(0, SASMODELS_DIR) 7 8 import os 8 9 from collections import namedtuple 9 10 … … 61 62 calculator = DirectModel(data, model,cutoff=0) 62 63 calculator.pars = pars.copy() 63 calculator.pars.setdefault('background', 1e-3)64 calculator.pars.setdefault('background', 0) 64 65 return calculator 65 66 … … 222 223 if radius_effective is None: 223 224 radius_effective = radius_eff/total_weight 225 print("this is the effective radius for pure python",radius_effective) 224 226 if norm == 'sasfit': 225 227 IQD = F2 … … 230 232 # = F2/total_weight / total_volume/total_weight 231 233 # = F2/total_volume 234 232 235 IQD = F2/average_volume*1e-4*volfraction 236 F1 *= 1e-2 # Yun is using sld in 1/A^2, not 1e-6/A^2 237 F2 *= 1e-4 233 238 elif norm == 'yun': 234 239 F1 *= 1e-6 # Yun is using sld in 1/A^2, not 1e-6/A^2 … … 240 245 IQSD = IQD*SQ 241 246 IQBD = IQD*SQ_EFF 247 print("\n\n\n\n\n this is F1" + str(F1)) 248 249 print("\n\n\n\n\n this is F2" + str(F2)) 250 print("\n\n\n\n\n this is SQ" + str(SQ)) 242 251 return Theory(Q=q, F1=F1, F2=F2, P=IQD, S=SQ, I=IQSD, Seff=SQ_EFF, Ibeta=IQBD) 243 252 … … 331 340 Ipars.setdefault(k.replace("_pd_type", "_pd_nsigma"), nsigmas) 332 341 342 333 343 #Ppars['scale'] = Spars.get('volfraction', 1) 334 344 P = build_model(Pname, q) … … 336 346 I = build_model(Pname+"@hardsphere", q) 337 347 Pq = P(**Ppars)*pars.get('volfraction', 1) 338 #Sq = S(**Spars)348 Sq = S(**Spars) 339 349 Iq = I(**Ipars) 340 350 #Iq = Pq*Sq*pars.get('volfraction', 1) 341 Sq = Iq/Pq 342 return Theory(Q=q, F1=None, F2=None, P=Pq, S=Sq, I=Iq, Seff=None, Ibeta=None) 351 #Sq = Iq/Pq 352 #Iq = None#= Sq = None 353 r=I._kernel.results 354 return Theory(Q=q, F1=None, F2=None, P=Pq, S=None, I=None, Seff=r[1], Ibeta=Iq) 343 355 344 356 def compare(title, target, actual, fields='F1 F2 P S I Seff Ibeta'): … … 400 412 radius_equatorial_pd=.1, radius_equatorial_pd_type=pd_type, 401 413 volfraction=0.15, 414 radius_effective=270.7543927018, 402 415 #radius_effective=12.59921049894873, 403 416 ) 404 target = sasmodels_theory(q, model, **pars)417 target = sasmodels_theory(q, model, beta_mode=1, **pars) 405 418 actual = ellipsoid_pe(q, norm='sasview', **pars) 419 print(actual) 406 420 title = " ".join(("sasmodels", model, pd_type)) 407 421 compare(title, target, actual) … … 446 460 Q = data[0] 447 461 F1 = data[1] 448 F2 = data[2]449 462 P = data[3] 450 463 S = data[5] 451 464 Seff = data[6] 452 target = Theory(Q=Q, F1=F1, F2=F2,P=P, S=S, Seff=Seff)465 target = Theory(Q=Q, F1=F1, P=P, S=S, Seff=Seff) 453 466 actual = sphere_r(Q, norm='yun', **pars) 454 467 title = " ".join(("yun", "sphere", "10% dispersion 10% Vf")) … … 458 471 Q = data[0] 459 472 F1 = data[1] 460 F2 = data[2]461 473 P = data[3] 462 474 S = data[5] 463 475 Seff = data[6] 464 target = Theory(Q=Q, F1=F1, F2=F2,P=P, S=S, Seff=Seff)476 target = Theory(Q=Q, F1=F1, P=P, S=S, Seff=Seff) 465 477 actual = sphere_r(Q, norm='yun', **pars) 466 478 title = " ".join(("yun", "sphere", "15% dispersion 10% Vf"))
Note: See TracChangeset
for help on using the changeset viewer.