Changeset a807206 in sasmodels for sasmodels/models/guinier_porod.py
- Timestamp:
- Sep 30, 2016 10:42:06 PM (8 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- caddb14, 5031ca3
- Parents:
- 2222134
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/guinier_porod.py
r40a87fa ra807206 72 72 description = """\ 73 73 I(q) = scale/q^s* exp ( - R_g^2 q^2 / (3-s) ) for q<= ql 74 = scale/q^ m*exp((-ql^2*Rg^2)/(3-s))*ql^(m-s) for q>=ql75 where ql = sqrt(( m-s)(3-s)/2)/Rg.74 = scale/q^porod_exp*exp((-ql^2*Rg^2)/(3-s))*ql^(porod_exp-s) for q>=ql 75 where ql = sqrt((porod_exp-s)(3-s)/2)/Rg. 76 76 List of parameters: 77 77 scale = Guinier Scale 78 78 s = Dimension Variable 79 79 Rg = Radius of Gyration [A] 80 m= Porod Exponent80 porod_exp = Porod Exponent 81 81 background = Background [1/cm]""" 82 82 … … 87 87 parameters = [["rg", "Ang", 60.0, [0, inf], "", "Radius of gyration"], 88 88 ["s", "", 1.0, [0, inf], "", "Dimension variable"], 89 [" m", "", 3.0, [0, inf], "", "Porod exponent"]]89 ["porod_exp", "", 3.0, [0, inf], "", "Porod exponent"]] 90 90 # pylint: enable=bad-whitespace, line-too-long 91 91 92 92 # pylint: disable=C0103 93 def Iq(q, rg, s, m):93 def Iq(q, rg, s, porod_exp): 94 94 """ 95 95 @param q: Input q-value 96 96 """ 97 97 n = 3.0 - s 98 ms = 0.5*( m-s) # =(n-3+m)/298 ms = 0.5*(porod_exp-s) # =(n-3+porod_exp)/2 99 99 100 100 # preallocate return value … … 109 109 with errstate(divide='ignore'): 110 110 iq[idx] = q[idx]**-s * exp(-(q[idx]*rg)**2/n) 111 iq[~idx] = q[~idx]**- m* (exp(-ms) * (n*ms/rg**2)**ms)111 iq[~idx] = q[~idx]**-porod_exp * (exp(-ms) * (n*ms/rg**2)**ms) 112 112 return iq 113 113 114 114 Iq.vectorized = True # Iq accepts an array of q values 115 115 116 demo = dict(scale=1.5, background=0.5, rg=60, s=1.0, m=3.0)116 demo = dict(scale=1.5, background=0.5, rg=60, s=1.0, porod_exp=3.0) 117 117 118 118 tests = [[{'scale': 1.5, 'background':0.5}, 0.04, 5.290096890253155]]
Note: See TracChangeset
for help on using the changeset viewer.