spyrit.core.meas.DynamicLinearSplit.measure_H

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

Simulates noiseless dynamic measurements from matrix H.

It acquires

\[m = \text{diag}(H x_{t=1, ..., M}),\]

where \(H \in \mathbb{R}^{M\times N}\) is the measurement matrix (that may contain negative values), \(x_{t=1, ..., M} \in \mathbb{R}^{N \times M}\) is the temporal signal obtained from averaging the positive and negative frames of \(x_{t=1, ..., 2M}\), \(M\) is the number of DMD patterns, \(N\) is the dimension of the signal, and \(\text{diag}\colon\, \mathbb{R}^{M \times M} \to \mathbb{R}^{M}\) extracts the diagonal of its input.

Note

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

Note

Here the number of frames is 2M and the number of measurements is M.

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 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()
)
>>>
>>> m = meas_op.measure_H(x)  # simulate noiseless dynamic measurements from matrix H
>>> print(m.shape)
torch.Size([1, 3, 400])