pyepri.utils
This module contains standard operators usually involved in signal or image processing.
Functions
|
Gradient (= forward finite differences) of a mono-dimensional array with Neumann boundary condition. |
|
discrete divergence of a mono-dimensional array (opposite adjoint of grad1d). |
|
Gradient (= forward finite differences) of a 2-dimensional array with Neumann boundary condition. |
|
discrete divergence of a 2D field vector (opposite adjoint of grad2d). |
|
Gradient (= forward finite differences) of a 3-dimensional array with Neumann boundary condition. |
|
discrete divergence of a 3D field vector (opposite adjoint of grad3d). |
|
Factorized consistency checks for functions in the |
Module Contents
- pyepri.utils.grad1d(u, backend=None, notest=False)[source]
Gradient (= forward finite differences) of a mono-dimensional array with Neumann boundary condition.
- Parameters:
u (array_like (with type backend.cls)) – Mono-dimensional array.
backend (<class 'pyepri.backends.Backend'> or None, optional) –
A numpy, cupy or torch backend (see
pyepri.backends
module).When backend is None, a default backend is inferred from the input array
u
.notest (bool, optional) – Set
notest=True
to disable consistency checks.
- Returns:
G – Output array same shape as
u
corresponding to the forward finite differences ofu
.- Return type:
array_like (with type backend.cls)
See also
- pyepri.utils.div1d(P, backend=None, notest=False)[source]
discrete divergence of a mono-dimensional array (opposite adjoint of grad1d).
- Parameters:
P (array_like (with type backend.cls)) – Mono-dimensional input array.
backend (<class 'pyepri.backends.Backend'> or None, optional) –
A numpy, cupy or torch backend (see
pyepri.backends
module).When backend is None, a default backend is inferred from the input array
P
.notest (bool, optional) – Set
notest=True
to disable consistency checks.
- Returns:
div – Mono-dimensional array with same shape as
u
corresponding to the discrete divergence (or opposite adjoint of thegrad1d
operator) of the input arrayP
.- Return type:
array_like (with type backend.cls)
See also
- pyepri.utils.grad2d(u, backend=None, notest=False)[source]
Gradient (= forward finite differences) of a 2-dimensional array with Neumann boundary condition.
- Parameters:
u (array_like (with type backend.cls)) – Two-dimensional array.
backend (<class 'pyepri.backends.Backend'> or None, optional) –
A numpy, cupy or torch backend (see
pyepri.backends
module).When backend is None, a default backend is inferred from the input array
u
.notest (bool, optional) – Set
notest=True
to disable consistency checks.
- Returns:
G – Output array with shape
(3,) + u.shape
such thatG[j]
correspond to the forward finite differences ofu
along its j-th dimension (forj in range(2)
).- Return type:
array_like (with type backend.cls)
See also
- pyepri.utils.div2d(P, backend=None, notest=False)[source]
discrete divergence of a 2D field vector (opposite adjoint of grad2d).
- Parameters:
P (array_like (with type backend.cls)) – Two-dimensional vector field array with shape
(2, Ny, Nx)
.backend (<class 'pyepri.backends.Backend'>or None, optional) –
A numpy, cupy or torch backend (see
pyepri.backends
module).When backend is None, a default backend is inferred from the input array
P
.notest (bool, optional) – Set
notest=True
to disable consistency checks.
- Returns:
div – Two dimensional array with shape
(Ny, Nx)
corresponding to the discrete divergence (or opposite adjoint of thegrad2d
operator) of the input field vector arrayP
.- Return type:
array_like (with type backend.cls)
See also
- pyepri.utils.grad3d(u, backend=None, notest=False)[source]
Gradient (= forward finite differences) of a 3-dimensional array with Neumann boundary condition.
- Parameters:
u (array_like (with type backend.cls)) – Three-dimensional array.
backend (<class 'pyepri.backends.Backend'> or None, optional) –
A numpy, cupy or torch backend (see
pyepri.backends
module).When backend is None, a default backend is inferred from the input array
u
.notest (bool, optional) – Set
notest=True
to disable consistency checks.
- Returns:
G – Output array with shape
(3,) + u.shape
such thatG[j]
correspond to the forward finite differences ofu
along its j-th dimension (forj in range(3)
).- Return type:
array_like (with type backend.cls)
See also
- pyepri.utils.div3d(P, backend=None, notest=False)[source]
discrete divergence of a 3D field vector (opposite adjoint of grad3d).
- Parameters:
P (array_like (with type backend.cls)) – Three-dimensional vector field array with shape
(3, Ny, Nx, Nz)
.backend (<class 'pyepri.backends.Backend'> or None, optional) –
A numpy, cupy or torch backend (see
pyepri.backends
module).When backend is None, a default backend is inferred from the input array
P
.notest (bool, optional) – Set
notest=True
to disable consistency checks.
- Returns:
div – Three dimensional array with shape
(Ny, Nx, Nz)
corresponding to the discrete divergence (or opposite adjoint of thegrad3d
operator) of the input field vector arrayP
.- Return type:
array_like (with type backend.cls)
See also
- pyepri.utils._check_nd_inputs_(ndims, backend, u=None, P=None)[source]
Factorized consistency checks for functions in the
pyepri.utils
submodule.