Changeset b6422c7 in sasmodels
 Timestamp:
 Mar 25, 2019 1:06:41 PM (2 months ago)
 Branches:
 master, core_shell_microgels, magnetic_model, ticket1257vesicleproduct, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
 Children:
 0507e09
 Parents:
 2fe39d1
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

explore/beta/sasfit_compare_new.py
r6916174 rb6422c7 21 21 #Used to calculate F(q) for the cylinder, sphere, ellipsoid models 22 22 # RKH adding vesicle and hollow_cylinder to test sasview special cases of ER and VR 23 # BEWARE there are issues here if you run this from python3 (i.e. qt5 version of sasview), so do "source activate sasview"23 # There were issues here from python3 (i.e. qt5 version of sasview),fixed by Paul K (else do "source activate sasview") 24 24 def sas_sinx_x(x): 25 25 with np.errstate(all='ignore'): … … 275 275 if radius_effective is None: 276 276 radius_effective = radius 277 print("radius_effective ",radius_effective)278 277 average_volume = total_volume/total_weight 279 278 if norm == 'sasfit': … … 285 284 F2 *= 1e12 286 285 IQD = F2/average_volume*1e8*volfraction 286 print("in sphere_r : radius_effective ",radius_effective," volfraction",volfraction) 287 287 SQ = hardsphere_simple(q, radius_effective, volfraction) 288 288 beta = F1**2/F2 … … 332 332 if radius_effective is None: 333 333 radius_effective = radius_eff/total_weight 334 print(" radius_effective ",radius_effective)334 print("in vesicle_pe : radius_effective ",radius_effective) 335 335 if norm == 'sasfit': 336 336 IQD = F2 … … 348 348 F2 *= 1e12 349 349 IQD = F2/average_volume*1e8*volfraction 350 # RKH SORT THIS OUT WHEN HAVE NEW MODEL 351 vfff=volfraction*( 30./20.)**3352 print(" radius_effective, fudged volfaction for S(Q) ",radius_effective,vfff)350 # RKH SORT THIS OUT WHEN HAVE NEW MODEL Vtot/Vshell = (R+T)^3/ ( (R+T)^3 R^3 ) 351 vfff=volfraction*( 1.0/(1.0  ( (radius/(radius+thickness))**3 ))) 352 print("in vesicle_pe : radius_effective, fudged volfraction for S(Q) ",radius_effective,vfff) 353 353 SQ = hardsphere_simple(q, radius_effective, vfff) 354 354 beta = F1**2/F2 … … 359 359 # 360 360 #polydispersity for hollow_cylinder 361 def hollow_cylinder_pe(q,radius=20, thickness=10, sld=4, sld_solvent=1, volfraction=0.15,362 radius_pd=0.1, thickness_pd=0.2, length_pd=0.05, radius_pd_type="gaussian", thickness_pd_type="gaussian",363 radius_effective=None, background=0, scale=1,361 def hollow_cylinder_pe(q,radius=20, thickness=10, length=80, sld=4, sld_solvent=1, volfraction=0.15, 362 radius_pd=0.1, thickness_pd=0.2, length_pd=0.05, radius_pd_type="gaussian", length_pd_type="gaussian", 363 thickness_pd_type="gaussian", radius_effective=None, background=0, scale=1, 364 364 norm='sasview'): 365 365 if norm not in ['sasview', 'sasfit', 'yun']: … … 374 374 T_val, T_prob = schulz_distribution(thickness, thickness_pd*thickness, 0, inf) 375 375 if length_pd_type == 'gaussian': 376 T_val, T_prob = gaussian_distribution(length, length_pd*length, 0, inf)376 L_val, L_prob = gaussian_distribution(length, length_pd*length, 0, inf) 377 377 elif length_pd_type == 'schulz': 378 378 L_val, L_prob = schulz_distribution(length, length_pd*length, 0, inf) … … 402 402 if radius_effective is None: 403 403 radius_effective = radius_eff/total_weight 404 print(" radius_effective ",radius_effective)404 print("in hollow_cylinder : radius_effective ",radius_effective) 405 405 if norm == 'sasfit': 406 406 IQD = F2 … … 420 420 # RKH SORT THIS OUT WHEN HAVE NEW MODEL 421 421 vfff=volfraction 422 print(" radius_effective, volfaction for S(Q) ",radius_effective,vfff)422 print("in hollow_cylinder : radius_effective, volfaction for S(Q) ",radius_effective,vfff) 423 423 SQ = hardsphere_simple(q, radius_effective, vfff) 424 424 beta = F1**2/F2 … … 548 548 #Iq = None#= Sq = None 549 549 r = dict(I._kernel.results()) 550 #print(r)550 print(r) 551 551 return Theory(Q=q, F1=None, F2=None, P=Pq, S=None, I=None, Seff=r["S_eff(Q)"], Ibeta=Iq) 552 552 … … 591 591 radius_pd=.1, radius_pd_type=pd_type, 592 592 volfraction=0.15, 593 radius_effective=12.59921049894873, # equivalent average sphere radius 593 radius_effective=20 # equivalent average sphere radius 594 # NOTE sasview computes its own radius_effective in "target" (the print(r) at end of sasmodels_theory will reveal its value), 595 # this one is only used locally for "actual" 594 596 ) 595 597 target = sasmodels_theory(q, model, effective_radius_mode=0, structure_factor_mode=1, **pars) … … 604 606 q = np.logspace(5, 0, 250) 605 607 model = 'vesicle' 606 print("F2 seems OK, but big issues with S(Q), wo work in progress")607 # NOTE parame ers for vesicle model are soon to be changed to remove "volfraction"608 print("F2 seems OK, but big issues with S(Q), so work in progress") 609 # NOTE parameters for vesicle model are soon to be changed to remove "volfraction" (though still there in 5.0) 608 610 pars = dict( 609 611 radius=20, thickness=10, sld=4, sld_solvent=1, volfraction=0.03, 610 612 background=0, 611 radius_pd=0.1, thickness_pd=0.0, radius_pd_type=pd_type, thickness_pd_type=pd_type 612 #,radius_effective=12.59921049894873, # equivalent average sphere radius 613 ) 613 radius_pd=0.01, thickness_pd=0.01, radius_pd_type=pd_type, thickness_pd_type=pd_type, 614 radius_effective=30. ) 615 # equivalent average sphere radius for local "actual" to match what sasview uses, use None to compute average outer radius here, 616 614 617 target = sasmodels_theory(q, model, effective_radius_mode=0, structure_factor_mode=1, **pars) 615 618 actual = vesicle_pe(q, norm='sasview', **pars) … … 629 632 radius=20, thickness=10, length=80, sld=4, sld_solvent=1, 630 633 background=0, 631 radius_pd=0.1, thickness_pd=0.0, length_pd=0.0, radius_pd_type=pd_type, thickness_pd_type=pd_type, length_pd_type=pd_type 632 #,radius_effective=12.59921049894873, # equivalent average sphere radius633 )634 radius_pd=0.1, thickness_pd=0.0, length_pd=0.0, radius_pd_type=pd_type, thickness_pd_type=pd_type, length_pd_type=pd_type, 635 radius_effective=40.687) 636 # equivalent average sphere radius for local "actual" to match what sasview uses 634 637 target = sasmodels_theory(q, model, effective_radius_mode=0, structure_factor_mode=1, **pars) 635 638 actual = hollow_cylinder_pe(q, norm='sasview', **pars) … … 651 654 volfraction=0.15, 652 655 radius_effective=270.7543927018, 653 #radius_effective=12.59921049894873, 656 # if change radius_effective to some other value, the S(Q) from sasview does not agree 654 657 ) 655 658 target = sasmodels_theory(q, model, effective_radius_mode=0, structure_factor_mode=1, **pars)
Note: See TracChangeset
for help on using the changeset viewer.