Skip to content

Commit

Permalink
Change asymdecrease3 to a yet preferable form.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahaselsteiner committed Mar 2, 2020
1 parent acef6d8 commit 5275b87
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/test_fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,8 @@ def test_fit_asymdecrease3(self):
# Check whether the logarithmic square fit worked correctly.
dist1 = fit.mul_var_dist.distributions[1]
self.assertAlmostEqual(dist1.shape.a, 0, delta=0.1) # Should be about 0
self.assertAlmostEqual(dist1.shape.b, 0.35, delta=0.5) # Should be about 0.35
self.assertAlmostEqual(np.abs(dist1.shape.c), 2.5, delta=2) # Should be about 2.5
self.assertAlmostEqual(dist1.shape.b, 0.35, delta=0.4) # Should be about 0.35
self.assertAlmostEqual(np.abs(dist1.shape.c), 0.45, delta=0.2) # Should be about 0.45
self.assertAlmostEquals(dist1.shape(0), 0.35, delta=0.2) # Should be about 0.35

def test_min_number_datapoints_for_fit(self):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def test_FunctionParam_asymdecrease3(self):
"""

test_func = FunctionParam('asymdecrease3', 1, 4, 3)
self.assertEqual(test_func._value(0), 2)
self.assertEqual(test_func._value(0), 5)
self.assertEqual(test_func.func_name, 'asymdecrease3')
self.assertEqual(str(test_func)[0:1], '1')

Expand Down
5 changes: 2 additions & 3 deletions viroconcom/fitting.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def _powerdecrease3(x, a, b, c):

# 3-parameter function that asymptotically decreases (a dependence function).
def _asymdecrease3(x, a, b, c):
return a + b / (1 + x + np.abs(c))
return a + b / (1 + c * x)


# A 4-parameter logististics function (a dependence function).
Expand Down Expand Up @@ -565,8 +565,7 @@ def __init__(self, samples, dist_descriptions, timeout=None):
- :exp3: :math:`a + b * e^{x * c}`
- :lnsquare2: :math:`ln[a + b * sqrt(x / 9.81)`
- :powerdecrease3: :math:`a + 1 / (x + b)^c`
- :asymdecrease3: :math:`a + b / (1 + x + |c|)`
- :asymdecrease3: :math:`a + 1 / (b * (x + c))`
- :asymdecrease3: :math:`a + b / (1 + c * x)`
- :logistics4: :math:`a + b / [1 + e^{-c * (x - d)}]`
- remark : in case of Lognormal_SigmaMu it is (sigma, None, mu)
Expand Down
6 changes: 3 additions & 3 deletions viroconcom/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def __init__(self, func_name, a, b, c, d=None,
:exp3: :math:`a + b * e^{x * c}`
:lnsquare2: :math:`\ln[a + b * \sqrt(x / 9.81)`
:powerdecrease3: :math:`a + 1 / (x + b)^c`
:asymdecrease3: :math:`a + b / (1 + x + |c|)`
:asymdecrease3: :math:`a + b / (1 + c * x)`
:logistics4: :math:`a + b / [1 + e^{-c * (x - d)}]`
a,b,c : float
The function parameters.
Expand Down Expand Up @@ -165,7 +165,7 @@ def _powerdecrease3(self, x):

# A 3-parameter function that asymptotically decreases (a dependence function).
def _asymdecrease3(self, x):
return self.a + self.b / (1 + x + np.abs(self.c))
return self.a + self.b / (1 + self.c * x)

# A 4-parameter logististics function (a dependence function).
def _logistics4(self, x, a=None, b=None, c=None, d=None):
Expand Down Expand Up @@ -199,7 +199,7 @@ def __str__(self):
")^" + str(self.c)
elif self.func_name == "asymdecrease3":
function_string = "" + str(self.a) + " + " + str(self.b) + \
"/ (1 + x + |" + str(self.c) + "|)"
"/ (1 + " + str(self.c) + " * x)"
elif self.func_name == "logistics4":
function_string = "" + str(self.a) + " + " + str(self.b) + \
" / {1 + e^[-" + str(self.c) + \
Expand Down
2 changes: 1 addition & 1 deletion viroconcom/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.3.4'
__version__ = '1.3.5'

0 comments on commit 5275b87

Please sign in to comment.