Changeset 142a8e2 in sasmodels for sasmodels/models/multilayer_vesicle.py


Ignore:
Timestamp:
Sep 5, 2017 10:17:49 AM (7 years ago)
Author:
GitHub <noreply@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
c11d09f, 3a45c2c, 95468ca
Parents:
2ead7e2 (diff), 34fbbae (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
git-author:
Paul Butler <butlerpd@…> (09/05/17 10:17:49)
git-committer:
GitHub <noreply@…> (09/05/17 10:17:49)
Message:

Merge pull request #45 from SasView?/simulation

Simulation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sasmodels/models/multilayer_vesicle.py

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