SD_CASSI
- class colibri.optics.cassi.SD_CASSI(input_shape, trainable=False, initial_ca=None, **kwargs)[source]
Bases:
BaseOpticsLayer
Single Disperser Coded Aperture Snapshot Spectral Imager (SD-CASSI)
CASSI systems allow for the capture of spatio-spectral information through spatial coding of light and spectral dispersion through a prism.
Mathematically, 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, \(\mathbf{y}\in\yset\) are the acquired signal, for CASSI, \(\xset = \mathbb{R}^{L \times M \times N}\) and \(\yset = \mathbb{R}^{M \times N+L-1}\), and \(\forwardLinear_{\learnedOptics}:\xset\rightarrow \yset\) is the forward operator of the prism dispersion and the modulation of the coded aperture, such 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}\) coded aperture,
Initializes the SD_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, 1, M, N)
- forward(x, type_calculation='forward')[source]
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:
Output tensor with shape (1, 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”