C_CASSI
- class colibri.optics.cassi.C_CASSI(input_shape, trainable=False, initial_ca=None, **kwargs)[source]
Bases:
BaseOpticsLayer
Color Coded Aperture Snapshot Spectral Imager (C-CASSI)
C-CASSI systems allow for the capture of spatio-spectral information through spatial-spectral coding of light and spectral dispersion through a prism.
Mathematically, C-CASSI systems can be described as follows.
\[\mathbf{y} = \forwardLinear_{\learnedOptics}(\mathbf{x}) + \noise\]where \(\noise\) is the sensor noise, \(\mathbf{x}\in\xset\) is the input optical field, and \(\mathbf{y}\in\yset\) are the acquired signal. For C-CASSI, \(\xset = \mathbb{R}^{L \times M \times N}\) and \(\yset = \mathbb{R}^{M \times N + L -1}\). The forward operator \(\forwardLinear_{\learnedOptics}:\xset\rightarrow \yset\) represents the spectral dispersion and spatial-spectral modulation processes, defined as:
\[\begin{split}\begin{align*} \forwardLinear_{\learnedOptics}: \mathbf{x} &\mapsto \mathbf{y} \\ \mathbf{y}_{i, j+l-1} &= \sum_{l=1}^{L} \learnedOptics_{i, j} \mathbf{x}_{i, j, l} \end{align*}\end{split}\]with \(\learnedOptics \in \{0,1\}^{M \times N + L -1}\) coded aperture,
Initializes the C_CASSI layer.
- Parameters:
input_shape (tuple) – Tuple, shape of the input image (L, M, N).
trainable (bool) – Boolean, if True the coded aperture is trainable
initial_ca (torch.Tensor) – Initial coded aperture with shape (1, L, M, N)
- forward(x, type_calculation='forward')[source]
Call method of the layer, it performs the forward or backward operator according to the type_calculation
- Parameters:
x (torch.Tensor) – Input tensor with shape (B, L, M, N)
type_calculation (str) – String, it can be “forward”, “backward” or “forward_backward”
- Returns:
Measurement with shape (B, 1, M, N + L - 1) if type_calculation is “forward”, (1, L, M, N) if type_calculation is “backward, or “forward_backward
- Return type:
torch.Tensor
- Raises:
ValueError – If type_calculation is not “forward”, “backward” or “forward_backward”