Skip to main content

convolve_uv

Function convolve_uv 

Source
pub fn convolve_uv(
    image: &Array2<f32>,
    old_beam: &Beam,
    new_beam: &Beam,
    dx_deg: f64,
    dy_deg: f64,
    cutoff_arcsec: Option<f64>,
) -> Result<ConvolutionResult, ConvolveError>
Expand description

Convolve image from old_beam to new_beam in the UV plane.

dx_deg / dy_deg are the pixel sizes in degrees (FITS |CDELT1|, |CDELT2|). cutoff_arcsec blanks images whose current beam exceeds this size.

The returned ConvolutionResult::scaling_factor is √(Ω_new/Ω_old); see crate::smooth::smooth for how this becomes the Jy/beam or Kelvin factor.

§Examples

use convolve_rs::{Beam, convolve_uv};
use ndarray::Array2;

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

let result = convolve_uv(&image, &old, &new, dx, dx, None)?;
// √(Ω_new/Ω_old) = √4 = 2 for a doubling of both axes.
assert!((result.scaling_factor - 2.0).abs() < 1e-9);
assert_eq!(result.image.dim(), (64, 64));