bounds - Bounds handling

make_bounds_handler

Return a bounds object which can update the bounds.

Bounds

Base class for all times of bounds objects.

ReflectBounds

Reflect parameter values into bounded region

ClipBounds

Clip values to bounded region

FoldBounds

Wrap values into the bounded region

RandomBounds

Randomize values into the bounded region

IgnoreBounds

Leave values outside the bounded region

Bounds handling.

Use bounds(low, high, style) to create a bounds handling object. This function operates on a point x, transforming it so that all dimensions are within the bounds. Options are available, including reflecting, wrapping, clipping or randomizing the point, or ignoring the bounds.

The returned bounds object should have an apply(x) method which transforms the point x.

class bumps.dream.bounds.Bounds[source]

Bases: object

Base class for all times of bounds objects.

static apply(minn, maxn, pop)[source]

Force pop (population) values within bounds

c_interface: Callable[[int, int, Any, Any, Any], None] = None
high: np.ndarray = None
low: np.ndarray = None
class bumps.dream.bounds.ClipBounds(low, high)[source]

Bases: Bounds

Clip values to bounded region

static apply(minn, maxn, pop)[source]

Force pop (population) values within bounds

c_interface: Callable[[int, int, Any, Any, Any], None] = None
high: np.ndarray = None
low: np.ndarray = None
class bumps.dream.bounds.FoldBounds(low, high)[source]

Bases: Bounds

Wrap values into the bounded region

static apply(minn, maxn, pop)[source]

Force pop (population) values within bounds

c_interface: Callable[[int, int, Any, Any, Any], None] = None
high: np.ndarray = None
low: np.ndarray = None
class bumps.dream.bounds.IgnoreBounds(low=None, high=None)[source]

Bases: Bounds

Leave values outside the bounded region

static apply(minn, maxn, pop)[source]

Force pop (population) values within bounds

c_interface: Callable[[int, int, Any, Any, Any], None] = None
high: np.ndarray = None
low: np.ndarray = None
class bumps.dream.bounds.RandomBounds(low, high)[source]

Bases: Bounds

Randomize values into the bounded region

static apply(minn, maxn, pop)[source]

Force pop (population) values within bounds

c_interface: Callable[[int, int, Any, Any, Any], None] = None
high: np.ndarray = None
low: np.ndarray = None
class bumps.dream.bounds.ReflectBounds(low, high)[source]

Bases: Bounds

Reflect parameter values into bounded region

static apply(minn, maxn, pop)[source]

Update pop so all values lie within bounds

c_interface: Callable[[int, int, Any, Any, Any], None] = None
high: np.ndarray = None
low: np.ndarray = None
bumps.dream.bounds.make_bounds_handler(bounds, style='reflect')[source]

Return a bounds object which can update the bounds.

Bounds handling style name is one of:

reflect:   reflect off the boundary
clip:      stop at the boundary
fold:      wrap values to the other side of the boundary
randomize: move to a random point in the bounds
none:      ignore the bounds

With semi-infinite intervals folding and randomizing aren’t well defined, and reflection is used instead.

With finite intervals the the reflected or folded point may still be outside the bounds (which can happen if the step size is too large), and a random uniform value is used instead.