Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c143e75

Browse filesBrowse files
committed
Implemented feedback from @QuLogic
1 parent 3bd901e commit c143e75
Copy full SHA for c143e75

File tree

Expand file treeCollapse file tree

1 file changed

+67
-13
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+67
-13
lines changed

‎lib/matplotlib/cbook.py

Copy file name to clipboardExpand all lines: lib/matplotlib/cbook.py
+67-13Lines changed: 67 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2665,22 +2665,38 @@ def __exit__(self, exc_type, exc_value, traceback):
26652665

26662666
class _FuncInfo(object):
26672667
"""
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.
26812669
26822670
"""
2671+
26832672
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+
26842700
self.function = function
26852701
self.inverse = inverse
26862702

@@ -2697,9 +2713,47 @@ def __init__(self, function, inverse, bounded_0_1=True, check_params=None):
26972713
raise ValueError("Invalid 'check_params' argument.")
26982714

26992715
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+
27002735
return self._bounded_0_1(params)
27012736

27022737
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+
27032757
return self._check_params(params)
27042758

27052759

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.