spyrit.core.meas.DynamicLinear.measure
- DynamicLinear.measure(x)[source]
Simulates noiseless measurements.
\[m = \text{diag}(H x_{t=1, ..., M}),\]where \(H \in \mathbb{R}^{M \times N}\) is the acquisition matrix, \(x_{t=1, ..., M} \in \mathbb{R}^{N \times M}\) is the temporal signal of interest, \(M\) is both the number of measurements and frames, \(N\) is the dimension of the signal in the field of view, and \(\text{diag}\colon\, \mathbb{R}^{M \times M} \to \mathbb{R}^M\) extracts the diagonal of its input.
Note
This method does not degrade measurement with noise. To do so, see
forward()- Args:
x(torch.tensor): A batch of temporal signals whose time dimension matchesself.time_dim, and measured dimensions matchesself.meas_dims.- Returns:
torch.tensor: A batch of measurement of shape \((*, M)\) where * denotes all the dimensions of the input tensor that are not included inself.meas_dims.- Example:
>>> import torch >>> from spyrit.core.meas import DynamicLinear >>> from spyrit.core.noise import Poisson >>> >>> x = torch.rand([1, 400, 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 = DynamicLinear(H, time_dim=1, meas_shape=(40, 40), img_shape=(50, 50), noise_model=noise_op) >>> print(meas_op) DynamicLinear( (noise_model): Poisson() ) >>> m = meas_op.measure(x) # simulate noiseless dynamic measurements >>> print(m.shape) torch.Size([1, 3, 400])