lib.cost module

COST FUNCTION

This module the class for the sf_deconvolveCost cost function.

Author:Samuel Farrens <samuel.farrens@gmail.com>
Version:1.1
Date:20/10/2017
class lib.cost.sf_deconvolveCost(y, grad, wavelet=None, weights=None, lambda_lowr=None, lambda_psf=1, mode='lowr', positivity=True, verbose=True)[source]

Bases: object

Cost function class for sf_deonvolve

This class implements the cost function for deconvolution

Parameters:
  • y (np.ndarray) – Input original data array
  • operator (function) – Matrix operator function
  • wavelet (class, optional) – Wavelet operator class (“sparse” mode only)
  • weights (np.ndarray, optional) – Array of wavelet thresholding weights (“sparse” mode only)
  • lambda_lowr (float, optional) – Low-rank regularization parameter (“lowr” mode only)
  • lambda_psf (float, optional) – PSF estimate regularization parameter (“psf_unknown” grad_type only)
  • mode (str {'lowr', 'sparse'}, optional) – Deconvolution mode (default is “lowr”)
  • positivity (bool, optional) – Option to test positivity contraint (defult is “True”)
  • verbose (bool) – Option for verbose output (default is “True”)
calc_cost(*args)[source]

Get cost function

This method calculates the cost

Parameters:x (np.ndarray) – Deconvolved data array
Returns:
Return type:float cost
grad_comp(x)[source]

Calculate gradient component of the cost

This method returns the l2 norm error of the difference between the original data and the data obtained after optimisation

Parameters:x (np.ndarray) – Deconvolved data array
Returns:
Return type:float gradient cost component
lowr_comp(x)[source]

Calculate low-rank component of the cost

This method returns the nuclear norm error of the deconvolved data in matrix form

Parameters:x (np.ndarray) – Deconvolved data array
Returns:
Return type:float low-rank cost component
psf_comp()[source]

Calculate PSF estimation component of the cost

This method returns the l2 norm error of the difference between the initial PSF and the estimated PSF

Returns:
Return type:float PSF cost component
sparse_comp(x)[source]

Calculate sparsity component of the cost

This method returns the l1 norm error of the weighted wavelet coefficients

Parameters:x (np.ndarray) – Deconvolved data array
Returns:
Return type:float sparsity cost component