DD_CASSI

class colibri.optics.cassi.DD_CASSI(input_shape, trainable=False, initial_ca=None, **kwargs)[source]

Bases: BaseOpticsLayer

Dual Disperser Coded Aperture Snapshot Spectral Imager (DD-CASSI)

DD-CASSI enabling the capture of spatio-spectral information through a double spectral dispersion with a pair of prisms and the codification using a coded aperture.

Mathematically, DD-CASSI systems 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 DD-CASSI, \(\xset = \mathbb{R}^{L \times M \times N}\) and \(\yset = \mathbb{R}^{M \times N}\). The forward operator \(\forwardLinear_{\learnedOptics}:\xset\rightarrow \yset\) represents the dual dispersion and modulation processes, defined as:

\[\begin{split}\begin{align*} \forwardLinear_{\learnedOptics}: \mathbf{x} &\mapsto \mathbf{y} \\ \mathbf{y}_{i, j} &= \sum_{l=1}^{L} \learnedOptics_{i, j + l -1} \mathbf{x}_{i, j, l} \end{align*}\end{split}\]

The dual dispersion of the scene \(\mathbf{x}\) is achieved by two prisms, and mathematically can be represented as a single dispersion to the coded aperture \(\learnedOptics \in \{0,1\}^{M \times N + L-1}\).

Initializes the DD_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 + L - 1)

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 (1, 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”