@@ -2665,22 +2665,38 @@ def __exit__(self, exc_type, exc_value, traceback):
2665
2665
2666
2666
class _FuncInfo (object ):
2667
2667
"""
2668
- Class used to store a function
2669
-
2670
- Each object has:
2671
- * The direct function (function)
2672
- * The inverse function (inverse)
2673
- * A boolean indicating whether the function
2674
- is bounded in the interval 0-1 (bounded_0_1), or
2675
- a method that returns the information depending
2676
- on this
2677
- * A callable (check_params) that takes a list of the parameters
2678
- and returns a boolean specifying if a certain combination of
2679
- parameters is valid. It is only required if the function has
2680
- parameters and some of them are restricted.
2668
+ Class used to store a function.
2681
2669
2682
2670
"""
2671
+
2683
2672
def __init__ (self , function , inverse , bounded_0_1 = True , check_params = None ):
2673
+ """
2674
+ Parameters
2675
+ ----------
2676
+
2677
+ function : callable
2678
+ A callable implementing the function receiving the variable as
2679
+ first argument and any additional parameters in a list as second
2680
+ argument.
2681
+ inverse : callable
2682
+ A callable implementing the inverse function receiving the variable
2683
+ as first argument and any additional parameters in a list as
2684
+ second argument. It must satisfy 'inverse(function(x, p), p) == x'.
2685
+ bounded_0_1: bool or callable
2686
+ A boolean indicating whether the function is bounded in the [0,1]
2687
+ interval, or a callable taking a list of values for the additional
2688
+ parameters, and returning a boolean indicating whether the function
2689
+ is bounded in the [0,1] interval for that combination of
2690
+ parameters. Default True.
2691
+ check_params: callable or None
2692
+ A callable taking a list of values for the additional parameters
2693
+ and returning a boolean indicating whether that combination of
2694
+ parameters is valid. It is only required if the function has
2695
+ additional parameters and some of them are restricted.
2696
+ Default None.
2697
+
2698
+ """
2699
+
2684
2700
self .function = function
2685
2701
self .inverse = inverse
2686
2702
@@ -2697,9 +2713,47 @@ def __init__(self, function, inverse, bounded_0_1=True, check_params=None):
2697
2713
raise ValueError ("Invalid 'check_params' argument." )
2698
2714
2699
2715
def is_bounded_0_1 (self , params = None ):
2716
+ """
2717
+ Returns a boolean indicating if the function is bounded in the [0,1]
2718
+ interval for a particular set of additional parameters.
2719
+
2720
+ Parameters
2721
+ ----------
2722
+
2723
+ params : list
2724
+ The list of additional parameters. Default None.
2725
+
2726
+ Returns
2727
+ -------
2728
+
2729
+ out : bool
2730
+ True if the function is bounded in the [0,1] interval for
2731
+ parameters 'params'. Otherwise False.
2732
+
2733
+ """
2734
+
2700
2735
return self ._bounded_0_1 (params )
2701
2736
2702
2737
def check_params (self , params = None ):
2738
+ """
2739
+ Returns a boolean indicating if the set of additional parameters is
2740
+ valid.
2741
+
2742
+ Parameters
2743
+ ----------
2744
+
2745
+ params : list
2746
+ The list of additional parameters. Default None.
2747
+
2748
+ Returns
2749
+ -------
2750
+
2751
+ out : bool
2752
+ True if 'params' is a valid set of additional parameters for the
2753
+ function. Otherwise False.
2754
+
2755
+ """
2756
+
2703
2757
return self ._check_params (params )
2704
2758
2705
2759
0 commit comments