MCPcopy Create free account
hub / github.com/NanoComp/meep / pick_bound

Function pick_bound

python/geom.py:1702–1716  ·  view source on GitHub ↗
(which)

Source from the content-addressed store, hash-verified

1700 return x if isinstance(x, Number) else x()
1701
1702 def pick_bound(which):
1703 def _pb():
1704 fmin_tup = f_memo(x_min)
1705 fmax_tup = f_memo(x_max)
1706 fmin = fmin_tup[0]
1707 fmax = fmax_tup[0]
1708
1709 if which(fmin):
1710 return x_min
1711 elif which(fmax):
1712 return x_max
1713 else:
1714 raise ValueError("failed to bracket the root in find_root_deriv")
1715
1716 return _pb
1717
1718 def in_bounds(x, f, df, a, b):
1719 return (f - (df * (x - a))) * (f - (df * (x - b))) < 0

Callers 1

find_root_derivFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected