Changeset 525f3a9 in sasmodels
- Timestamp:
- Nov 20, 2015 3:58:44 AM (9 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:
- 29fc2a3
- Parents:
- 5d80bbf
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sasmodels/models/power_law.py
r8fe0b9b r525f3a9 10 10 .. math:: 11 11 12 I(q) = \text{scale} \cdot q^{- m} + \text{background}12 I(q) = \text{scale} \cdot q^{-power} + \text{background} 13 13 14 Note the minus sign in front of the exponent. The exponent * m*15 should therefore be entered as a **positive** number .14 Note the minus sign in front of the exponent. The exponent *power* 15 should therefore be entered as a **positive** number for fitting. 16 16 17 17 Also note that unlike many other models, *scale* in this model … … 35 35 description = """\ 36 36 Evaluates the function 37 I(q) = scale * q^(- m) + bkgd38 NB: enter mas a positive number!37 I(q) = scale * q^(-power) + background 38 NB: enter power as a positive number! 39 39 """ 40 40 category = "shape-independent" 41 41 42 42 # ["name", "units", default, [lower, upper], "type", "description"], 43 parameters = [["scale", "", 1.0, [-inf, inf], "", "Power law scale factor"], 44 ["m", "", 4.0, [-inf, inf], "", "Power law exponent"], 45 ["bkgd", "", 0.0, [-inf, inf], "", "Background level"]] 43 parameters = [["power", "", 4.0, [-inf, inf], "", "Power law exponent"]] 46 44 47 def Iq(scale,m,bkgd): 48 inten = (scale * q ** m + bkgd) 45 # NB: Scale and Background are implicit parameters on every model 46 def Iq(q,power): 47 inten = (q**-power) 49 48 return inten 50 49 Iq.vectorized = True # Iq accepts an array of Q values … … 55 54 56 55 demo = dict(scale=1.0, 57 m=4.0,58 b kgd=0.0)56 power=4.0, 57 background=0.0) 59 58 60 59 oldname = "PowerLawAbsModel" 61 60 oldpars = dict(scale='scale', 62 m='m',63 b kgd='background')61 power='m', 62 background='background') 64 63 65 64 tests = [ 66 [ {'scale': 1.0, ' m': 4.0, 'bkgd' : 0.0}, [0.0106939, 0.469418], [7.64644e+07, 20.5949]]65 [ {'scale': 1.0, 'power': 4.0, 'background' : 0.0}, [0.0106939, 0.469418], [7.64644e+07, 20.5949]] 67 66 ]
Note: See TracChangeset
for help on using the changeset viewer.