autofit.ClipperNone#

class ClipperNone[source]#

Bases: AbstractClipper

The no-op clipper, and the default.

Bounds are ±inf and project is the identity, so a search configured with this is bit-identical to one with no clipper concept at all. Searches should test for it and skip the projection entirely rather than applying it as a no-op, so that the compiled step is unchanged too.

Methods

bounds_from_model

The (lower, upper) box, in physical parameter order.

project

Project vector onto the prior support.

bounds_from_model(model)[source]#

The (lower, upper) box, in physical parameter order.

Unbounded coordinates are -inf / +inf. The two arrays are returned separately because that is the shape project broadcasts against.

Note that this is not the shape scipy.optimize.minimize accepts: it reads a (lower, upper) tuple as a sequence of ``(min, max)`` pairs, which for a two-parameter model silently produces a wrong fit rather than an error. Callers handing these to scipy must build an explicit scipy.optimize.Bounds — see _bounds_from.

Parameters:

model – The model whose priors define the support.

project(vector, model, xp=<module 'numpy' from '/home/docs/checkouts/readthedocs.org/user_builds/pyautofit/envs/latest/lib/python3.12/site-packages/numpy/__init__.py'>, scale=None, bijector=None)[source]#

Project vector onto the prior support.

Parameters:
  • vector – A parameter vector, either a single (n_params,) vector or a batched (n_starts, n_params) array of them. Broadcasting handles both, so no vmap is required of the caller. Physical unless scale or bijector is given, in which case it is in that change of variables’ coordinates.

  • model – The model whose priors define the support.

  • xp – The array module, numpy or jax.numpy.

  • scale – The per-parameter step scale from a scaler, when the caller is stepping in phi = theta / scale rather than in physical parameters. The bounds are divided by it, so the projection happens in the caller’s own coordinates and no round-trip through physical space is needed. Scales are strictly positive, so dividing preserves the ordering of each (lower, upper) pair and +/-inf stay +/-inf. Mutually exclusive with bijector.

  • bijector – A resolved AbstractBijector (.from_model already called), when the caller is stepping in phi = bijector.forward(theta). The inset bounds are computed in physical space (kind-aware — see the module docstring) and then mapped through bijector.bounds_forward, which commutes with clipping because every bijector kind is monotone increasing. Mutually exclusive with scale.

Returns:

  • A (projected, clipped_mask) pair. clipped_mask is boolean, the same

  • shape as vector, and True exactly where a coordinate was moved.