spyrit.core.noise.Poisson.forward
- Poisson.forward(z: tensor) tensor[source]
Corrupt measurement by Poisson noise
\[y \sim \mathcal{P}\left(\alpha z\right).\]- Args:
z(torch.tensor): Measurements \(z\) with arbitrary shape.- Returns:
torch.tensor: Noisy measurement \(y\) with the same shape asz.- Example:
Two different noisy measurement vectors
>>> import spyrit.core.noise as sn >>> import torch >>> noise = sn.Poisson(100) >>> z = torch.empty(10, 4).uniform_(0, 1) >>> y = noise(z) >>> print(y.shape) torch.Size([10, 4]) >>> print(f"Noiseless measurements in ({torch.min(z):.2f} , {torch.max(z):.2f})") Noiseless measurements in (...) >>> print(torch.all((z >= 0) & (z <= 1))) tensor(True) >>> print(f"Noisy measurements in ({torch.min(y):.2f} , {torch.max(y):.2f})") Noisy measurements in (...)
>>> y = noise(z) >>> print(f"Noisy measurements in ({torch.min(y):.2f} , {torch.max(y):.2f})") Noisy measurements in (...)