Changeset a151caa in sasmodels for sasmodels/models/core_multi_shell.py


Ignore:
Timestamp:
Jul 28, 2017 10:49:09 PM (7 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
404ebbd
Parents:
0bdddc2
Message:

tuned random model generator for be_polyelectrolyte, barbell, core multishell, core-shell bicelle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/core_multi_shell.py

    r5a0b3d7 ra151caa  
    7070        sld_shell: the SLD of the shell# 
    7171        A_shell#: the coefficient in the exponential function 
    72          
    73          
     72 
     73 
    7474    scale: 1.0 if data is on absolute scale 
    7575    volfraction: volume fraction of spheres 
     
    102102 
    103103source = ["lib/sas_3j1x_x.c", "core_multi_shell.c"] 
     104 
     105def random(): 
     106    import numpy as np 
     107    num_shells = np.minimum(np.random.poisson(3)+1, 10) 
     108    total_radius = 10**np.random.uniform(1.7, 4) 
     109    thickness = np.random.exponential(size=num_shells+1) 
     110    thickness *= total_radius/np.sum(thickness) 
     111    volume_fraction = 10**np.random.uniform(-4, -1) 
     112    pars = dict( 
     113        #background=0, 
     114        scale=volume_fraction/total_radius**3*1e10, 
     115        n=num_shells, 
     116        radius=thickness[0], 
     117    ) 
     118    for k, v in enumerate(thickness[1:]): 
     119        pars['thickness%d'%(k+1)] = v 
     120    return pars 
    104121 
    105122def profile(sld_core, radius, sld_solvent, n, sld, thickness): 
Note: See TracChangeset for help on using the changeset viewer.