MCPcopy Create free account
hub / github.com/pydata/xarray / _initialize_feasible

Function _initialize_feasible

xarray/computation/fit.py:64–81  ·  view source on GitHub ↗
(lb, ub)

Source from the content-addressed store, hash-verified

62 """
63
64 def _initialize_feasible(lb, ub):
65 # Mimics functionality of scipy.optimize.minpack._initialize_feasible
66 lb_finite = np.isfinite(lb)
67 ub_finite = np.isfinite(ub)
68 p0 = where(
69 lb_finite,
70 where(
71 ub_finite,
72 0.5 * (lb + ub), # both bounds finite
73 lb + 1, # lower bound finite, upper infinite
74 ),
75 where(
76 ub_finite,
77 ub - 1, # lower bound infinite, upper finite
78 0, # both bounds infinite
79 ),
80 )
81 return p0
82
83 param_defaults = dict.fromkeys(params, 1)
84 bounds_defaults = dict.fromkeys(params, (-np.inf, np.inf))

Callers 1

Calls 1

whereFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…