:py:mod:`pytomography.priors.smoothness`
========================================

.. py:module:: pytomography.priors.smoothness


Module Contents
---------------

Classes
~~~~~~~

.. autoapisummary::

   pytomography.priors.smoothness.SmoothnessPrior
   pytomography.priors.smoothness.QuadraticPrior
   pytomography.priors.smoothness.LogCoshPrior




.. py:class:: SmoothnessPrior(beta, delta, phi, device = 'cpu')

   Bases: :py:obj:`pytomography.priors.prior.Prior`

   Implementation of priors with gradients of the form
   :math:`\frac{\partial V}{\partial f_r}=\frac{\beta}{\delta}\sum_{r,s}w_{s}\phi\left(\frac{f_r-f_s}{\delta}\right)` where :math:`V` is from the log-posterior probability :math:`\log P(g | f) - \beta V(f)`.

   .. py:method:: get_kernel()

      Obtains the kernel used to get :math:`\frac{\partial V}{\partial f_r}` (this is an array with the same dimensions as the object space image)

      :returns: Kernel used for convolution (number of output channels equal to number of :math:`s`), and array of weights :math:`w_s` used in expression for gradient.
      :rtype: (torch.nn.Conv3d, torch.tensor)


   .. py:method:: set_kernel(object_meta)

      Sets the kernel using  `get_kernel` and the corresponding object metadata.

      :param object_meta: _description_
      :type object_meta: _type_


   .. py:method:: forward()

      Computes the prior on self.object

      :returns: Tensor of shape [batch_size, Lx, Ly, Lz] representing :math:`\frac{\partial V}{\partial f_r}`
      :rtype: torch.tensor



.. py:class:: QuadraticPrior(beta, delta = 1, device = 'cpu')

   Bases: :py:obj:`SmoothnessPrior`

   Implentation of `SmoothnessPrior` where :math:`\phi` is the identity function


.. py:class:: LogCoshPrior(beta, delta = 1, device = 'cpu')

   Bases: :py:obj:`SmoothnessPrior`

   Implementation of `SmoothnessPrior` where :math:`\phi` is the hyperbolic tangent function


