Deconvolution2D#

class cuqi.testproblem.Deconvolution2D(dim=128, PSF='gauss', PSF_param=2.56, PSF_size=21, BC='periodic', phantom='satellite', noise_type='gaussian', noise_std=0.0036, prior=None)#

Create a 2D Deconvolution test problem defined by the inverse problem

\[\mathbf{b} = \mathbf{A}\mathbf{x},\]

where \(\mathbf{b}\) is a (noisy) blurred image, \(\mathbf{x}\) is a sharp image and \(\mathbf{A}\) is a convolution operator.

The convolution operator is defined by specifying a point spread function and boundary conditions and is computed (matrix-free) via scipy.signal.fftconvolve. The inputs are padded to fit the boundary conditions. https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.fftconvolve.html.

Parameters:
  • dim (int) –

    size of the (dim,dim) deconvolution problem

  • PSF (string or ndarray) –

    Determines type of the underlying point spread function (PSF).
    ’Gauss’ - a Gaussian blur
    ’Moffat’ - a Moffat blur blur
    ’Defocus’ - an out-of-focus blur
    ndarray - Custom user-specified PSF

  • PSF_param (scalar) –

    A parameter that determines the shape of the PSF;
    the larger the parameter, the larger blur on the image.
    Ignored if PSF is given as ndarray

  • PSF_size (int) –

    Defines the size of the PSF. The size becomes (PSF_size, PSF_size).
    Ignored if PSF is given as ndarray

  • BC (string) –

    Boundary conditions of convolution
    ’zero’ - Zero boundary
    ’periodic’ - Periodic boundary
    ’Neumann’ - Neumann (reflective) boundary
    ’Mirror’ - Mirrored boundary
    ’Nearest’ - Replicates last element of boundary

  • phantom (string or ndarray) –

    The phantom (sharp image) that is convolved.
    If ndarray it should be a square 2D array representing an image.
    The image will automatically be resized to fit the problem size.
    If string it should be any 2D phantom defined in cuqi.data.
    The string is lowercased and any hyphens are replaced
    with underscores to match a method name in cuqi.data.
    Examples:
    ’astronaut’ - a photo of an astronaut.
    ’camera’ - a photo of a man with a camera.
    ’cat’ - a photo of a cat.
    ’cookie’ - cartoon cookie.
    ’satellite’ - a photo of a satellite.

  • noise_type (string) –

    The type of noise
    ”Gaussian” - Gaussian white noise¨
    ”scaledGaussian” - Gaussian noise where standard deviation is scaled by by data.

  • noise_std (scalar) –

    Standard deviation of the noise.

  • prior (Distribution) –

    Option to set the prior distribution.
    If set all components of the posterior
    are defined and sampling can be achieved.

data#

Generated (noisy) data

Type:

CUQIarray

model#

Deconvolution forward model

Type:

Model

prior#

Distribution of the prior

Type:

Distribution

likelihood#

The likelihood function (automatically computed from data distribution)

Type:

Likelihood

exactSolution#

Exact solution (ground truth)

Type:

CUQIarray

exactData#

Noise free data.

Type:

CUQIarray

MAP()#

Compute MAP estimate of posterior. NB: Requires prior to be defined

sample_posterior(Ns)#

Sample Ns samples of the posterior. NB: Requires prior to be defined

__init__(dim=128, PSF='gauss', PSF_param=2.56, PSF_size=21, BC='periodic', phantom='satellite', noise_type='gaussian', noise_std=0.0036, prior=None)#

Methods

MAP([disp, x0])

Compute the Maximum A Posteriori (MAP) estimate of the posterior.

ML([disp, x0])

Compute the Maximum Likelihood (ML) estimate of the posterior.

UQ([Ns, Nb, percent, exact, experimental])

Run an Uncertainty Quantification (UQ) analysis on the Bayesian problem and provide a summary of the results.

__init__([dim, PSF, PSF_param, PSF_size, ...])

get_components()

Method that returns the model, the data and additional information to be used in formulating the Bayesian problem.

sample_posterior(Ns[, Nb, callback, ...])

Sample the posterior.

sample_prior(Ns[, callback])

Sample the prior distribution.

set_data(**kwargs)

Set the data of the problem.

Attributes

data

Extract the observed data from likelihood

likelihood

The likelihood function.

model

Extract the cuqi model from likelihood.

posterior

Create posterior distribution from likelihood and prior.

prior

The prior distribution