Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Spelling fixes in two_power_law model #449

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions sasmodels/models/two_power_law.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
# pylint: disable=bad-whitespace, line-too-long
# ["name", "units", default, [lower, upper], "type", "description"],
parameters = [
["coefficent_1", "", 1.0, [-inf, inf], "", "coefficent A in low Q region"],
["coefficient_1", "", 1.0, [-inf, inf], "", "coefficient A in low Q region"],
["crossover", "1/Ang", 0.04,[0, inf], "", "crossover location"],
["power_1", "", 1.0, [0, inf], "", "power law exponent at low Q"],
["power_2", "", 4.0, [0, inf], "", "power law exponent at high Q"],
Expand All @@ -75,14 +75,14 @@


def Iq(q,
coefficent_1=1.0,
coefficient_1=1.0,
crossover=0.04,
power_1=1.0,
power_2=4.0,
):
"""
:param q: Input q-value (float or [float, float])
:param coefficent_1: Scaling coefficent at low Q
:param coefficient_1: Scaling coefficient at low Q
:param crossover: Crossover location
:param power_1: Exponent of power law function at low Q
:param power_2: Exponent of power law function at high Q
Expand All @@ -91,9 +91,9 @@ def Iq(q,
result = empty(q.shape, 'd')
index = (q <= crossover)
with errstate(divide='ignore'):
coefficent_2 = coefficent_1 * power(crossover, power_2 - power_1)
result[index] = coefficent_1 * power(q[index], -power_1)
result[~index] = coefficent_2 * power(q[~index], -power_2)
coefficient_2 = coefficient_1 * power(crossover, power_2 - power_1)
result[index] = coefficient_1 * power(q[index], -power_1)
result[~index] = coefficient_2 * power(q[~index], -power_2)
return result

Iq.vectorized = True # Iq accepts an array of q values
Expand All @@ -115,28 +115,28 @@ def random():

tests = [
# Accuracy tests based on content in test/utest_extra_models.py
[{'coefficent_1': 1.0,
[{'coefficient_1': 1.0,
'crossover': 0.04,
'power_1': 1.0,
'power_2': 4.0,
'background': 0.0,
}, 0.001, 1000],

[{'coefficent_1': 1.0,
[{'coefficient_1': 1.0,
'crossover': 0.04,
'power_1': 1.0,
'power_2': 4.0,
'background': 0.0,
}, 0.150141, 0.125945],

[{'coefficent_1': 1.0,
[{'coefficient_1': 1.0,
'crossover': 0.04,
'power_1': 1.0,
'power_2': 4.0,
'background': 0.0,
}, 0.442528, 0.00166884],

[{'coefficent_1': 1.0,
[{'coefficient_1': 1.0,
'crossover': 0.04,
'power_1': 1.0,
'power_2': 4.0,
Expand Down