Changeset 8f04da4 in sasmodels for sasmodels/models/multilayer_vesicle.py


Ignore:
Timestamp:
Aug 2, 2017 2:53:56 AM (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:
bd21b12
Parents:
1511c37c
Message:

tuned random model generation for more models

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/multilayer_vesicle.py

    r5d23de2 r8f04da4  
    149149    return radius + n_shells * (thick_shell + thick_solvent) - thick_solvent 
    150150 
    151 demo = dict(scale=1, background=0, 
    152             volfraction=0.05, 
    153             radius=60.0, 
    154             thick_shell=10.0, 
    155             thick_solvent=10.0, 
    156             sld_solvent=6.4, 
    157             sld=0.4, 
    158             n_shells=2.0) 
     151def random(): 
     152    import numpy as np 
     153    volfraction = 10**np.random.uniform(-3, -0.5)  # scale from 0.1% to 30% 
     154    radius = 10**np.random.uniform(0, 2.5) # core less than 300 A 
     155    total_thick = 10**np.random.uniform(2, 4) # up to 10000 A of shells 
     156    # random number of shells, with shell+solvent thickness > 10 A 
     157    n_shells = int(10**np.random.uniform(0, np.log10(total_thick)-1)+0.5) 
     158    # split total shell thickness with preference for shell over solvent; 
     159    # make sure that shell thickness is at least 1 A 
     160    one_thick = total_thick/n_shells 
     161    thick_solvent = 10**np.random.uniform(-2, 0)*(one_thick - 1) 
     162    thick_shell = one_thick - thick_solvent 
     163    pars = dict( 
     164        scale=1, 
     165        volfraction=volfraction, 
     166        radius=radius, 
     167        thick_shell=thick_shell, 
     168        thick_solvent=thick_solvent, 
     169        n_shells=n_shells, 
     170    ) 
     171    return pars 
    159172 
    160173tests = [ 
Note: See TracChangeset for help on using the changeset viewer.