lib.gradient module

GRADIENT CLASSES

This module contains classses for defining PSF deconvolution specific gradients.

Author:Samuel Farrens <samuel.farrens@gmail.com>
Version:1.0
Date:19/07/2017
class lib.gradient.GradKnownPSF(data, psf, psf_type='fixed')[source]

Bases: lib.gradient.GradPSF

Gradient class for a known PSF

This class calculates the gradient when the PSF is known

Parameters:
  • data (np.ndarray) – Input data array, an array of 2D observed images (i.e. with noise)
  • psf (np.ndarray) – PSF, a single 2D PSF or an array of 2D PSFs
  • psf_type (str {'fixed', 'obj_var'}) – PSF type (defualt is ‘fixed’)

Notes

The properties of GradPSF are inherited in this class

get_grad(x)[source]

Get the gradient at the given iteration

This method calculates the gradient value from the input data

Parameters:x (np.ndarray) – Input data array, an array of recovered 2D images
class lib.gradient.GradNone(data, psf, psf_type='fixed')[source]

Bases: lib.gradient.GradPSF

No gradient class

This is a dummy class that returns an array of zeroes for the gradient

Parameters:
  • data (np.ndarray) – Input data array, an array of 2D observed images (i.e. with noise)
  • psf (np.ndarray) – PSF, a single 2D PSF or an array of 2D PSFs
  • psf_type (str {'fixed', 'obj_var'}) – PSF type (defualt is ‘fixed’)
get_grad(x)[source]

Get the gradient step

This method returns an array of zeroes

Parameters:x (np.ndarray) – Input data array
Returns:
Return type:np.zeros array size
class lib.gradient.GradPSF(data, psf, psf_type='fixed')[source]

Bases: sf_tools.math.matrix.PowerMethod

Gradient class for PSF convolution

This class defines the operators for a fixed or object variant PSF

Parameters:
  • data (np.ndarray) – Input data array, an array of 2D observed images (i.e. with noise)
  • psf (np.ndarray) – PSF, a single 2D PSF or an array of 2D PSFs
  • psf_type (str {'fixed', 'obj_var'}) – PSF type (defualt is ‘fixed’)

Notes

The properties of PowerMethod are inherited in this class

H_op(x)[source]

H matrix operation

This method calculates the action of the matrix H on the input data, in this case the convolution of the the input data with the PSF

Parameters:x (np.ndarray) – Input data array, an array of recovered 2D images
Returns:
Return type:np.ndarray result
Ht_op(x)[source]

Ht matrix operation

This method calculates the action of the transpose of the matrix H on the input data, in this case the convolution of the the input data with the rotated PSF

Parameters:x (np.ndarray) – Input data array, an array of recovered 2D images
Returns:
Return type:np.ndarray result
class lib.gradient.GradShape(data, psf, psf_type='fixed', lambda_reg=1)[source]

Bases: lib.gradient.GradPSF

Gradient class for shape constraint

This class calculates the gradient including shape constraint

Parameters:
  • data (np.ndarray) – Input data array, an array of 2D observed images (i.e. with noise)
  • psf (np.ndarray) – PSF, a single 2D PSF or an array of 2D PSFs
  • psf_type (str {'fixed', 'obj_var'}) – PSF type (defualt is ‘fixed’)
  • lambda_reg (float) – Regularisation control parameter

Notes

The properties of GradPSF are inherited in this class

get_grad(x)[source]

Get the gradient at the given iteration

This method calculates the gradient value from the input data

Parameters:x (np.ndarray) – Input data array, an array of recovered 2D images
class lib.gradient.GradUnknownPSF(data, psf, prox, psf_type='fixed', beta_reg=1, lambda_reg=1)[source]

Bases: lib.gradient.GradPSF

Gradient class for a unknown PSF

This class calculates the gradient when the PSF is not fully known

Parameters:
  • data (np.ndarray) – Input data array, an array of 2D observed images (i.e. with noise)
  • psf (np.ndarray) – PSF, a single 2D PSF or an array of 2D PSFs
  • psf_type (str {'fixed', 'obj_var'}) – PSF type (defualt is ‘fixed’)
  • prox (class) – Proximity operator for PSF update
  • beta_reg (float) – Gradient step size
  • lambda_reg (float) – Regularisation control parameter

Notes

The properties of GradPSF are inherited in this class

get_grad(x)[source]

Get the gradient at the given iteration

This method calculates the gradient value from the input data

Parameters:x (np.ndarray) – Input data array, an array of recovered 2D images