Deconvolution

Regularised Richardson-Lucy with a PSF measured on the stars (or Gaussian/Moffat): tighter stars, crisper detail.

Version
1.0.0
Licence
MIT
Author
Erwan Sturzenegger
astrostack
≥ 0.1.0
Downloads
1
Size
12.4 KB

Description

Regularised Richardson-Lucy deconvolution with a PSF measured on the image's stars (or Gaussian / Moffat): tighter stars, crisper detail, without rings around bright stars.

What it does

The plugin provides one stage: deconv.

Seeing, focus and optics spread every point of light according to a PSF (point spread function). Deconvolution looks for the "unblurred" image which, convolved again with that PSF, gives back the observed image.

  1. PSF.
    • measured (default): astrostack detects stars (SEP, 8 σ threshold), keeps up to 60 isolated, unsaturated stars (peak < 80 % of the maximum), cuts a stamp around each one (size ≈ 3 × FWHM, between 7 and 41 px), re-centres it at sub-pixel precision, normalises it, then takes the median of the stamps. If fewer than 3 stars qualify, a Gaussian PSF with the same FWHM is used.
    • gaussian or moffat: analytic PSF with FWHM fwhm (measured on the stars if left empty); beta sets the Moffat wings.
  2. Richardson-Lucy. Iterative algorithm: at each iteration the estimate is convolved with the PSF, compared with the observed image (ratio), and corrected by that ratio convolved back. Convolutions are done by FFT, with mirrored edges. The image is offset to be strictly positive, as the algorithm requires.
  3. Regularisation (limits noise amplification):
    • tv: total variation (Dey et al. 2006), weighted by tv_lambda; smooths flat areas while keeping edges;
    • damped: damped RL (White 1994): deviations below damping × noise are no longer amplified;
    • none: plain Richardson-Lucy.
  4. Luminance then recolouring (luminance_only, default): only the luminance is deconvolved; the new / old luminance ratio (bounded between 0 and 20) is applied to all three channels, which keeps colours and avoids coloured fringes.
  5. Bright star protection: a star mask (peak > protect_threshold × maximum), feathered over one FWHM, keeps the original around those stars to avoid dark rings (Gibbs effect).
  6. Blending: amount mixes the result with the original.

Very large images (over 4096 × 4096 px) are processed in overlapping 2048 px tiles to limit memory use. In the application's reduced preview, fwhm is scaled automatically.

When to use it

  • Bloated stars caused by seeing or imperfect focus, on a refractor or a smart telescope (Vespera, Seestar: small optics, coarse sampling).
  • Galaxies and nebulae with fine structure (spiral arms, filaments): details a few pixels wide gain contrast.
  • Stacks with a good signal-to-noise ratio: deconvolution needs signal; the more subframes, the more iterations you can afford.

When not to use it:

  • on a very noisy image (few subframes, heavily light-polluted sky): noise is amplified before detail;
  • on a stretched image: Richardson-Lucy assumes linear data (blur is a convolution of the received light, not of its stretched version);
  • on a field without measurable stars unless you set fwhm (the stage is otherwise skipped);
  • on a field where stars are elongated or distorted in a variable way (coma, tilt, tracking): a single PSF cannot describe those variations.

Recommended order: on the linear image, after crop and background/gradient, before denoise and before stretch.

Installation

astrostack plugin install deconvolution

or from the Plugins view of the CelestiaX application, then add the "Deconvolution" step (Details group) to the recipe.

Python dependencies: none beyond the core (python_deps is empty). The plugin uses NumPy, SciPy (FFT, sub-pixel shift) and astrostack's star detection (SEP), all already installed.

Parameters

Stage deconv

Parameter Type Default Description
psf choice measured PSF: measured (on the stars), gaussian or moffat.
fwhm float empty FWHM (px) of the analytic PSFs, 0.5 to 20; empty = measured on the stars (optional).
beta float 3.0 Moffat: beta parameter (1.2 to 10); lower = wider wings.
iterations int 20 Number of iterations (1 to 200).
regularization choice tv Regularisation: tv, damped or none.
tv_lambda float 0.002 Total variation weight (0 to 0.05).
damping float 3.0 Damped RL: threshold in noise σ (0 to 20).
luminance_only bool true Deconvolve the luminance, then recolour.
protect_stars bool true Keep the original around bright stars (anti-ringing).
protect_threshold float 0.3 Protected stars: peak > threshold × maximum (0 to 1).
amount float 1.0 Blend with the original (0 = original, 1 = deconvolved).
mask text empty Optional post-processing mask (see below).

The mask parameter. Restricts the effect to an area: the mask is computed on the image before the stage, then result = before × (1 − m) + after × m. Short form: mask: "object feather=8" (deconvolve only the galaxy or nebula), mask: "stars invert" (everything except stars); dictionary form: mask: {type: luminance, low: 0.1, high: 0.4}. Types: luminance, color, stars, object, range, file, combine; common options invert, blur (σ in px), strength (0–1). An object mask is often the best way to spare the noisy sky background.

YAML examples

Default settings, measured PSF:

pipeline:
  - crop: {}
  - background: {grid: 24, degree: 2, kappa: 2.0}
  - deconv: {iterations: 20, regularization: tv, tv_lambda: 0.002}
  - denoise: {method: wavelets}
  - stretch: {method: auto}

Galaxy only, damped RL, reduced effect:

pipeline:
  - gradient: {}
  - deconv:
      iterations: 40
      regularization: damped
      damping: 3
      amount: 0.7
      mask: {type: object, feather: 8}
  - stretch: {method: ghs}

Star-poor field, fixed Moffat PSF:

pipeline:
  - crop: {}
  - deconv: {psf: moffat, fwhm: 3.2, beta: 3.0, iterations: 15}

Outputs

  • The current image is replaced by the deconvolved image (float32); out-of-field pixels (NaN) are kept.
  • No file is written.
  • Console message: number of iterations, regularisation, PSF type, size and FWHM. A warning is shown if the PSF could not be measured (Gaussian fallback) or if no star is found (stage skipped).

Limitations

  • A single PSF for the whole field: distorted stars in the corners (coma, tilt) are not corrected and may get worse. Check with psf_map (plugin "analysis") and crop if needed.
  • Too many iterations or too low a tv_lambda: grainy noise, rings around medium stars, "orange peel" background. Increase gradually.
  • Saturated stars cannot be deconvolved correctly; protect_stars leaves them untouched.
  • Computing time grows with the number of iterations (two FFT convolutions per iteration).

Licences

  • Plugin: MIT licence, © Erwan Sturzenegger.
  • Dependencies (installed with astrostack): NumPy and SciPy (BSD), OpenCV (Apache 2.0), SEP (LGPL v3 for code derived from SExtractor, BSD/MIT for the rest).
  • References: W. H. Richardson (1972), L. B. Lucy (1974); N. Dey et al. (2006) for TV regularisation; R. L. White (1994) for damped RL.

Steps provided

This plugin adds one step to the pipeline.

StepTypeRole
deconv DeconvolutionPost-processingRegularised Richardson-Lucy with a measured PSF: tighter stars, sharper detail.
  • Post-processing On the stacked image, replayable in the live preview.

Dependencies

No dependency beyond CelestiaX: the plugin works as soon as it is installed.

Versions

  1. 1.0.0 current

    Initial release (extracted from the astrostack core)