squarenet.utils

Functions

breakpoint()

dualgrid(grid, xp, N, IJ, D)

dualgridflat(grid, xp, N)

fill_in(data, stencil, fill_rank, xp)

index_identity(shape)

index_identy[i, j, k, ...] = [i, j, k, ...]

make_stencil(gridshape[, dtype])

Create a grid stencil ordered by distance to the center of the grid.

printmatrix(arr)

progress_bar(it, total[, bar_length])

project(gridpoints[, feature_axes, index])

show_search_result(left, right, true, points, sn)

squarenet.utils.breakpoint()[source]
squarenet.utils.dualgrid(grid, xp, N, IJ, D)[source]
squarenet.utils.dualgridflat(grid, xp, N)[source]
squarenet.utils.fill_in(data, stencil, fill_rank, xp)[source]
squarenet.utils.index_identity(shape)[source]

index_identy[i, j, k, …] = [i, j, k, …]

squarenet.utils.make_stencil(gridshape, dtype=<class 'float'>)[source]

Create a grid stencil ordered by distance to the center of the grid. This is a helper for embedding an arbitrary set of n_target points into a smooth convex subset of a hyperrectangular lattice.

Invalid positions are initialized with signed infinities, while valid positions can later be filled with the input data according to fill_rank.

Parameters:
  • gridshape (tuple of int) – The shape of the target grid.

  • dtype (data-type, optional) – The desired data-type for the stencil array (default is float).

Returns:

  • stencil (ndarray of shape (n, d)) – A stencil prefilled with signed infinity at forbidden positions.

  • fill_rank (ndarray of shape (n,)) – Ranking of the lattice points by increasing distance to the grid center. The positions satisfying fill_rank < n_target are the locations where the first n_target points should be inserted.

squarenet.utils.printmatrix(arr)[source]
squarenet.utils.progress_bar(it, total, bar_length=30)[source]
squarenet.utils.project(gridpoints, feature_axes=(0, 1), index=0)[source]
squarenet.utils.show_search_result(left, right, true, points, sn)[source]
squarenet.utils.warn()

Issue a warning, or maybe ignore it or raise an exception.

message

Text of the warning message.

category

The Warning category subclass. Defaults to UserWarning.

stacklevel

How far up the call stack to make this warning appear. A value of 2 for example attributes the warning to the caller of the code calling warn().

source

If supplied, the destroyed object which emitted a ResourceWarning

skip_file_prefixes

An optional tuple of module filename prefixes indicating frames to skip during stacklevel computations for stack frame attribution.