spyrit.core.noise.Poisson.forward

Poisson.forward(x)[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.

Output:

y The batch of measurements. Its shape depends on the input shape.

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 Linear measurement operator
>>> H = torch.rand([400,32*32])
>>> meas_op = Linear(H)
>>> noise_op = Poisson(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 (2249.00 , 2896.00)
Measurements in (2237.00 , 2880.00)
Example 2: Two noisy measurement vectors from a HadamSplit operator
>>> Perm = torch.rand([32*32,32*32])
>>> meas_op = HadamSplit(H, Perm, 32, 32)
>>> noise_op = Poisson(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 , 55338.00)
Measurements in (0.00 , 55077.00)
Example 3: Two noisy measurement vectors from a LinearSplit operator
>>> H = torch.rand(24,64)
>>> meas_op = LinearSplit(H)
>>> noise_op = Poisson(meas_op, 50.0)
>>> x = torch.FloatTensor(10, 64, 92).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, 48, 92])
Measurements in (500.00 , 1134.00)
Measurements in (465.00 , 1140.00)