spyrit.core.noise.PoissonApproxGaussSameNoise.forward
- PoissonApproxGaussSameNoise.forward(x: tensor) tensor[source]
Simulates measurements corrupted by Poisson noise
- Args:
x: Batch of images. The input is directly passed to the measurement operator, so its shape depends on the type of the measurement operator.- Shape:
x: \((*, h, w)\) if self.meas_op is a static measurement operator, \((*, t, c, h, w)\) if it is a dynamic measurement operator.Output: \((*, M)\) (static measurements) or (*, c, M) (dynamic measurements)- Example 1: Two noisy measurement vectors from a
Linearmeasurement operator >>> H = torch.rand([400,32*32]) >>> meas_op = Linear(H) >>> noise_op = PoissonApproxGaussSameNoise(meas_op, 10.0) >>> x = torch.FloatTensor(10, 32*32).uniform_(-1, 1) >>> y = noise_op(x) >>> print(y.shape) >>> print(f"Measurements in ({torch.min(y):.2f} , {torch.max(y):.2f})") >>> y = noise_op(x) >>> print(f"Measurements in ({torch.min(y):.2f} , {torch.max(y):.2f})") torch.Size([10, 400]) Measurements in (2255.57 , 2911.18) Measurements in (2226.49 , 2934.42)
- Example 2: Two noisy measurement vectors from a
HadamSplitoperator >>> Perm = torch.rand([32*32,32*32]) >>> meas_op = HadamSplit(H, Perm, 32, 32) >>> noise_op = PoissonApproxGaussSameNoise(meas_op, 200.0) >>> x = torch.FloatTensor(10, 32*32).uniform_(-1, 1) >>> y = noise_op(x) >>> print(y.shape) >>> print(f"Measurements in ({torch.min(y):.2f} , {torch.max(y):.2f})") >>> y = noise_op(x) >>> print(f"Measurements in ({torch.min(y):.2f} , {torch.max(y):.2f})") torch.Size([10, 800]) Measurements in (0.00 , 55951.41) Measurements in (0.00 , 56216.86)