Skip to main content

Crate convolve_rs

Crate convolve_rs 

Source
Expand description

Rust port of beamcon_2D/beamcon_3D from RACS-tools: smooth radio astronomy FITS images and cubes to a common resolution via UV-plane (FFT) convolution.

Also available as a Python package and a CLI tool (convolvers).

§Overview

  • Beam: a 2D elliptical Gaussian beam (PSF) with convolution / deconvolution algebra (beam).
  • common_beam: smallest beam that a set of beams can be convolved to (common_beam module).
  • convolve_uv: FFT-based UV-plane convolution of an image between two beams (convolve_uv module).
  • smooth: high-level convolve-plus-flux-scaling for Jy/beam or Kelvin images (smooth module).
  • fits_io / cube_io: FITS image and cube I/O.

§Example

Smooth an image from a 10″ to a 20″ circular beam:

use convolve_rs::{Beam, BrightnessUnit, smooth};
use ndarray::Array2;

let old_beam = Beam::from_arcsec(10.0, 10.0, 0.0)?;
let new_beam = Beam::from_arcsec(20.0, 20.0, 0.0)?;
let image = Array2::<f32>::from_elem((64, 64), 1.0);
let pixel_size_deg = 2.5 / 3600.0;

let smoothed = smooth(
    &image,
    &old_beam,
    &new_beam,
    pixel_size_deg,
    pixel_size_deg,
    None,
    BrightnessUnit::JyPerBeam,
)?;
assert_eq!(smoothed.dim(), image.dim());

Re-exports§

pub use beam::Beam;
pub use beam::BeamError;
pub use beam::gauss_factor;
pub use common_beam::CommonBeamError;
pub use common_beam::common_beam;
pub use common_beam::find_commonbeam_between;
pub use convolve_uv::ConvolutionResult;
pub use convolve_uv::ConvolveError;
pub use convolve_uv::convolve_uv;
pub use convolve_uv::fftfreq;
pub use convolve_uv::gaussft;
pub use fits_io::FitsError;
pub use fits_io::FitsImageData;
pub use fits_io::output_path;
pub use fits_io::read_fits;
pub use fits_io::write_fits;
pub use smooth::BrightnessUnit;
pub use smooth::SmoothError;
pub use smooth::smooth;

Modules§

beam
Radio astronomy beam (PSF) represented as a 2D elliptical Gaussian.
common_beam
Common beam algorithms.
convolve_uv
FFT-based UV-plane beam convolution.
cube_io
FITS spectral cube reading and writing with per-channel beam support.
fits_io
FITS image reading and writing.
smooth
High-level smoothing: convolve + apply Jy/beam flux scaling.