nifty8.re.refine.util module#

class RefinementMatrices(filter, propagator_sqrt, cov_sqrt0, index_map)#

Bases: tuple

cov_sqrt0#

Alias for field number 2

filter#

Alias for field number 0

index_map#

Alias for field number 3

propagator_sqrt#

Alias for field number 1

coarse2fine_distances(distances0: float | Iterable[float], depth: int, *, _fine_size: int = 2, _fine_strategy: Literal['jump', 'extend'] = 'jump')[source]#

Translates coarse distances to its corresponding fine distances.

coarse2fine_shape(shape0: int | Iterable[int], depth: int, *, _coarse_size: int = 3, _fine_size: int = 2, _fine_strategy: Literal['jump', 'extend'] = 'jump')[source]#

Translates a coarse shape to its corresponding fine shape.

fine2coarse_distances(distances: float | Iterable[float], depth: int, *, _fine_size: int = 2, _fine_strategy: Literal['jump', 'extend'] = 'jump')[source]#

Translates fine distances to its corresponding coarse distances.

fine2coarse_shape(shape: int | Iterable[int], depth: int, *, _coarse_size: int = 3, _fine_size: int = 2, _fine_strategy: Literal['jump', 'extend'] = 'jump', ceil_sizes: bool = False)[source]#

Translates a fine shape to its corresponding coarse shape.

gauss_kl(cov_desired, cov_approx, *, m_desired=None, m_approx=None)[source]#
get_cov_from_loc(kernel=None, cov_from_loc=None) Callable[[Array | ndarray, Array | ndarray], Array | ndarray][source]#
get_optimal_refinement_chart(kernel, *, shape0, refinement_strategies=[{'_coarse_size': 3, '_fine_size': 2}, {'_coarse_size': 3, '_fine_size': 4}, {'_coarse_size': 5, '_fine_size': 2}, {'_coarse_size': 5, '_fine_size': 4}, {'_coarse_size': 5, '_fine_size': 6}], **common_kwargs)[source]#

Compute the Kullback-Leibler divergence for a given kernel, initial shape0, and parameters of a coordinate chart (common_kwargs); returning the set within refinement_strategies that has the lowest Kullback-Leibler divergence.

get_refinement_shapewithdtype(shape0: int | tuple, depth: int, dtype=None, *, _coarse_size: int = 3, _fine_size: int = 2, _fine_strategy: Literal['jump', 'extend'] = 'jump', skip0: bool = False)[source]#
refinement_approximation_error(chart, kernel: Callable, cutout: slice | int | Tuple[slice] | Tuple[int] | None = None)[source]#

Computes the Kullback-Leibler (KL) divergence of the true covariance versus the approximative one for a given kernel and shape of the fine grid.

If the desired shape can not be matched, the next larger one is used and the field is subsequently cropped to the desired shape.

refinement_covariance(chart_or_model, kernel=None, jit=True)[source]#

Computes the implied covariance as modeled by the refinement scheme.

refinement_matrices(cov, n_fsz: int, coerce_fine_kernel: bool)[source]#
true_covariance(chart, kernel, depth=None)[source]#

Computes the true covariance at the final grid.