Changeset 40a87fa in sasmodels for sasmodels/models/two_power_law.py
- Timestamp:
- Aug 8, 2016 11:24:11 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:
- 2472141
- Parents:
- 2d65d51
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/two_power_law.py
r2c74c11 r40a87fa 14 14 where $q_c$ = the location of the crossover from one slope to the other, 15 15 $A$ = the scaling coefficent that sets the overall intensity of the lower Q 16 power law region, $m1$ = power law exponent at low Q, and $m2$ = power law 16 power law region, $m1$ = power law exponent at low Q, and $m2$ = power law 17 17 exponent at high Q. The scaling of the second power law region (coefficent C) 18 18 is then automatically scaled to match the first by following formula: … … 62 62 category = "shape-independent" 63 63 64 # ["name", "units", default, [lower, upper], "type", "description"], 65 parameters = [["coefficent_1", "", 1.0, [-inf, inf], "", 66 "coefficent A in low Q region"], 67 ["crossover", "1/Ang", 0.04,[0, inf], "", 68 "crossover location"], 69 ["power_1", "", 1.0, [0, inf], "", 70 "power law exponent at low Q"], 71 ["power_2", "", 4.0, [0, inf], "", 72 "power law exponent at high Q"], 73 ] 64 # pylint: disable=bad-whitespace, line-too-long 65 # ["name", "units", default, [lower, upper], "type", "description"], 66 parameters = [ 67 ["coefficent_1", "", 1.0, [-inf, inf], "", "coefficent A in low Q region"], 68 ["crossover", "1/Ang", 0.04,[0, inf], "", "crossover location"], 69 ["power_1", "", 1.0, [0, inf], "", "power law exponent at low Q"], 70 ["power_2", "", 4.0, [0, inf], "", "power law exponent at high Q"], 71 ] 72 # pylint: enable=bad-whitespace, line-too-long 74 73 75 74 … … 89 88 :return: Calculated intensity 90 89 """ 91 iq= empty(q.shape, 'd')92 i dx = (q <= crossover)90 result= empty(q.shape, 'd') 91 index = (q <= crossover) 93 92 with errstate(divide='ignore'): 94 93 coefficent_2 = coefficent_1 * power(crossover, power_2 - power_1) 95 iq[idx] = coefficent_1 * power(q[idx], -power_1)96 iq[~idx] = coefficent_2 * power(q[~idx], -power_2)97 return iq94 result[index] = coefficent_1 * power(q[index], -power_1) 95 result[~index] = coefficent_2 * power(q[~index], -power_2) 96 return result 98 97 99 98 Iq.vectorized = True # Iq accepts an array of q values
Note: See TracChangeset
for help on using the changeset viewer.