cherab.inversion.statistical.MLEM

class cherab.inversion.statistical.MLEM(T: ndarray[tuple[Any, ...], dtype[float64]] | csr_array[float64, tuple[int, int]], data: ArrayLike | None = None)Source

Bases: object

Maximum Likelihood Expectation Maximization (MLEM) algorithm.

This class provides a simple implementation of the MLEM algorithm for solving the inverse problem \(\mathbf{T} \mathbf{x} = \mathbf{b}\) where \(\mathbf{T}\) is the forward problem matrix, \(\mathbf{x}\) is the unknown solution, and \(\mathbf{b}\) is the given data.

Note

The detailed mathematical formulation and implementation of the MLEM algorithm can be found in here.

Parameters:
T: ndarray[tuple[Any, ...], dtype[float64]] | csr_array[float64, tuple[int, int]]

(M, N) Matrix \(\mathbf{T}\in\mathbb{R}^{M \times N}\) of the forward problem.

data: ArrayLike | None = None

Given data \(\mathbf{b}\in\mathbb{R}^M\) or \(\mathbf{b}\in\mathbb{R}^{M \times K}\), where K is typically the number of time slices, by default None.

Methods

solve([x0, tol, max_iter, quiet, store_temp])

Solve the inverse problem using the MLEM algorithm.

Attributes

T

Matrix \(\mathbf{T}\in\mathbb{R}^{M \times N}\) of the forward problem.

data

Data vector \(\mathbf{b}\in\mathbb{R}^M\) or matrix \(\mathbf{b}\in\mathbb{R}^{M \times K}\).

property T : ndarray[tuple[Any, ...], dtype[float64]] | csr_array[float64, tuple[int, int]]Source

Matrix \(\mathbf{T}\in\mathbb{R}^{M \times N}\) of the forward problem.

property data : ndarray[tuple[Any, ...], dtype[float64]] | NoneSource

Data vector \(\mathbf{b}\in\mathbb{R}^M\) or matrix \(\mathbf{b}\in\mathbb{R}^{M \times K}\).

solve(x0: ndarray[tuple[Any, ...], dtype[float64]] | None = None, tol: float = 1e-05, max_iter: int = 100, quiet: bool = False, store_temp: bool = False) tuple[ndarray[tuple[Any, ...], dtype[float64]], dict[str, Any]]Source

Solve the inverse problem using the MLEM algorithm.

Parameters:
x0: ndarray[tuple[Any, ...], dtype[float64]] | None = None

Initial guess of the solution \(\mathbf{x}\in\mathbb{R}^N\) or \(\mathbf{x}\in\mathbb{R}^{N \times K}\). If not given, it defaults to a vector of ones.

tol: float = 1e-05

Tolerance for convergence, by default 1e-5. The iteration stops when the maximum difference between the current and previous solutions is less than this value.

max_iter: int = 100

Maximum number of iterations, by default 100.

quiet: bool = False

Whether to suppress the progress bar, by default False.

store_temp: bool = False

Whether to store the temporary solutions during the iteration, by default False.

Returns:

  • x ((N, ) or (N, K) numpy.ndarray) – Solution of the inverse problem. If the data has K time slices, the solution is a matrix.

  • status (dict) – Dictionary containing the status of the iteration.

Raises:

ValueError – If data is not set before calling this method.