spyrit.core.meas.DynamicLinearSplit.forward_H_dyn
- DynamicLinearSplit.forward_H_dyn(x: tensor) tensor
Simulates noisy dynamic measurements with the dynamic matrix
\[m = \mathcal{N}\left(H_{\rm{dyn}} x \right)\]where \(H_{\rm{dyn}} \in \mathbb{R}^{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 \(H_{\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 byself.meas_dimsmust match the measurement shapeself.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 DynamicLinear >>> >>> def_field = DeformationField(torch.rand([400, 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 = DynamicLinear(H, time_dim=1, meas_shape=(40, 40), img_shape=(50, 50), noise_model=noise_op) >>> print(meas_op) DynamicLinear( (noise_model): Poisson() ) >>> >>> meas_op.build_dynamic_forward(def_field) >>> m = meas_op.forward_H_dyn(x) # simulate noisy dynamic measurements from dynamic matrix >>> print(m.shape) torch.Size([1, 3, 400])