pytomography.priors.prior — PyTomography 0.8.0 documentation

Skip to main content
`Ctrl`+`K`

# `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)

  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

  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 a scale factor for \(\beta\) required for OSEM when finite subsets are used per iteration.

    Parameters:

      factor (float) – Value by which to scale \(\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

  abstract compute_gradient()

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