pyfli.sp_analysis.basis#

Implement Hadamard and DCT sensing bases for single-pixel reconstruction.

This module belongs to pyfli.sp_analysis and is part of PyFLI single-pixel camera basis generation, acquisition simulation, and reconstruction solvers. Public API includes classes OrthogonalBasis, HadamardBasis, and DCTBasis.

Classes

DCTBasis()

Apply DCT-II and inverse DCT transforms as a compact orthogonal sensing basis.

HadamardBasis(n_pixels)

Apply a Walsh-Hadamard sensing basis by matrix multiplication.

OrthogonalBasis()

Define the interface for orthogonal sensing bases.

class OrthogonalBasis[source]#

Bases: object

Define the interface for orthogonal sensing bases. Subclasses implement forward and inverse transforms for flattened spatial signals or spatial-temporal stacks.

forward(x)[source]#

Apply the forward basis transform.

Parameters:

x (np.ndarray) – Input array, coordinate, or signal being transformed.

Returns:

No object is returned; the function perform forward.

Return type:

None

inverse(y)[source]#

Apply the inverse basis transform.

Parameters:

y (np.ndarray) – Observed signal, target data, or coordinate array.

Returns:

No object is returned; the function perform inverse.

Return type:

None

class HadamardBasis(n_pixels)[source]#

Bases: OrthogonalBasis

Apply a Walsh-Hadamard sensing basis by matrix multiplication. The basis requires a power-of-two pixel count and transforms along the spatial axis.

Parameters:

n_pixels (int) – Number of spatial pixels represented by the basis.

forward(x)[source]#

Apply the forward basis transform.

Parameters:

x (np.ndarray) – Input array, coordinate, or signal being transformed.

Returns:

Object produced by forward.

Return type:

Any

inverse(y)[source]#

Apply the inverse basis transform.

Parameters:

y (np.ndarray) – Observed signal, target data, or coordinate array.

Returns:

Object produced by inverse.

Return type:

Any

class DCTBasis[source]#

Bases: OrthogonalBasis

Apply DCT-II and inverse DCT transforms as a compact orthogonal sensing basis. It is useful for Fourier-like single-pixel simulation and reconstruction.

forward(x)[source]#

Apply the forward basis transform.

Parameters:

x (np.ndarray) – Input array, coordinate, or signal being transformed.

Returns:

Object produced by forward.

Return type:

Any

inverse(y)[source]#

Apply the inverse basis transform.

Parameters:

y (np.ndarray) – Observed signal, target data, or coordinate array.

Returns:

Object produced by inverse.

Return type:

Any