spyrit.core.meas.DynamicHadamSplit2d.forward_A_dyn

DynamicHadamSplit2d.forward_A_dyn(x: tensor) tensor

Simulates noisy dynamic measurements with the splitted dynamic matrix

\[y = \mathcal{N}\left(A_{\rm{dyn}} x \right)\]

where \(A_{\rm{dyn}} \in \mathbb{R}^{2 M \times L}\) is the dynamic acquisition matrix, \(x \in \mathbb{R}^L\) is the reference signal of interest, \(M\) is the number of measurements, and \(L\) is the dimension of the signal (with extended FOV).

Warning

This supposes the dynamic measurement matrix \(A_{\rm{dyn}}\) has been set using the build_dynamic_forward() method. An error will be raised otherwise.

Args:

x (torch.tensor): Batch of reference (static) signals. The dimensions indexed by self.meas_dims must match the measurement shape self.img_shape.

Returns:

torch.tensor: Measurement of the input signal. It has shape \((*, M)\) where \(*\) denotes all the dimensions that are not included in self.meas_dims

Example:
>>> import torch
>>> from spyrit.core.noise import Poisson
>>> from spyrit.core.warp import DeformationField
>>> from spyrit.core.meas import DynamicLinearSplit
>>>
>>> def_field = DeformationField(torch.rand([800, 50, 50, 2]) * 2 - 1)  # dummy deformation field with 400 frames
>>> x = torch.rand([1, 3, 50, 50])  # dummy RGB reference image of size 50x50
>>> x_motion = def_field(x)  # dummy video obtained by warping x with def_field
>>> 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()
)
>>>
>>> meas_op.build_dynamic_forward(def_field)
>>> y = meas_op.forward_A_dyn(x)  # simulate noisy dynamic measurements from splitted dynamic matrix A_dyn
>>> print(y.shape)
torch.Size([1, 3, 800])