@@ -466,11 +466,23 @@ def test_michaelis_menten(self, x, alpha, lam, expected):
466466 (3 , 2 , - 1 ),
467467 ],
468468 )
469- def test_monotonicity (self , sigma , beta , lam ):
469+ def test_hill_monotonicity (self , sigma , beta , lam ):
470470 x = np .linspace (- 10 , 10 , 100 )
471471 y = hill_saturation (x , sigma , beta , lam ).eval ()
472472 assert np .all (np .diff (y ) >= 0 ), "The function is not monotonic."
473473
474+ @pytest .mark .parametrize (
475+ "sigma, beta, lam" ,
476+ [
477+ (1 , 1 , 0 ),
478+ (2 , 0.5 , 1 ),
479+ (3 , 2 , - 1 ),
480+ ],
481+ )
482+ def test_hill_zero (self , sigma , beta , lam ):
483+ y = hill_saturation (0 , sigma , beta , lam ).eval ()
484+ assert y == pytest .approx (0.0 )
485+
474486 @pytest .mark .parametrize (
475487 "x, sigma, beta, lam" ,
476488 [
@@ -479,7 +491,7 @@ def test_monotonicity(self, sigma, beta, lam):
479491 (- 3 , 3 , 2 , - 1 ),
480492 ],
481493 )
482- def test_sigma_upper_bound (self , x , sigma , beta , lam ):
494+ def test_hill_sigma_upper_bound (self , x , sigma , beta , lam ):
483495 y = hill_saturation (x , sigma , beta , lam ).eval ()
484496 assert y <= sigma , f"The output { y } exceeds the upper bound sigma { sigma } ."
485497
@@ -491,11 +503,13 @@ def test_sigma_upper_bound(self, x, sigma, beta, lam):
491503 (- 1 , 3 , 2 , - 1 , 1.5 ),
492504 ],
493505 )
494- def test_behavior_at_lambda (self , x , sigma , beta , lam , expected ):
506+ def test_hill_behavior_at_lambda (self , x , sigma , beta , lam , expected ):
495507 y = hill_saturation (x , sigma , beta , lam ).eval ()
508+ offset = sigma / (1 + np .exp (beta * lam ))
509+ expected_with_offset = expected - offset
496510 np .testing .assert_almost_equal (
497511 y ,
498- expected ,
512+ expected_with_offset ,
499513 decimal = 5 ,
500514 err_msg = "The function does not behave as expected at lambda." ,
501515 )
@@ -508,7 +522,7 @@ def test_behavior_at_lambda(self, x, sigma, beta, lam, expected):
508522 (np .array ([1 , 2 , 3 ]), 3 , 2 , 2 ),
509523 ],
510524 )
511- def test_vectorized_input (self , x , sigma , beta , lam ):
525+ def test_hill_vectorized_input (self , x , sigma , beta , lam ):
512526 y = hill_saturation (x , sigma , beta , lam ).eval ()
513527 assert (
514528 y .shape == x .shape
@@ -522,12 +536,14 @@ def test_vectorized_input(self, x, sigma, beta, lam):
522536 (3 , 2 , - 1 ),
523537 ],
524538 )
525- def test_asymptotic_behavior (self , sigma , beta , lam ):
539+ def test_hill_asymptotic_behavior (self , sigma , beta , lam ):
526540 x = 1e6 # A very large value to approximate infinity
527541 y = hill_saturation (x , sigma , beta , lam ).eval ()
542+ offset = sigma / (1 + np .exp (beta * lam ))
543+ expected = sigma - offset
528544 np .testing .assert_almost_equal (
529545 y ,
530- sigma ,
546+ expected ,
531547 decimal = 5 ,
532548 err_msg = "The function does not approach sigma as x approaches infinity." ,
533549 )
0 commit comments