squarenet.utils
Functions
|
|
|
|
|
|
|
index_identy[i, j, k, ...] = [i, j, k, ...] |
|
Create a grid stencil ordered by distance to the center of the grid. |
|
|
|
|
|
|
|
- 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_targetare the locations where the firstn_targetpoints should be inserted.
- 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.