Changeset 31df0c9 in sasmodels for sasmodels/models/barbell.py
- Timestamp:
- Aug 1, 2017 4:38:47 PM (7 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 1511c37c
- Parents:
- d49ca5c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/barbell.py
ra151caa r31df0c9 117 117 def random(): 118 118 import numpy as np 119 # TODO: increase volume range once problem with bell radius is fixed 120 # The issue is that bell radii of more than about 200 fail at high q 121 V = 10**np.random.uniform(7, 9) 122 bar_volume = 10**np.random.uniform(-4, -1)*V 123 bell_volume = V - bar_volume 124 bell_radius = (bell_volume/6)**0.3333 # approximate 125 min_bar = bar_volume/np.pi/bell_radius**2 126 bar_length = 10**np.random.uniform(0, 3)*min_bar 127 bar_radius = np.sqrt(bar_volume/bar_length/np.pi) 128 if bar_radius > bell_radius: 129 bell_radius, bar_radius = bar_radius, bell_radius 119 130 pars = dict( 120 scale=10**np.random.uniform(-4,-1), 121 radius_bell=10**np.random.uniform(1.3,3), 122 length=10**np.random.uniform(0,3), 131 #background=0, 132 radius_bell=bell_radius, 133 radius=bar_radius, 134 length=bar_length, 123 135 ) 124 pars['radius'] = pars['radius_bell']*np.random.uniform(0,1)125 if pars['radius_bell'] < 100:126 pars['length'] *= 10127 pars['scale'] *= 100128 136 return pars 129 137
Note: See TracChangeset
for help on using the changeset viewer.