spyrit.core.meas.DynamicLinearSplit.forward

DynamicLinearSplit.forward(x: tensor) tensor[source]

Simulates noisy dynamic measurements from matrix A.

It acquires

\[m = \mathcal{N}\left(\text{diag}(A x_{t=1, ..., 2M})\right),\]

where \(A \in \mathbb{R}_+^{2M\times N}\) is the acquisition matrix that contains positive DMD patterns, \(x \in \mathbb{R}^{N \times 2M}\) is the temporal signal of interest, \(2M\) is the number of DMD patterns and the number of frames, \(N\) is the dimension of the signal, \(\text{diag}\colon\, \mathbb{R}^{2M \times 2M} \to \mathbb{R}^{2M}\) extracts the diagonal of its input, and \(\mathcal{N} \colon\, \mathbb{R}^{2M} \to \mathbb{R}^{2M}\) represents a noise operator (e.g., Gaussian).

Given a matrix \(H \in \mathbb{R}^{M\times N}\), we define the positive DMD patterns \(A\) from the positive and negative components of \(H\).

Note

The acquisition matrix \(A\) is given by self.A.

Args:

x (torch.tensor): Video signal \(x\) whose dimensions self.meas_dims must be of shape self.meas_shape and dimension self.time_dim must be of size 2 * self.M.

Returns:

torch.tensor: Measurement vector \(m\) of length 2*self.M.

Example:
>>> import torch
>>> from spyrit.core.meas import DynamicLinearSplit
>>> from spyrit.core.noise import Poisson
>>>
>>> x = torch.rand([1, 800, 3, 50, 50])  # dummy RGB video with 400 frames of size 50x50
>>> H = torch.rand([400, 40*40])  # dummy static measurement matrix
>>> alpha = 5  # noise level
>>> noise_op = Poisson(alpha=alpha, g=1/alpha)
>>> meas_op = DynamicLinearSplit(H, time_dim=1, meas_shape=(40, 40), img_shape=(50, 50), noise_model=noise_op)
>>> print(meas_op)
DynamicLinearSplit(
  (noise_model): Poisson()
)
>>>
>>> y = meas_op(x)  # simulate noisy dynamic measurements
>>> print(y.shape)
torch.Size([1, 3, 800])