pytomography.priors.prior#

Module Contents#

Classes#

Prior

Abstract class for implementation of prior \(V(f)\) where \(V\) is from the log-posterior probability \(\ln L(\tilde{f}, f) - \beta V(f)\). Any function inheriting from this class should implement a foward method that computes the tensor \(\frac{\partial V}{\partial f_r}\) where \(f\) is an object tensor.

class pytomography.priors.prior.Prior(beta, device='cpu')#

Bases: torch.nn.Module

Abstract class for implementation of prior \(V(f)\) where \(V\) is from the log-posterior probability \(\ln L(\tilde{f}, f) - \beta V(f)\). Any function inheriting from this class should implement a foward method that computes the tensor \(\frac{\partial V}{\partial f_r}\) where \(f\) is an object tensor.

Parameters:
  • beta (float) – Used to scale the weight of the prior

  • device (float) – Pytorch device used for computation. Defaults to ‘cpu’.

set_object_meta(object_meta)#

Sets object metadata parameters.

Parameters:

object_meta (ObjectMeta) – Object metadata describing the system.

Return type:

None

set_beta_scale(factor)#

Sets \(\beta\)

Parameters:

factor (float) – Value of \(\beta\)

Return type:

None

set_object(object)#

Sets the object \(f_r\) used to compute \(\frac{\partial V}{\partial f_r}\)

Parameters:

object (torch.tensor) – Tensor of size [batch_size, Lx, Ly, Lz] representing \(f_r\).

Return type:

None

set_device(device='cpu')#

Sets the pytorch computation device

Parameters:

device (str) – sets device.

Return type:

None

abstract forward()#

Abstract method to compute prior based on the self.object attribute.