nifty8.re.refine.charted_field module#

class RefinementField(*args, kernel: Callable | None = None, dtype=None, skip0: bool = False, **kwargs)[source]#

Bases: LazyModel

__call__(xi, kernel=None, *, skip0=None, **kwargs)[source]#

See RefinementField.apply.

__init__(*args, kernel: Callable | None = None, dtype=None, skip0: bool = False, **kwargs)[source]#

Initialize an Iterative Charted Refinement (ICR) field.

There are multiple ways to initialize a charted refinement field. The recommended way is to first instantiate a CoordinateChart and pass it as first argument to this method. Alternatively, you may pass any and all arguments of CoordinateChart also to this method and it will instantiate the CoordinateChart for you and use it in the same way as if directly specified.

Parameters:
  • chart (CoordinateChart) – The CoordinateChart with which to refine.

  • kernel – Covariance kernel of the refinement field.

  • dtype – Data-type of the excitations which to add during refining.

  • skip0 – Whether to skip the first refinement level. This is useful to e.g. stack multiple refinement fields on top of each other.

  • **kwargs – Alternatively to chart any parameters accepted by CoordinateChart.

static apply(xi, chart, kernel: Callable | RefinementMatrices, *, skip0: bool = False, depth: int | None = None, coerce_fine_kernel: bool = False, _refine: Callable | None = None, _cov_from_loc: Callable | None = None, precision=None)[source]#

Static method to apply a refinement field given some excitations, a chart and a kernel.

Parameters:
  • xi – Latent parameters which to use for refining.

  • chart – Chart with which to refine.

  • kernel – Covariance kernel with which to build the refinement matrices.

  • skip0 – Whether to skip the first refinement level.

  • depth – Refinement depth if different to the depth of the coordinate chart.

  • coerce_fine_kernel – Whether to coerce the refinement matrices at scales at which the kernel matrix becomes singular or numerically highly unstable.

  • precision – See JAX’s precision.

property chart#

Associated CoordinateChart with which to iterative refine.

property domain#

Yields the ShapeWithDtype of the primals.

property dtype#

Yields the data-type of the excitations.

property kernel#

Yields the kernel specified during initialization or throw a TypeError.

matrices(kernel: Callable | None = None, depth: int | None = None, skip0: bool | None = None, **kwargs) RefinementMatrices[source]#

Computes the refinement matrices namely the optimal linear filter and the square root of the information propagator (a.k.a. the square root of the fine covariance matrix for the excitations) for all refinement levels and all pixel indices in the coordinate chart.

Parameters:
  • kernel – Covariance kernel of the refinement field if not specified during initialization.

  • depth – Maximum refinement depth if different to the one of the CoordinateChart.

  • skip0 – Whether to skip the first refinement level.

matrices_at(level: int, pixel_index: Iterable[int] | None = None, kernel: Callable | None = None, **kwargs) Tuple[Array, Array][source]#

Computes the refinement matrices namely the optimal linear filter and the square root of the information propagator (a.k.a. the square root of the fine covariance matrix for the excitations) at the specified level and pixel index.

Parameters:
  • level – Refinement level.

  • pixel_index – Index of the NDArray at the refinement level level which to refine, i.e. use as center coarse pixel.

  • kernel – Covariance kernel of the refinement field if not specified during initialization.

property skip0#

Whether to skip the zeroth refinement