# PYME.Deconv.deccs module¶

PYME.Deconv.deccs.calc_gauss_weights(sigma)

calculate a gaussian filter kernel (adapted from scipy.ndimage.filters.gaussian_filter1d)

class PYME.Deconv.deccs.dec

Base deconvolution class, implementing a variant of the ICTM algorithm. ie. find f such that:

||Af-d||^2 + lamb^2||L(f - fdef)||^2

is minimised

Note that this is nominally for Gaussian distributed noise, although can be adapted by adding a weighting to the misfit term.

Derived classed should additionally define the following methods: AFunc - the forward mapping (computes Af) AHFunc - conjugate transpose of forward mapping (computes ar{A}^T f) LFunc - the likelihood function LHFunc - conj. transpose of likelihood function

see dec_conv for an implementation of conventional image deconvolution with a measured, spatially invariant PSF

Methods

 deconv(data, lamb[, num_iters, weights, k, k2]) This is what you actually call to do the deconvolution. sim_pic(data, alpha) Do the forward transform to simulate a picture. startGuess(data) starting guess for deconvolution - can be overridden in derived classes subsearch(f0, res, fdef, Afunc, Lfunc, lam2, S) minimise in subspace - this is the bit which gets called on each iteration
deconv(data, lamb, num_iters=10, weights=1, k=0, k2=0)

This is what you actually call to do the deconvolution. parameters are:

data - the raw data lamb - the regularisation parameter num_iters - number of iterations (note that the convergence is fast when

compared to many algorithms - e.g Richardson-Lucy - and the default of 10 will usually already give a reasonable result)
alpha - PSF phase - hacked in for variable phase 4Pi deconvolution, should
really be refactored out into the dec_4pi classes.
sim_pic(data, alpha)

Do the forward transform to simulate a picture. Currently with 4Pi cruft.

startGuess(data)

starting guess for deconvolution - can be overridden in derived classes but the data itself is usually a pretty good guess.

subsearch(f0, res, fdef, Afunc, Lfunc, lam2, S)

minimise in subspace - this is the bit which gets called on each iteration to work out what the next step is going to be. See Inverse Problems text for details.

class PYME.Deconv.deccs.dec_bead

Classical deconvolution using non-fft convolution - pot. faster for v. small psfs. Note that PSF must be symetric

Methods

 Afunc(f) Forward transform - convolve with the PSF Ahfunc(f) Conjugate transform - convolve with conj. Lfunc(f) Lhfunc(f) deconv(data, lamb[, num_iters, weights, k, k2]) This is what you actually call to do the deconvolution. psf_calc(psf, data_size) sim_pic(data, alpha) Do the forward transform to simulate a picture. startGuess(data) starting guess for deconvolution - can be overridden in derived classes subsearch(f0, res, fdef, Afunc, Lfunc, lam2, S) minimise in subspace - this is the bit which gets called on each iteration
Afunc(f)

Forward transform - convolve with the PSF

Ahfunc(f)

Conjugate transform - convolve with conj. PSF

Lfunc(f)
Lhfunc(f)
psf_calc(psf, data_size)
class PYME.Deconv.deccs.dec_conv

Classical deconvolution with a stationary PSF

Methods

 Afunc(f) Forward transform - convolve with the PSF Ahfunc(f) Conjugate transform - convolve with conj. Lfunc(f) Lhfunc(f) deconv(data, lamb[, num_iters, weights, k, k2]) This is what you actually call to do the deconvolution. prep() psf_calc(psf, data_size) Precalculate the OTF etc... sim_pic(data, alpha) Do the forward transform to simulate a picture. startGuess(data) starting guess for deconvolution - can be overridden in derived classes subsearch(f0, res, fdef, Afunc, Lfunc, lam2, S) minimise in subspace - this is the bit which gets called on each iteration
Afunc(f)

Forward transform - convolve with the PSF

Ahfunc(f)

Conjugate transform - convolve with conj. PSF

Lfunc(f)
Lhfunc(f)
lw = 1
prep()
psf_calc(psf, data_size)

Precalculate the OTF etc...

class PYME.Deconv.deccs.dec_gauss

Classical deconvolution using non-fft convolution - pot. faster for v. small psfs. Note that PSF must be symetric

Methods

 Afunc(f) Forward transform - convolve with the PSF Ahfunc(f) Forward transform - convolve with the PSF Lfunc(f) Lhfunc(f) deconv(data, lamb[, num_iters, weights, k, k2]) This is what you actually call to do the deconvolution. psf_calc(sigma, data_size, oversamp) sim_pic(data, alpha) Do the forward transform to simulate a picture. startGuess(data) starting guess for deconvolution - can be overridden in derived classes subsearch(f0, res, fdef, Afunc, Lfunc, lam2, S) minimise in subspace - this is the bit which gets called on each iteration
Afunc(f)

Forward transform - convolve with the PSF

Ahfunc(f)

Forward transform - convolve with the PSF

Lfunc(f)
Lhfunc(f)
k = 100
psf_calc(sigma, data_size, oversamp)