Changeset 841753c in sasmodels for sasmodels/models/power_law.py
- Timestamp:
- Jan 28, 2016 5:42:34 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:
- d4666ca
- Parents:
- 69ec80f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/power_law.py
reb69cce r841753c 12 12 I(q) = \text{scale} \cdot q^{-\text{power}} + \text{background} 13 13 14 Note the minus sign in front of the exponent. The exponent *power* 14 Note the minus sign in front of the exponent. The exponent *power* 15 15 should therefore be entered as a **positive** number for fitting. 16 16 17 Also note that unlike many other models, *scale* in this model 18 is NOT explicitly related to a volume fraction. Be careful if 17 Also note that unlike many other models, *scale* in this model 18 is NOT explicitly related to a volume fraction. Be careful if 19 19 combining this model with other models. 20 20 … … 31 31 from numpy import inf, sqrt 32 32 33 name = 33 name = "power_law" 34 34 title = "Simple power law with a flat background" 35 35 36 description = """ \37 38 39 40 36 description = """ 37 Evaluates the function 38 I(q) = scale * q^(-power) + background 39 NB: enter power as a positive number! 40 """ 41 41 category = "shape-independent" 42 42 … … 45 45 46 46 # NB: Scale and Background are implicit parameters on every model 47 def Iq(q,power): 47 def Iq(q, power): 48 # pylint: disable=missing-docstring 48 49 inten = (q**-power) 49 50 return inten … … 51 52 52 53 def Iqxy(qx, qy, *args): 54 # pylint: disable=missing-docstring 53 55 return Iq(sqrt(qx ** 2 + qy ** 2), *args) 54 56 Iqxy.vectorized = True # Iqxy accepts an array of qx, qy values … … 64 66 65 67 tests = [ 66 [ {'scale': 1.0, 'power': 4.0, 'background' : 0.0}, [0.0106939, 0.469418], [7.64644e+07, 20.5949]] 67 ] 68 [{'scale': 1.0, 'power': 4.0, 'background' : 0.0}, 69 [0.0106939, 0.469418], [7.64644e+07, 20.5949]], 70 ]
Note: See TracChangeset
for help on using the changeset viewer.