ucurv.util
- ucurv.util.bands2vec(imband, engine: str = 'auto')[source]
Convert the dictionary of complex subbands into a real-valued compressed vector.
- Parameters:
imband (dict) – Mapping from subband identifier (tuple) to ndarray of complex coefficients. The key (0,) corresponds to the low-frequency band; other keys represent detail subbands.
- Returns:
compressed – 1D real array containing the concatenated coefficients: - First, the real part of the low-frequency band (imband[(0,)]). - Then, for each detail subband, the interleaved real and imaginary parts, so a0, b0, a1, b1, …, where a is real and b is imaginary
- Return type:
ndarray
- ucurv.util.fun_meyer(x, param, engine: str = 'auto')[source]
Compute a smooth window similar to the Meyer wavelet in frequency domain.
- Parameters:
x (array_like) – Incput grid, typically generated by numpy.linspace.
param (array_like of shape (4,)) – Four increasing values [p0, p1, p2, p3] that define the window: - The window is zero for x <= p0 and x >= p3. - The window is one for p1 <= x <= p2. - It transitions smoothly from 0 to 1 over [p0, p1]. - It transitions smoothly from 1 to 0 over [p2, p3].
- Returns:
w – The window values evaluated at each point in x.
- Return type:
ndarray
- ucurv.util.ucurv2d_show(imband, udct, engine: str = 'auto')[source]
Note: currently broken Assemble and visualize a 2D curvelet transform by concatenating its subbands. :param imband: Mapping from subband identifiers to 2D complex arrays.
The low-frequency band is stored under key (0,).
- Parameters:
udct (object) – A curvelet transform descriptor with attributes: - dim (int): number of dimensions (must be 2). - cfg (list of tuple): number of subbands at each resolution/direction. - res (int): total number of resolution levels. - sz (tuple of int): original image shape (height, width).
- Returns:
display – A 2D array of shape (sz[0], W) where W is the concatenated width of all subbands laid out for display. The first block is the low-frequency image, followed by rows of detail subbands arranged by resolution.
- Return type:
ndarray of complex
- Raises:
Exception – If udct.dim != 2, since this function only supports 2D transforms.
- ucurv.util.vec2bands(imband, udct, engine: str = 'auto')[source]
Reconstruct the dictionary of complex subbands from a compressed real-valued vector.
- Parameters:
vector (ndarray) – 1D real array produced by bands2vec, containing: - First, the low-frequency band samples. - Then, for each detail subband, interleaved real and imaginary parts.
udct (object) – An object providing these attributes: - sz : sequence of ints, the original image dimensions. - res : int, the number of decomposition levels. - Sampling : dict mapping subband ids (tuples) to sampling factors. - Msubwin : dict whose keys are the subband ids (tuples).
- Returns:
uncompressed – Mapping from subband identifier (tuple) to ndarray of complex coefficients, reconstructed to the appropriate shape.
- Return type:
dict