Skip to main content

Crate convolve_rs

Crate convolve_rs 

Source
Expand description

Smooth radio astronomy FITS images and cubes to a common resolution by convolution in the UV plane. A Rust port of beamcon_2D and beamcon_3D from RACS-tools, also available as a Python package and the convolvers CLI.

  • Beam: an elliptical Gaussian beam and its algebra (beam).
  • common_beam: the smallest beam a set of beams can be convolved to.
  • convolve_uv: UV-plane convolution between two beams.
  • smooth: convolution plus Jy/beam or Kelvin flux scaling.
  • fits_io, cube_io: FITS image and cube I/O.
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_deg = 2.5 / 3600.0;

let smoothed = smooth(
    &image,
    &old_beam,
    &new_beam,
    pixel_deg,
    pixel_deg,
    BrightnessUnit::JyPerBeam,
    None,
)?;
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::FftFloat;
pub use convolve_uv::FftPlans;
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::FitsImageHeader;
pub use fits_io::read_fits;
pub use fits_io::read_fits_header;
pub use fits_io::read_fits_plane;
pub use fits_io::write_fits;
pub use smooth::BrightnessUnit;
pub use smooth::smooth;

Modules§

beam
Elliptical Gaussian beams and their algebra.
common_beam
The smallest beam a set of beams can be convolved to, as radio_beam finds it: the CASA formula for two beams, otherwise a minimum-volume ellipse around points sampled on every beam (Khachiyan’s algorithm).
convolve_uv
FFT-based UV-plane convolution of an image from one Gaussian beam to another, following the “robust” mode of racs_tools.convolve_uv.
cube_io
FITS spectral cube reading and writing with per-channel beams.
fits_io
FITS image reading and writing.
smooth
Convolution plus the flux scaling a brightness unit needs.

Functions§

output_path
Build an output path from input.