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 problemPSF (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 blurndarray - Custom user-specified PSFPSF_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 ndarrayPSF_size (int) –
Defines the size of the PSF. The size becomes (PSF_size, PSF_size).Ignored if PSF is given as ndarrayBC (string) –
Boundary conditions of convolution’zero’ - Zero boundary’periodic’ - Periodic boundary’Neumann’ - Neumann (reflective) boundary’Mirror’ - Mirrored boundary’Nearest’ - Replicates last element of boundaryphantom (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 replacedwith 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 posteriorare defined and sampling can be achieved.
- prior#
Distribution of the prior
- Type:
- likelihood#
The likelihood function (automatically computed from data distribution)
- Type:
- 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, ...])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
Extract the observed data from likelihood
The likelihood function.
Extract the cuqi model from likelihood.
Create posterior distribution from likelihood and prior.
The prior distribution