Changeset a807206 in sasmodels for sasmodels/models/gauss_lorentz_gel.py
- Timestamp:
- Sep 30, 2016 10:42:06 PM (7 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/gauss_lorentz_gel.py
r40a87fa ra807206 56 56 # pylint: disable=bad-whitespace, line-too-long 57 57 # ["name", "units", default, [lower, upper], "type", "description"], 58 parameters = [["gauss_scale _factor", "", 100.0, [-inf, inf], "", "Gauss scale factor"],59 [" static_cor_length", "Ang", 100.0, [0, inf], "", "Static correlation length"],60 ["lorentz_scale _factor", "", 50.0, [-inf, inf], "", "Lorentzian scale factor"],61 [" dynamic_cor_length", "Ang", 20.0, [0, inf], "", "Dynamic correlation length"],58 parameters = [["gauss_scale", "", 100.0, [-inf, inf], "", "Gauss scale factor"], 59 ["cor_length_static", "Ang", 100.0, [0, inf], "", "Static correlation length"], 60 ["lorentz_scale", "", 50.0, [-inf, inf], "", "Lorentzian scale factor"], 61 ["cor_length_dynamic", "Ang", 20.0, [0, inf], "", "Dynamic correlation length"], 62 62 ] 63 63 # pylint: enable=bad-whitespace, line-too-long 64 64 65 65 def Iq(q, 66 gauss_scale _factor=100.0,67 static_cor_length=100.0,68 lorentz_scale _factor=50.0,69 dynamic_cor_length=20.0):66 gauss_scale=100.0, 67 cor_length_static=100.0, 68 lorentz_scale=50.0, 69 cor_length_dynamic=20.0): 70 70 """ 71 71 72 72 :param q: Input q-value 73 :param gauss_scale _factor: Gauss scale factor74 :param static_cor_length: Static correlation length75 :param lorentz_scale _factor: Lorentzian scale factor76 :param dynamic_cor_length: Dynamic correlation length73 :param gauss_scale: Gauss scale factor 74 :param cor_length_static: Static correlation length 75 :param lorentz_scale: Lorentzian scale factor 76 :param cor_length_dynamic: Dynamic correlation length 77 77 :return: 1-D intensity 78 78 """ 79 79 80 term1 = gauss_scale _factor*\81 exp(-1.0*q*q* static_cor_length*static_cor_length/2.0)82 term2 = lorentz_scale _factor/\83 (1.0+(q* dynamic_cor_length)*(q*dynamic_cor_length))80 term1 = gauss_scale *\ 81 exp(-1.0*q*q*cor_length_static*cor_length_static/2.0) 82 term2 = lorentz_scale /\ 83 (1.0+(q*cor_length_dynamic)*(q*cor_length_dynamic)) 84 84 85 85 return term1 + term2 … … 89 89 90 90 demo = dict(scale=1, background=0.1, 91 gauss_scale _factor=100.0,92 static_cor_length=100.0,93 lorentz_scale _factor=50.0,94 dynamic_cor_length=20.0)91 gauss_scale=100.0, 92 cor_length_static=100.0, 93 lorentz_scale=50.0, 94 cor_length_dynamic=20.0) 95 95 96 96 tests = [ 97 97 98 98 # Accuracy tests based on content in test/utest_extra_models.py 99 [{'gauss_scale _factor': 100.0,100 ' static_cor_length': 100.0,101 'lorentz_scale _factor': 50.0,102 ' dynamic_cor_length': 20.0,99 [{'gauss_scale': 100.0, 100 'cor_length_static': 100.0, 101 'lorentz_scale': 50.0, 102 'cor_length_dynamic': 20.0, 103 103 }, 0.001, 149.482], 104 104 105 [{'gauss_scale _factor': 100.0,106 ' static_cor_length': 100.0,107 'lorentz_scale _factor': 50.0,108 ' dynamic_cor_length': 20.0,105 [{'gauss_scale': 100.0, 106 'cor_length_static': 100.0, 107 'lorentz_scale': 50.0, 108 'cor_length_dynamic': 20.0, 109 109 }, 0.105363, 9.1913], 110 110 111 [{'gauss_scale _factor': 100.0,112 ' static_cor_length': 100.0,113 'lorentz_scale _factor': 50.0,114 ' dynamic_cor_length': 20.0,111 [{'gauss_scale': 100.0, 112 'cor_length_static': 100.0, 113 'lorentz_scale': 50.0, 114 'cor_length_dynamic': 20.0, 115 115 }, 0.441623, 0.633811], 116 116 117 117 # Additional tests with larger range of parameters 118 [{'gauss_scale _factor': 10.0,119 ' static_cor_length': 100.0,120 'lorentz_scale _factor': 3.0,121 ' dynamic_cor_length': 1.0,118 [{'gauss_scale': 10.0, 119 'cor_length_static': 100.0, 120 'lorentz_scale': 3.0, 121 'cor_length_dynamic': 1.0, 122 122 }, 0.1, 2.9712970297], 123 123 124 [{'gauss_scale _factor': 10.0,125 ' static_cor_length': 100.0,126 'lorentz_scale _factor': 3.0,127 ' dynamic_cor_length': 1.0,124 [{'gauss_scale': 10.0, 125 'cor_length_static': 100.0, 126 'lorentz_scale': 3.0, 127 'cor_length_dynamic': 1.0, 128 128 'background': 100.0 129 129 }, 5.0, 100.116384615], 130 130 131 [{'gauss_scale _factor': 10.0,132 ' static_cor_length': 100.0,133 'lorentz_scale _factor': 3.0,134 ' dynamic_cor_length': 1.0,131 [{'gauss_scale': 10.0, 132 'cor_length_static': 100.0, 133 'lorentz_scale': 3.0, 134 'cor_length_dynamic': 1.0, 135 135 'background': 0.0, 136 136 }, 200., 7.49981250469e-05],
Note: See TracChangeset
for help on using the changeset viewer.