spyrit.core.meas.DynamicLinearSplit.measure

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

Simulates noiseless dynamic measurements from matrix A.

It acquires

\[y = \text{diag}(A x_{t=1, ..., 2M}),\]

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, and \(\text{diag}\colon\, \mathbb{R}^{2M \times 2M} \to \mathbb{R}^{2M}\) extracts the diagonal of its input.

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): Batch of temporal signals \(x\) whose time dimensions :matches self.time_dim and measured dimensions matches self.meas_dims

Returns:

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

Example:
>>> import torch
>>> from spyrit.core.noise import Poisson
>>> from spyrit.core.meas import DynamicLinearSplit
>>>
>>> x = torch.rand([1, 2*400, 3, 50, 50])  # dummy RGB video with 800 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.measure(x)  # simulate noiseless dynamic measurements
>>> print(y.shape)
torch.Size([1, 3, 800])