Changeset 513efc5 in sasmodels for sasmodels/models/two_lorentzian.py
- Timestamp:
- Jan 20, 2016 2:50:50 AM (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:
- 7ed702f
- Parents:
- 30b4ddf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/two_lorentzian.py
r421e55c r513efc5 1 1 r""" 2 This model calculates an empirical functional form for SAS data characterized by two Lorentzian-type functions. 2 This model calculates an empirical functional form for SAS data characterized 3 by two Lorentzian-type functions. 3 4 4 5 Definition … … 12 13 13 14 where $A$ = Lorentzian scale factor #1, $C$ = Lorentzian scale #2, 14 $\xi_1$ and $\xi_2$ are the corresponding correlation lengths, and $n$ and $m$ are the respective 15 power law exponents (set $n = m = 2$ for Ornstein-Zernicke behaviour). 15 $\xi_1$ and $\xi_2$ are the corresponding correlation lengths, and $n$ and 16 $m$ are the respective power law exponents (set $n = m = 2$ for 17 Ornstein-Zernicke behaviour). 16 18 17 19 For 2D data the scattering intensity is calculated in the same way as 1D, … … 52 54 category = "shape-independent" 53 55 54 # ["name", "units", default, [lower, upper], "type", "description"], 55 parameters = [["lorentz_scale_1", "", 10.0, [-inf, inf], "", "First power law scale factor"], 56 ["lorentz_length_1", "Ang", 100.0, [-inf, inf], "", "First Lorentzian screening length"], 57 ["lorentz_exp_1", "", 3.0, [-inf, inf], "", "First exponent of power law"], 58 ["lorentz_scale_2", "", 1.0, [-inf, inf], "", "Second scale factor for broad Lorentzian peak"], 59 ["lorentz_length_2", "Ang", 10.0, [-inf, inf], "", "Second Lorentzian screening length"], 60 ["lorentz_exp_2", "", 2.0, [-inf, inf], "", "Second exponent of power law"], 56 # ["name", "units", default, [lower, upper], "type", "description"], 57 parameters = [["lorentz_scale_1", "", 10.0, [-inf, inf], "", 58 "First power law scale factor"], 59 ["lorentz_length_1", "Ang", 100.0, [-inf, inf], "", 60 "First Lorentzian screening length"], 61 ["lorentz_exp_1", "", 3.0, [-inf, inf], "", 62 "First exponent of power law"], 63 ["lorentz_scale_2", "", 1.0, [-inf, inf], "", 64 "Second scale factor for broad Lorentzian peak"], 65 ["lorentz_length_2", "Ang", 10.0, [-inf, inf], "", 66 "Second Lorentzian screening length"], 67 ["lorentz_exp_2", "", 2.0, [-inf, inf], "", 68 "Second exponent of power law"], 61 69 ] 62 70 63 71 64 def Iq(q, lorentz_scale_1, lorentz_length_1, lorentz_exp_1, lorentz_scale_2, lorentz_length_2, lorentz_exp_2): 72 def Iq(q, 73 lorentz_scale_1, 74 lorentz_length_1, 75 lorentz_exp_1, 76 lorentz_scale_2, 77 lorentz_length_2, 78 lorentz_exp_2): 65 79 66 80 """ … … 75 89 """ 76 90 77 intensity = lorentz_scale_1/(1.0 + power(q*lorentz_length_1, lorentz_exp_1)) 78 intensity += lorentz_scale_2/(1.0 + power(q*lorentz_length_2, lorentz_exp_2)) 91 intensity = lorentz_scale_1/(1.0 + 92 power(q*lorentz_length_1, lorentz_exp_1)) 93 intensity += lorentz_scale_2/(1.0 + 94 power(q*lorentz_length_2, lorentz_exp_2)) 79 95 80 96 return intensity … … 101 117 lorentz_exp_1='exponent_1', lorentz_exp_2='exponent_2') 102 118 103 tests = [[{'lorentz_scale_1': 10, 'lorentz_length_1': 100.0, 'lorentz_exp_1' : 3.0, 104 'lorentz_scale_2': 1, 'lorentz_length_2': 10.0, 'lorentz_exp_2' : 2.0, 119 tests = [[{'lorentz_scale_1': 10.0, 120 'lorentz_length_1': 100.0, 121 'lorentz_exp_1': 3.0, 122 'lorentz_scale_2': 1.0, 123 'lorentz_length_2': 10.0, 124 'lorentz_exp_2': 2.0, 105 125 }, 0.000332070182643, 10.9996228107], 106 126 107 [{'lorentz_scale_1': 0, 'lorentz_length_1': 0.0, 'lorentz_exp_1' : 0.0, 108 'lorentz_scale_2': 0, 'lorentz_length_2': 0.0, 'lorentz_exp_2' : 0.0, 109 'background':100. 127 [{'lorentz_scale_1': 0.0, 128 'lorentz_length_1': 0.0, 129 'lorentz_exp_1': 0.0, 130 'lorentz_scale_2': 0.0, 131 'lorentz_length_2': 0.0, 132 'lorentz_exp_2': 0.0, 133 'background': 100.0 110 134 }, 5.0, 100.0], 111 135 112 [{'lorentz_scale_1': 200, 'lorentz_length_1': 10.0, 'lorentz_exp_1' : 0.1, 113 'lorentz_scale_2': 0.1, 'lorentz_length_2': 5.0, 'lorentz_exp_2' : 2.0 136 [{'lorentz_scale_1': 200.0, 137 'lorentz_length_1': 10.0, 138 'lorentz_exp_1': 0.1, 139 'lorentz_scale_2': 0.1, 140 'lorentz_length_2': 5.0, 141 'lorentz_exp_2': 2.0 114 142 }, 20000., 45.5659201896], 115 143 ]
Note: See TracChangeset
for help on using the changeset viewer.